kowainik / stan

🕵️ Haskell STatic ANalyser
https://kowainik.github.io/projects/stan
Mozilla Public License 2.0
566 stars 48 forks source link

STAN-0206 doesn't go away after enabling -XStrictData #392

Closed codygman closed 4 years ago

codygman commented 4 years ago

Posting this for someone else, I'll try to add more detail (or get them too) and reproduce if I can later.

goolord commented 4 years ago

minimal example https://github.com/goolord/stan-stricdata-minimal

nothing special required to reproduce this really, the error doesn't go away whether it's a language pragma, in the default-extensions stanza of the cabal file, or otherwise

chshersh commented 4 years ago

@codygman @goolord Can you provide more info on Stan version you are using, how did you build the project, created the HIE files and how are you running Stan?

I just tried running the following on the example repository using the latest version of Stan from master:

cabal build
stan

And everything works as expected, i.e. I don't see any observations in the terminal output.

goolord commented 4 years ago
\Stan v0.0.1.0
 ➤ Git revision: 04d5a192cebb8e63b8704bdd2a8afe5b2d1c3493
 ➤ Commit date:  Tue Sep 15 16:11:42 2020 +0000
 ➤ GHC version:  8.8

built w/ cabal from master

vrom911 commented 4 years ago

@codygman @goolord This is not reproducible for me as well. I build the project with Cabal and the same Stan and GHC version. I am on Mac, and @chshersh checked on Linux.

Stan does not produce any observations, and also is able to recognize the StrictData extension.

           Stan's Summary:
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ Analysed modules             ┃ 1      ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫
┃ Analysed Lines of Code       ┃ 11     ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫
┃ Total Haskell2010 extensions ┃ 1      ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫
┃ Total SafeHaskell extensions ┃ 0      ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫
┃ Total checked inspections    ┃ 44     ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫
┃ Total found observations     ┃ 0      ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫
┃ Total ignored observations   ┃ 0      ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫
┃ Project health               ┃ 100%   ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━┛

Could you provide some details of any specific tools or features you are using to build/run stan-stricdata-minimal?

vrom911 commented 4 years ago

Moreover, we have a lot of tests on this particular inspection, so we do check that this inspection actually works:

https://github.com/kowainik/stan/blob/04d5a192cebb8e63b8704bdd2a8afe5b2d1c3493/test/Test/Stan/Analysis/AntiPattern.hs#L77-L137

codygman commented 4 years ago

I just tried reproducing from NixOS and couldn't.... might be something machine specific for @goolord. We'll have to take a look.

Reproduction attempt ```sh [cody@nixos:/tmp/stan-stricdata-minimal]$ PAGER=cat git log --oneline be50c35 (HEAD -> master, origin/master, origin/HEAD) first commit [cody@nixos:/tmp/stan-stricdata-minimal]$ nix-shell -p pkgs.haskell.compiler.ghc883 --run "cabal build" Up to date [cody@nixos:/tmp/stan-stricdata-minimal]$ ~/code/stan/.stack-work/install/x86_64-linux-nix/21146bec5e0de701f60e46f363fd96007d3477ee1dd9fe80145db1c049dace60/8.8.3/bin/stan report ⓘ Checking environment variables and CLI arguments for default configurations file usage... Fiasco: * [Error ] No STAN_USE_DEFAULT_CONFIG Env Variable is set * [Error ] No CLI option specified for no-default ⓘ The following Configurations are used: Result: With the following warnings: * [Warning] TOML Configurations file doesn't exist: /tmp/stan-stricdata-minimal/.stan.toml * [Warning] TOML Configurations file doesn't exist: /home/cody/.stan.toml * [Warning] No CLI option specified for: checks * [Warning] configChecks is set through the source: Default * [Warning] TOML Configurations file doesn't exist: /tmp/stan-stricdata-minimal/.stan.toml * [Warning] TOML Configurations file doesn't exist: /home/cody/.stan.toml * [Warning] No CLI option specified for: remove * [Warning] configRemoved is set through the source: Default * [Warning] TOML Configurations file doesn't exist: /tmp/stan-stricdata-minimal/.stan.toml * [Warning] TOML Configurations file doesn't exist: /home/cody/.stan.toml * [Warning] No CLI option specified for: ignore * [Warning] configIgnored is set through the source: Default ⓘ Using the following .cabal file: /tmp/stan-stricdata-minimal/stan-stricdata-minimal.cabal ✔ All clean! Stan did not find any observations at the moment. Stan's Summary: ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ ┃ Analysed modules ┃ 1 ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ ┃ Analysed Lines of Code ┃ 11 ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ ┃ Total Haskell2010 extensions ┃ 1 ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ ┃ Total SafeHaskell extensions ┃ 0 ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ ┃ Total checked inspections ┃ 44 ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ ┃ Total found observations ┃ 0 ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ ┃ Total ignored observations ┃ 0 ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━┫ ┃ Project health ┃ 100% ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━━━━━┛ ⓘ Report is generated here -> stan.html ```
goolord commented 4 years ago

I deleted the .hie directory and I can't reproduce this anymore. I don't know what was causing this, it persisted through rebuilds yesterday, but I think it's safe to just close this. Thanks for looking into it :+1:

vrom911 commented 4 years ago

No worries! Let us know if you see some issues again 🙂