Skip to content

Static code analyzer implemented using TypeScript compiler.

License

Notifications You must be signed in to change notification settings

o-su/code-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

code-analyzer

Static code analyzer implemented using TypeScript compiler.

Installation

npm install --save code-analyzer-ts

Example Usage

import * as ts from "typescript";
import { CodeAnalyzer } from "code-analyzer-ts";

new CodeAnalyzer()
    .onFileStart((filePath: string, filename: string, fileExtension: string, content: string) => {
        console.log(filePath, filename, fileExtension, content);
    })
    .onNode((node: ts.Node) => {
        if (ts.isCallExpression(node) && node.expression.getText() === "eval") {
            console.error("Eval is evil!");
        }
    })
    .onFileEnd((filePath: string, filename: string, fileExtension: string, content: string) => {
        console.log(filePath, filename, fileExtension, content);
    })
    .analyze("path");

About

Static code analyzer implemented using TypeScript compiler.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published