Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any good tools for static code analysis in typescript? [closed]

Tags:

We have been searching for good tools for measuring the quality of our TypeScript code. Mainly, we are interested in measuring Cyclomatic Complexity, LCOM, Instability and similar metrics. A tool for visualizing dependencies between modules would also be nice.

A sort of "NDepend for typescript" would be great - but we haven't been able to find anything like it...

Can anyone point us in the direction of any tools that provide some such functionality?

like image 806
Mathias Falkenberg Avatar asked Nov 24 '14 13:11

Mathias Falkenberg


People also ask

Does SonarQube support TypeScript?

SonarQube 8.5 supports TypeScript 3.3. 1 to 3.9. x, both included.

What is the most popular static code analysis tool?

SonarQube. SonarQube is the popular static analysis tool for continuously inspecting the code quality and security of your codebases and guiding development teams during code reviews. SonarQube is used for automated code review with CI/CD Integration.

Is ESLint static code analysis?

ESLint is a static code analysis tool for identifying problematic patterns found in JavaScript code. It was created by Nicholas C. Zakas in 2013. Rules in ESLint are configurable, and customized rules can be defined and loaded.

Why are static analysis tools not used as often as they should be in practice?

Static analysis tools are known to produce false positives and these false positives can “outweigh” the true positives in volume [33]. Another known fact is that, especially with larger projects, the number of warnings produced by a tool can be high, sometimes in the thousands [9].


1 Answers

We have been searching for good tools for measuring the quality of our TypeScript code

Similar to JSHint (mentioned by Steve) for TypeScript there is TSLint https://github.com/palantir/tslint (with a grunt plugin https://github.com/palantir/grunt-tslint)

The rules aren't that complex to create yourself based on TypeScript language service ASTWalker mechanism e.g. Indent rule : https://github.com/palantir/tslint/blob/master/src/rules/indentRule.ts

like image 137
basarat Avatar answered Oct 19 '22 02:10

basarat