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

Stan static analysis using .hie files. #610

Open
philderbeast opened this issue Jul 30, 2022 · 1 comment
Open

Stan static analysis using .hie files. #610

philderbeast opened this issue Jul 30, 2022 · 1 comment

Comments

@philderbeast
Copy link
Contributor

I've tried running stan over liquid-fixpoint. Some of its suggestions I expect we'd want to pursue. Like with the recent hlint changes there are some hints we'd ignore and there is a config file where we can turn those off.

@philderbeast
Copy link
Contributor Author

philderbeast commented Jul 30, 2022

For the foldl anti-pattern stan finds a few hints like the following:

Screen Shot 2022-07-30 at 9 23 58 AM

The same thing from the command line:

  File:         src/Language/Fixpoint/Parse.hs
  Module:       Language.Fixpoint.Parse
  LoC:          1652
  Observations: 1
  Extensions from .cabal:
  Extensions from module: FlexibleContexts, FlexibleInstances, NoMonomorphismRestriction, UndecidableInstances, DeriveGeneric, OverloadedStrings
 ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ┃  ✦ ID:            OBS-STAN-0202-6VNRVE-1385:18
 ┃  ✦ Severity:      Error
 ┃  ✦ Inspection ID: STAN-0202
 ┃  ✦ Name:          Anti-pattern: foldl
 ┃  ✦ Description:   Usage of space-leaking function 'foldl'
 ┃  ✦ Category:      #SpaceLeak #AntiPattern
 ┃  ✦ File:          src/Language/Fixpoint/Parse.hs
 ┃
 ┃  1384 ┃
 ┃  1385 ┃     rwMap      = foldl insert (M.fromList []) rwEntries
 ┃  1386 ┃                  ^^^^^
 ┃
 ┃  💡 Possible solution:
 ┃      ⍟ Replace 'foldl' with 'foldl''
 ┃      ⍟ Use 'foldr (flip . f)` instead of 'foldl f'

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

No branches or pull requests

1 participant