archunit
Version:
ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app
83 lines (82 loc) • 2.31 kB
TypeScript
import * as ts from 'typescript';
import { ClassInfo, Metric } from '../extraction/interface';
/**
* Count metrics interface for file and class-level counting
*/
export interface CountMetric extends Metric {
name: string;
calculate(classInfo: ClassInfo): number;
description: string;
}
/**
* File-level count metrics interface for analyzing entire files
*/
export interface FileCountMetric {
name: string;
calculateFromFile(sourceFile: ts.SourceFile): number;
description: string;
}
/**
* Counts the number of methods in a class
*/
export declare class MethodCountMetric implements CountMetric {
name: string;
description: string;
calculate(classInfo: ClassInfo): number;
}
/**
* Counts the number of fields/properties in a class
*/
export declare class FieldCountMetric implements CountMetric {
name: string;
description: string;
calculate(classInfo: ClassInfo): number;
}
/**
* Counts the total lines of code in a file
*/
export declare class LinesOfCodeMetric implements FileCountMetric {
name: string;
description: string;
calculateFromFile(sourceFile: ts.SourceFile): number;
}
/**
* Counts the total number of statements in a file
*/
export declare class StatementCountMetric implements FileCountMetric {
name: string;
description: string;
calculateFromFile(sourceFile: ts.SourceFile): number;
}
/**
* Counts the number of import statements in a file
*/
export declare class ImportCountMetric implements FileCountMetric {
name: string;
description: string;
calculateFromFile(sourceFile: ts.SourceFile): number;
}
/**
* Counts the number of classes in a file
*/
export declare class ClassCountMetric implements FileCountMetric {
name: string;
description: string;
calculateFromFile(sourceFile: ts.SourceFile): number;
}
/**
* Counts the number of interfaces in a file
*/
export declare class InterfaceCountMetric implements FileCountMetric {
name: string;
description: string;
calculateFromFile(sourceFile: ts.SourceFile): number;
}
/**
* Counts the number of functions in a file (excluding methods)
*/
export declare class FunctionCountMetric implements FileCountMetric {
name: string;
description: string;
calculateFromFile(sourceFile: ts.SourceFile): number;
}