Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stan setting to output static analysis report #384

Merged
merged 8 commits into from
Dec 17, 2024
Merged

Conversation

shivaraj-bh
Copy link
Contributor

@shivaraj-bh shivaraj-bh commented Dec 17, 2024

image

Generating this report is just:

# Inside haskellProjects.<project-name>
{
  settings.<package-name>.stan = true;
}

@srid
Copy link
Owner

srid commented Dec 17, 2024

I'd also make one of the tests use this setting so stan is run as part of CI.

@shivaraj-bh
Copy link
Contributor Author

shivaraj-bh commented Dec 17, 2024

From the test logs:

image

And the HTML report is in the $out:
image

Run **ST**atic **AN**alysis on the package using [stan] and generate an HTML report. The report is created in the `/nix/store` path alongside your package outputs.

> [!note] stan configuration
> This setting looks for a `.stan.toml` file in the root of the package source. See a sample [.stan.toml] configuration for reference.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of hardcoding here. I guess we could eliminate this by making the stan setting a submodule (providing an option to configure custom configuration path) instead of just a boolean, but I doubt that’s necessary.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed these instructions and added .stan.toml to the root:

juspay/vira@53a42bf

However, it doesn't seem to be used, because the generated report still doesn't exclude the StrictData suggestion:

image

It'd be good to demonstrate this in a sample repo, like https://github.com/srid/haskell-template - along with .stan.toml.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shivaraj-bh shivaraj-bh marked this pull request as ready for review December 17, 2024 18:27
@srid srid merged commit e280b39 into srid:master Dec 17, 2024
@srid
Copy link
Owner

srid commented Dec 17, 2024

@shivaraj-bh Do we also use the HLS integration?

haskell/haskell-language-server#2908

@srid
Copy link
Owner

srid commented Dec 17, 2024

Trying this on vira project I hit kowainik/stan#392 ... I wonder if this happens on internal projects too.

EDIT: Happens on haskell-template too: srid/haskell-template#147

@srid
Copy link
Owner

srid commented Dec 17, 2024

Another thing worth considering: add a flake check that will fail if project health is not 100%. Poeple can always add excludes to their stan config if there's a good reason to reject certain suggestions.

@shivaraj-bh shivaraj-bh deleted the stan branch December 18, 2024 07:08
@shivaraj-bh
Copy link
Contributor Author

Do we also use the HLS integration?

No

shivaraj-bh added a commit to shivaraj-bh/haskell-flake that referenced this pull request Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants