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

Addressing staticchecks #1656

Open
lespea opened this issue Sep 20, 2024 · 1 comment
Open

Addressing staticchecks #1656

lespea opened this issue Sep 20, 2024 · 1 comment

Comments

@lespea
Copy link
Contributor

lespea commented Sep 20, 2024

So running make staticcheck produces a ton of findings (and even some source files that don't compile!). Before working on any of them I want to make sure there aren't any you explicitly don't want changed (like ST1005 for example).

Findings count:

   1 const reversedString is unused (U1000)
   1 const underlineString is unused (U1000)
   1 field doAll is unused (U1000)
   1 field ofs0 is unused (U1000)
   1 field ors is unused (U1000)
   1 field valueFieldValues is unused (U1000)
   1 func __one1 is unused (U1000)
   1 printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
   1 redundant break statement (S1023)
   1 should omit comparison to bool constant, can be simplified to !b (S1002)
   1 should omit comparison to bool constant, can be simplified to !classesSeen[class] (S1002)
   1 should omit comparison to bool constant, can be simplified to !eq.AcquireBoolValue() (S1002)
   1 should omit comparison to bool constant, can be simplified to !input1.AcquireBoolValue() (S1002)
   1 should omit comparison to bool constant, can be simplified to !input2.AcquireBoolValue() (S1002)
   1 should omit comparison to bool constant, can be simplified to !mv.intf.(bool) (S1002)
   1 should omit comparison to bool constant, can be simplified to !rc (S1002)
   1 should omit comparison to bool constant, can be simplified to !tr.executedBeginBlocks (S1002)
   1 should omit comparison to bool constant, can be simplified to input (S1002)
   1 should omit comparison to bool constant, can be simplified to inputRecordAndContext.EndOfStream (S1002)
   1 should omit comparison to bool constant, can be simplified to recordAndContext.EndOfStream (S1002)
   1 should omit nil check; len() for []string is defined as zero (S1009)
   1 this value of mv is never used (SA4006)
   1 this value of recordsAndContexts is never used (SA4006)
   2 error strings should not be capitalized (ST1005)
   2 should omit comparison to bool constant, can be simplified to mv.intf.(bool) (S1002)
   2 should use copy(to, from) instead of a loop (S1001)
   3 should omit comparison to bool constant, can be simplified to !boolValue (S1002)
   3 should omit comparison to bool constant, can be simplified to boolValue (S1002)
   3 should omit comparison to bool constant, can be simplified to input1.AcquireBoolValue() (S1002)
   3 should omit nil check; len() for []*github.com/johnkerl/miller/v6/pkg/dsl.ASTNode is defined as zero (S1009)
   3 should omit nil check; len() for [][]int is defined as zero (S1009)
   3 this value of err is never used (SA4006)
   4 this value of intval is never used (SA4006)
   4 this value of stringval is never used (SA4006)
   5 this value of boolval is never used (SA4006)
   6 this value of floatval is never used (SA4006)
  13 ineffective break statement. Did you mean to break out of the outer loop? (SA4011)
  23 unnecessary assignment to the blank identifier (S1005)
 110 error strings should not end with punctuation or newlines (ST1005)

@johnkerl
Copy link
Owner

Wow, thank you! :) I think these are all actionable. Including ST1005. If some unit-test cases fail they can be edited to expect the new lower-cased messages.

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

2 participants