Is there a static analysis tool like Lint or Perl::Critic for shell scripts?
I found shellcheck: it tests for common errors in quoting and other things you overlook (“because it works”).
I found shellcheck: it tests for common errors in quoting and other things you overlook (“because it works”).
GCC docs : -fstack-usage Makes the compiler output stack usage information for the program, on a per-function basis. The filename for the dump is made by appending .su to the auxname. auxname is generated from the name of the output file, if explicitly specified and it is not an executable, otherwise it is the basename … Read more
The warning means, in short, that you are taking the address of a loop variable. This happens because in for statements the iteration variable(s) is reused. At each iteration, the value of the next element in the range expression is assigned to the iteration variable; v doesn’t change, only its value changes. Hence, the expression … Read more
I know that Gimpel’s Lint products (PC-Lint and Flexelint) will identify unreachable code and unused / unreferenced modules. They both fall in the category of static analysis tools. I have no affiliation w/ Gimpel, just a satisfied long-term customer.
Findbugs PMD Checkstyle Lint4J Classycle JDepend SISSy Google Codepro
I think it is pretty clear from the link you added: if you use @CheckForNull and the code that uses the value does not check for null, FindBugs will show it as an error. FindBugs will ignore @Nullable. In practice this annotation is useful only for overriding an overarching NonNull annotation. Use @CheckForNull in the … Read more
You want GCC’s warn_unused_result attribute: #define WARN_UNUSED __attribute__((warn_unused_result)) int WARN_UNUSED f(int z) { return z + (z*2) + z/3 + z*z + 23; } int main() { int i = 7; f(i); ///// <<—– here i disregard the return value return 1; } Trying to compile this code produces: $ gcc test.c test.c: In function … Read more
It is not redundant in the sense that using it does change things. As one would expect, you cannot extend a final case class, but you can extend a non-final one. Why does wartremover suggest that case classes should be final? Well, because extending them isn’t really a very good idea. Consider this: scala> case … Read more
Here is an updated answer as of August 2014 for some that are aimed or work well with Scala. Personally I think the JVM or Java ones end up with far too many false positives, or have inspections that are aimed mostly at Java specific classes. For example, since in Scala we don’t tend to … Read more
You could use a code coverage analysis tool for this and look for unused spots in your code. A popular tool for the gcc toolchain is gcov, together with the graphical frontend lcov (http://ltp.sourceforge.net/coverage/lcov.php). If you use gcc, you can compile with gcov support, which is enabled by the ‘–coverage’ flag. Next, run your application … Read more