About
A linter is a tool that:
- statically analyze code
- finds problems in them
- may enforce a coding style.
They are also used for syntax highlighting
Example implementation
Bad variable name writing
Bad name writing is a problem that occurs when the developer makes a mistake in the variable name.
Example:
- The variable has been written: $contextpath and not $contextPath with an uppercase letter P
- The variable is then unused
- The linter will report it and colors the variable characters in grey.
Because this language is dynamic (no variable and type declaration), it allows for the declaration of variables everywhere and will not create any problems when it runs.
Implementation
A linter is basically a parser that traverse and analyze the parse tree to:
- find problem (type, …)
- etc …
Example
- https://github.com/spotbugs/spotbugs (Findbugs)