Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clojure code static analysis tools

Is there a tool to run code convention tests in clojure? For example, make sure function names don't have any capital letters or keywords don't have any underscores in them.

like image 363
Jake Pearson Avatar asked May 23 '13 19:05

Jake Pearson


People also ask

Which type of tools perform static analysis of code?

Source code analysis tools, also known as Static Application Security Testing (SAST) Tools, can help analyze source code or compiled versions of code to help find security flaws. SAST tools can be added into your IDE. Such tools can help you detect issues during software development.

What is static analysis tool?

Static analysis tools refer to a wide array of tools that examine source code, executables, or even documentation, to find problems before they happen; without actually running the code.

What is Github SAST?

ShiftLeftSecurity / sast-scan Scan is a free & Open Source DevSecOps tool for performing static analysis based security testing of your applications and its dependencies. CI and Git friendly.

What is static source code analysis?

Static analysis, also called static code analysis, is a method of computer program debugging that is done by examining the code without executing the program. The process provides an understanding of the code structure and can help ensure that the code adheres to industry standards.


2 Answers

Two useful Leiningen plugins I learned about recently:

  • lein-bikeshed
  • lein-kibit
like image 84
noahlz Avatar answered Oct 16 '22 11:10

noahlz


Late to the party here. Seconding noahlz, the three main static analysis tools that I use on a regular basis are lein-bikeshed, lein-kibit, and Eastwood, though I also use yagni. Each of these has different strengths.

Bikeshed is good for general code cleanup but is mostly focused on style (e.g. making sure lines aren't too long, there's no trailing whitespace, functions have docstrings, etc.).

Kibit is good for showing you the most idiomatic function to use (for instance, when using an if form that returns nil if false, you could just use when instead).

Eastwood is probably the most comprehensive lint tool that exists for Clojure, and checks for a pretty impressive number of code smell issues.

Finally, Yagni is great for finding unused code paths in your libraries and applications.

like image 6
Venantius Avatar answered Oct 16 '22 11:10

Venantius