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

hls-stan-plugin respect .stan.toml config file #3904

Closed
cdepillabout opened this issue Dec 16, 2023 · 3 comments · Fixed by #3914
Closed

hls-stan-plugin respect .stan.toml config file #3904

cdepillabout opened this issue Dec 16, 2023 · 3 comments · Fixed by #3914

Comments

@cdepillabout
Copy link
Contributor

Is your enhancement request related to a problem? Please describe.

It appears that the hls-stan-plugin doesn't respect the configuration directives in a .stan.toml file in the root of my project.

I have a stack.yaml-based Haskell project with multiple packages. I have a .stan.toml file in the root of my project that looks like the following:

.stan.toml:

[[check]]
type = "Exclude"
id = "STAN-0213"
scope = "all"

I'm expecting that this disables the STAN-0213 check (which warns about pattern matching on _) when running stan.

However, if I explicitly run HLS on a given Haskell file in my repo, it still warns about STAN-0213:

$ haskell-language-server-wrapper typecheck ./src/path/to/MyModule.hs
...
File:    
  ./src/path/to/MyModule.hs
Hidden:   no
Range:    69:9-69:21
Source:   stan
Severity: DiagnosticSeverity_Hint
Message: 
  ✲ Name: Anti-pattern: Pattern matching on '_'
  ✲ Description: Pattern matching on '_' for sum types can create maintainability issues
  ✲ Severity: Warning
  ✲ Category: #AntiPattern
  Possible solutions:
  - Pattern match on each constructor explicitly
  - Add meaningful names to holes, e.g. '_anyOtherFailure'

Describe the solution you'd like

I would expect that a .stan.toml file in the root of my project affects the warnings that the hls-stan-plugin shows.

Describe alternatives you've considered

I haven't considered any alternatives.

However, this is the first time I've messed around with stan, so I'm not 100% sure I'm configuring it properly. I haven't been able to figure out how to get the standalone stan executable to work properly, so it is possible this is just a stan issue and not HLS-related.

I've looked through the following documentation for stan:

Additional context

I'm using the following versions of the tools:

  • HLS 2.5.0.0
  • GHC 9.4.8
  • (I think HLS-2.5.0.0 is compiled against stan-0.1.0.2, but I haven't been able to confirm that)

ping @0rphee, who re-added the stan plugin in #3851

@cdepillabout
Copy link
Contributor Author

It appears that the hls-stan-plugin doesn't respect the configuration directives in a .stan.toml file in the root of my project.

I should add that this is in contrast to the hls-hlint-plugin, which does appear to respect configuration given in a .hlint.yaml file in the root of my project.

@0rphee
Copy link
Collaborator

0rphee commented Dec 17, 2023

Yes, currently the plugin doesn't take into account any user configuration. It just checks all the inspections possible. I'm looking into it right now, but if you want to give it a shot that's alright by me!

0rphee added a commit to 0rphee/haskell-language-server that referenced this issue Dec 18, 2023
0rphee added a commit to 0rphee/haskell-language-server that referenced this issue Dec 18, 2023
0rphee added a commit to 0rphee/haskell-language-server that referenced this issue Dec 22, 2023
0rphee added a commit to 0rphee/haskell-language-server that referenced this issue Dec 22, 2023
0rphee added a commit to 0rphee/haskell-language-server that referenced this issue Jan 8, 2024
0rphee added a commit to 0rphee/haskell-language-server that referenced this issue Jan 9, 2024
michaelpj added a commit that referenced this issue Jan 11, 2024
* Bump stan

Needed in order to get the functions for getting the config, etc.

* Use stan config files for stan plugin (#3904)

* Add test case for .stan.toml configuration

* Fix windows tests

See kowainik/stan#531

---------

Co-authored-by: Michael Peyton Jones <[email protected]>
soulomoon added a commit to soulomoon/haskell-language-server that referenced this issue Jan 12, 2024
commit 2fe2d70
Merge: 034b33e bea1fed
Author: fendor <[email protected]>
Date:   Thu Jan 11 16:05:34 2024 +0100

    Merge pull request haskell#3941 from fendor/enhance/cabal-no-diags-if-disabled

    Don't produce diagnostics if plugin is turned off

commit bea1fed
Merge: e9aab3c 034b33e
Author: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Date:   Thu Jan 11 13:54:12 2024 +0000

    Merge branch 'master' into enhance/cabal-no-diags-if-disabled

commit e9aab3c
Author: Fendor <[email protected]>
Date:   Wed Jan 10 17:18:39 2024 +0100

    Don't produce diagnostics if plugin is turned off

commit 034b33e
Author: 0rphee <[email protected]>
Date:   Thu Jan 11 02:53:11 2024 -0600

    Use stan config files for stan plugin (haskell#3904) (haskell#3914)

    * Bump stan

    Needed in order to get the functions for getting the config, etc.

    * Use stan config files for stan plugin (haskell#3904)

    * Add test case for .stan.toml configuration

    * Fix windows tests

    See kowainik/stan#531

    ---------

    Co-authored-by: Michael Peyton Jones <[email protected]>
@0rphee 0rphee linked a pull request Jan 28, 2024 that will close this issue
@0rphee
Copy link
Collaborator

0rphee commented Jan 28, 2024

Solved by #3914

@0rphee 0rphee closed this as completed Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants