code-auditor-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +362 -0
- package/configs/hhra-compat.json +168 -0
- package/dist/analyzers/analyzerUtils.d.ts +69 -0
- package/dist/analyzers/analyzerUtils.d.ts.map +1 -0
- package/dist/analyzers/analyzerUtils.js +188 -0
- package/dist/analyzers/analyzerUtils.js.map +1 -0
- package/dist/analyzers/dataAccessAnalyzer.d.ts +46 -0
- package/dist/analyzers/dataAccessAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/dataAccessAnalyzer.js +448 -0
- package/dist/analyzers/dataAccessAnalyzer.js.map +1 -0
- package/dist/analyzers/dryAnalyzer.d.ts +30 -0
- package/dist/analyzers/dryAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/dryAnalyzer.js +537 -0
- package/dist/analyzers/dryAnalyzer.js.map +1 -0
- package/dist/analyzers/solidAnalyzer.d.ts +23 -0
- package/dist/analyzers/solidAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/solidAnalyzer.js +355 -0
- package/dist/analyzers/solidAnalyzer.js.map +1 -0
- package/dist/auditRunner.d.ts +20 -0
- package/dist/auditRunner.d.ts.map +1 -0
- package/dist/auditRunner.js +214 -0
- package/dist/auditRunner.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +38 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/configLoader.d.ts +19 -0
- package/dist/config/configLoader.d.ts.map +1 -0
- package/dist/config/configLoader.js +124 -0
- package/dist/config/configLoader.js.map +1 -0
- package/dist/config/defaults.d.ts +69 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +142 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-standalone.d.ts +3 -0
- package/dist/mcp-standalone.d.ts.map +1 -0
- package/dist/mcp-standalone.js +171 -0
- package/dist/mcp-standalone.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +340 -0
- package/dist/mcp.js.map +1 -0
- package/dist/reporting/csvReportGenerator.d.ts +29 -0
- package/dist/reporting/csvReportGenerator.d.ts.map +1 -0
- package/dist/reporting/csvReportGenerator.js +182 -0
- package/dist/reporting/csvReportGenerator.js.map +1 -0
- package/dist/reporting/htmlReportGenerator.d.ts +18 -0
- package/dist/reporting/htmlReportGenerator.d.ts.map +1 -0
- package/dist/reporting/htmlReportGenerator.js +352 -0
- package/dist/reporting/htmlReportGenerator.js.map +1 -0
- package/dist/reporting/jsonReportGenerator.d.ts +23 -0
- package/dist/reporting/jsonReportGenerator.d.ts.map +1 -0
- package/dist/reporting/jsonReportGenerator.js +103 -0
- package/dist/reporting/jsonReportGenerator.js.map +1 -0
- package/dist/reporting/reportGenerator.d.ts +21 -0
- package/dist/reporting/reportGenerator.d.ts.map +1 -0
- package/dist/reporting/reportGenerator.js +53 -0
- package/dist/reporting/reportGenerator.js.map +1 -0
- package/dist/types.d.ts +246 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/astParser.d.ts +71 -0
- package/dist/utils/astParser.d.ts.map +1 -0
- package/dist/utils/astParser.js +244 -0
- package/dist/utils/astParser.js.map +1 -0
- package/dist/utils/astUtils.d.ts +89 -0
- package/dist/utils/astUtils.d.ts.map +1 -0
- package/dist/utils/astUtils.js +289 -0
- package/dist/utils/astUtils.js.map +1 -0
- package/dist/utils/fileDiscovery.d.ts +58 -0
- package/dist/utils/fileDiscovery.d.ts.map +1 -0
- package/dist/utils/fileDiscovery.js +203 -0
- package/dist/utils/fileDiscovery.js.map +1 -0
- package/examples/.auditrc.example.json +61 -0
- package/examples/.auditrc.json +201 -0
- package/examples/nextjs.auditrc.json +65 -0
- package/examples/node-api.auditrc.json +82 -0
- package/examples/react.auditrc.json +59 -0
- package/package.json +62 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Discovery Utilities
|
|
3
|
+
* Provides functionality for discovering and filtering files for analysis
|
|
4
|
+
*
|
|
5
|
+
* Supports TypeScript, JavaScript, and JSX/TSX files with configurable
|
|
6
|
+
* include/exclude patterns
|
|
7
|
+
*/
|
|
8
|
+
export declare const DEFAULT_EXCLUDED_DIRS: string[];
|
|
9
|
+
export declare const TYPESCRIPT_EXTENSIONS: string[];
|
|
10
|
+
export declare const JAVASCRIPT_EXTENSIONS: string[];
|
|
11
|
+
export declare const ALL_EXTENSIONS: string[];
|
|
12
|
+
export interface FileDiscoveryOptions {
|
|
13
|
+
extensions?: string[];
|
|
14
|
+
excludeDirs?: string[];
|
|
15
|
+
includePaths?: string[];
|
|
16
|
+
excludePaths?: string[];
|
|
17
|
+
followSymlinks?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Find all files matching the given options
|
|
21
|
+
*/
|
|
22
|
+
export declare function findFiles(rootDir?: string, options?: FileDiscoveryOptions): Promise<string[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Find TypeScript/TSX files
|
|
25
|
+
*/
|
|
26
|
+
export declare function findTypeScriptFiles(rootDir?: string, options?: Omit<FileDiscoveryOptions, 'extensions'>): Promise<string[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Find JavaScript/JSX files
|
|
29
|
+
*/
|
|
30
|
+
export declare function findJavaScriptFiles(rootDir?: string, options?: Omit<FileDiscoveryOptions, 'extensions'>): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Find files by pattern (e.g., "*.test.ts", "*.spec.tsx")
|
|
33
|
+
*/
|
|
34
|
+
export declare function findFilesByPattern(rootDir: string, pattern: string | RegExp, options?: FileDiscoveryOptions): Promise<string[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Filter files by include/exclude patterns
|
|
37
|
+
*/
|
|
38
|
+
export declare function filterFiles(files: string[], options?: {
|
|
39
|
+
includePaths?: string[];
|
|
40
|
+
excludePaths?: string[];
|
|
41
|
+
}): string[];
|
|
42
|
+
/**
|
|
43
|
+
* Get file statistics
|
|
44
|
+
*/
|
|
45
|
+
export declare function getFileStats(filePath: string): Promise<{
|
|
46
|
+
size: number;
|
|
47
|
+
modified: Date;
|
|
48
|
+
lines?: number;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Check if a file exists and is readable
|
|
52
|
+
*/
|
|
53
|
+
export declare function isReadableFile(filePath: string): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Alias for findFiles to match expected import
|
|
56
|
+
*/
|
|
57
|
+
export declare const discoverFiles: typeof findFiles;
|
|
58
|
+
//# sourceMappingURL=fileDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileDiscovery.d.ts","sourceRoot":"","sources":["../../src/utils/fileDiscovery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,eAAO,MAAM,qBAAqB,UAcjC,CAAC;AAGF,eAAO,MAAM,qBAAqB,UAAkB,CAAC;AACrD,eAAO,MAAM,qBAAqB,UAAkB,CAAC;AACrD,eAAO,MAAM,cAAc,UAAuD,CAAC;AAEnF,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAuDD;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,GAAE,MAAsB,EAC/B,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBnB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,GAAE,MAAsB,EAC/B,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,YAAY,CAAM,GACrD,OAAO,CAAC,MAAM,EAAE,CAAC,CAKnB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,GAAE,MAAsB,EAC/B,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,YAAY,CAAM,GACrD,OAAO,CAAC,MAAM,EAAE,CAAC,CAKnB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAsB,EAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBnB;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,GAAE;IACP,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GACL,MAAM,EAAE,CA0BV;AAaD;;GAEG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAiBD;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQvE;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,kBAAY,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Discovery Utilities
|
|
3
|
+
* Provides functionality for discovering and filtering files for analysis
|
|
4
|
+
*
|
|
5
|
+
* Supports TypeScript, JavaScript, and JSX/TSX files with configurable
|
|
6
|
+
* include/exclude patterns
|
|
7
|
+
*/
|
|
8
|
+
import { promises as fs } from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
// Default directories to exclude from analysis
|
|
11
|
+
export const DEFAULT_EXCLUDED_DIRS = [
|
|
12
|
+
'node_modules',
|
|
13
|
+
'.next',
|
|
14
|
+
'dist',
|
|
15
|
+
'build',
|
|
16
|
+
'.git',
|
|
17
|
+
'coverage',
|
|
18
|
+
'.turbo',
|
|
19
|
+
'out',
|
|
20
|
+
'.cache',
|
|
21
|
+
'tmp',
|
|
22
|
+
'temp',
|
|
23
|
+
'.vscode',
|
|
24
|
+
'.idea'
|
|
25
|
+
];
|
|
26
|
+
// Supported file extensions
|
|
27
|
+
export const TYPESCRIPT_EXTENSIONS = ['.ts', '.tsx'];
|
|
28
|
+
export const JAVASCRIPT_EXTENSIONS = ['.js', '.jsx'];
|
|
29
|
+
export const ALL_EXTENSIONS = [...TYPESCRIPT_EXTENSIONS, ...JAVASCRIPT_EXTENSIONS];
|
|
30
|
+
/**
|
|
31
|
+
* Check if a path should be excluded based on directory names
|
|
32
|
+
*/
|
|
33
|
+
function shouldExcludeDir(filePath, excludeDirs) {
|
|
34
|
+
const parts = filePath.split(path.sep);
|
|
35
|
+
return parts.some(part => excludeDirs.includes(part));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Recursively find files matching criteria
|
|
39
|
+
*/
|
|
40
|
+
async function findFilesRecursive(dir, options) {
|
|
41
|
+
const results = [];
|
|
42
|
+
try {
|
|
43
|
+
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
const fullPath = path.join(dir, entry.name);
|
|
46
|
+
if (shouldExcludeDir(fullPath, options.excludeDirs)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (entry.isDirectory()) {
|
|
50
|
+
const subResults = await findFilesRecursive(fullPath, options);
|
|
51
|
+
results.push(...subResults);
|
|
52
|
+
}
|
|
53
|
+
else if (entry.isFile()) {
|
|
54
|
+
const ext = path.extname(entry.name);
|
|
55
|
+
if (options.extensions.includes(ext)) {
|
|
56
|
+
if (!options.pattern || options.pattern.test(entry.name)) {
|
|
57
|
+
results.push(fullPath);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
// Silently skip directories we can't read
|
|
65
|
+
if (error.code !== 'EACCES') {
|
|
66
|
+
console.error(`Error reading directory ${dir}:`, error);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return results;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Find all files matching the given options
|
|
73
|
+
*/
|
|
74
|
+
export async function findFiles(rootDir = process.cwd(), options = {}) {
|
|
75
|
+
const extensions = options.extensions || ALL_EXTENSIONS;
|
|
76
|
+
const excludeDirs = options.excludeDirs || DEFAULT_EXCLUDED_DIRS;
|
|
77
|
+
const files = await findFilesRecursive(rootDir, {
|
|
78
|
+
extensions,
|
|
79
|
+
excludeDirs
|
|
80
|
+
});
|
|
81
|
+
// Apply additional filtering
|
|
82
|
+
let filtered = filterFiles(files, {
|
|
83
|
+
includePaths: options.includePaths,
|
|
84
|
+
excludePaths: options.excludePaths
|
|
85
|
+
});
|
|
86
|
+
// Sort for consistent output
|
|
87
|
+
return filtered.sort();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Find TypeScript/TSX files
|
|
91
|
+
*/
|
|
92
|
+
export async function findTypeScriptFiles(rootDir = process.cwd(), options = {}) {
|
|
93
|
+
return findFiles(rootDir, {
|
|
94
|
+
...options,
|
|
95
|
+
extensions: TYPESCRIPT_EXTENSIONS
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Find JavaScript/JSX files
|
|
100
|
+
*/
|
|
101
|
+
export async function findJavaScriptFiles(rootDir = process.cwd(), options = {}) {
|
|
102
|
+
return findFiles(rootDir, {
|
|
103
|
+
...options,
|
|
104
|
+
extensions: JAVASCRIPT_EXTENSIONS
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Find files by pattern (e.g., "*.test.ts", "*.spec.tsx")
|
|
109
|
+
*/
|
|
110
|
+
export async function findFilesByPattern(rootDir = process.cwd(), pattern, options = {}) {
|
|
111
|
+
const extensions = options.extensions || ALL_EXTENSIONS;
|
|
112
|
+
const excludeDirs = options.excludeDirs || DEFAULT_EXCLUDED_DIRS;
|
|
113
|
+
// Convert string pattern to RegExp if needed
|
|
114
|
+
const regex = typeof pattern === 'string'
|
|
115
|
+
? new RegExp(pattern.replace(/\*/g, '.*'))
|
|
116
|
+
: pattern;
|
|
117
|
+
const files = await findFilesRecursive(rootDir, {
|
|
118
|
+
extensions,
|
|
119
|
+
excludeDirs,
|
|
120
|
+
pattern: regex
|
|
121
|
+
});
|
|
122
|
+
// Apply additional filtering
|
|
123
|
+
let filtered = filterFiles(files, {
|
|
124
|
+
includePaths: options.includePaths,
|
|
125
|
+
excludePaths: options.excludePaths
|
|
126
|
+
});
|
|
127
|
+
return filtered.sort();
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Filter files by include/exclude patterns
|
|
131
|
+
*/
|
|
132
|
+
export function filterFiles(files, options = {}) {
|
|
133
|
+
let filtered = [...files];
|
|
134
|
+
// Apply include patterns
|
|
135
|
+
if (options.includePaths && options.includePaths.length > 0) {
|
|
136
|
+
filtered = filtered.filter(file => {
|
|
137
|
+
return options.includePaths.some(pattern => {
|
|
138
|
+
// Convert glob patterns to regex
|
|
139
|
+
const regex = globToRegex(pattern);
|
|
140
|
+
return regex.test(file);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// Apply exclude patterns
|
|
145
|
+
if (options.excludePaths && options.excludePaths.length > 0) {
|
|
146
|
+
filtered = filtered.filter(file => {
|
|
147
|
+
return !options.excludePaths.some(pattern => {
|
|
148
|
+
// Convert glob patterns to regex
|
|
149
|
+
const regex = globToRegex(pattern);
|
|
150
|
+
return regex.test(file);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return filtered;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Convert simple glob pattern to regex
|
|
158
|
+
*/
|
|
159
|
+
function globToRegex(pattern) {
|
|
160
|
+
// Escape special regex characters except * and ?
|
|
161
|
+
let regex = pattern.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
162
|
+
// Convert glob wildcards to regex
|
|
163
|
+
regex = regex.replace(/\*/g, '.*').replace(/\?/g, '.');
|
|
164
|
+
return new RegExp(`^${regex}$`);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get file statistics
|
|
168
|
+
*/
|
|
169
|
+
export async function getFileStats(filePath) {
|
|
170
|
+
const stats = await fs.stat(filePath);
|
|
171
|
+
// Count lines for text files
|
|
172
|
+
let lines;
|
|
173
|
+
try {
|
|
174
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
175
|
+
lines = content.split('\n').length;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// Ignore errors reading file content
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
size: stats.size,
|
|
182
|
+
modified: stats.mtime,
|
|
183
|
+
lines
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Check if a file exists and is readable
|
|
188
|
+
*/
|
|
189
|
+
export async function isReadableFile(filePath) {
|
|
190
|
+
try {
|
|
191
|
+
await fs.access(filePath, fs.constants.R_OK);
|
|
192
|
+
const stats = await fs.stat(filePath);
|
|
193
|
+
return stats.isFile();
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Alias for findFiles to match expected import
|
|
201
|
+
*/
|
|
202
|
+
export const discoverFiles = findFiles;
|
|
203
|
+
//# sourceMappingURL=fileDiscovery.js.map
|
|
@@ -0,0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AAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projectRoot": ".",
|
|
3
|
+
"reportTitle": "Code Quality Audit Report",
|
|
4
|
+
|
|
5
|
+
"includePaths": [
|
|
6
|
+
"src/**/*.{ts,tsx,js,jsx}",
|
|
7
|
+
"app/**/*.{ts,tsx,js,jsx}",
|
|
8
|
+
"lib/**/*.{ts,tsx,js,jsx}",
|
|
9
|
+
"components/**/*.{ts,tsx,js,jsx}"
|
|
10
|
+
],
|
|
11
|
+
|
|
12
|
+
"excludePaths": [
|
|
13
|
+
"**/node_modules/**",
|
|
14
|
+
"**/.next/**",
|
|
15
|
+
"**/dist/**",
|
|
16
|
+
"**/build/**",
|
|
17
|
+
"**/coverage/**",
|
|
18
|
+
"**/*.test.{ts,tsx,js,jsx}",
|
|
19
|
+
"**/*.spec.{ts,tsx,js,jsx}",
|
|
20
|
+
"**/__tests__/**"
|
|
21
|
+
],
|
|
22
|
+
|
|
23
|
+
"enabledAnalyzers": [
|
|
24
|
+
"solid",
|
|
25
|
+
"dry",
|
|
26
|
+
"security",
|
|
27
|
+
"component",
|
|
28
|
+
"data-access"
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
"analyzerConfig": {
|
|
32
|
+
"solid": {
|
|
33
|
+
"maxMethodsPerClass": 10,
|
|
34
|
+
"maxLinesPerMethod": 50,
|
|
35
|
+
"maxParametersPerMethod": 4,
|
|
36
|
+
"maxComplexity": 10
|
|
37
|
+
},
|
|
38
|
+
"dry": {
|
|
39
|
+
"minLineThreshold": 5,
|
|
40
|
+
"similarityThreshold": 0.85
|
|
41
|
+
},
|
|
42
|
+
"security": {
|
|
43
|
+
"authPatterns": ["withAuth", "requireAuth", "isAuthenticated"],
|
|
44
|
+
"rateLimitPatterns": ["rateLimit", "withRateLimit"]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
"outputFormats": ["html", "json"],
|
|
49
|
+
"outputDirectory": "./audit-reports",
|
|
50
|
+
|
|
51
|
+
"minSeverity": "suggestion",
|
|
52
|
+
"failOnCritical": false,
|
|
53
|
+
"verbose": false,
|
|
54
|
+
"showProgress": true,
|
|
55
|
+
|
|
56
|
+
"thresholds": {
|
|
57
|
+
"maxCritical": 0,
|
|
58
|
+
"maxWarnings": 50,
|
|
59
|
+
"minHealthScore": 80
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
{
|
|
2
|
+
"// Configuration for TypeScript/JavaScript Code Auditor": "",
|
|
3
|
+
"// This example shows common configuration options": "",
|
|
4
|
+
"// Remove comment lines before using this file": "",
|
|
5
|
+
|
|
6
|
+
"// Project Settings": "",
|
|
7
|
+
"projectRoot": ".",
|
|
8
|
+
"reportTitle": "My Project Code Quality Audit",
|
|
9
|
+
|
|
10
|
+
"// File Discovery": "",
|
|
11
|
+
"// Specify which files to include in the audit": "",
|
|
12
|
+
"includePaths": [
|
|
13
|
+
"src/**/*.{ts,tsx,js,jsx}",
|
|
14
|
+
"app/**/*.{ts,tsx,js,jsx}",
|
|
15
|
+
"lib/**/*.{ts,tsx,js,jsx}",
|
|
16
|
+
"components/**/*.{ts,tsx,js,jsx}"
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
"// Files and directories to exclude": "",
|
|
20
|
+
"excludePaths": [
|
|
21
|
+
"**/node_modules/**",
|
|
22
|
+
"**/.next/**",
|
|
23
|
+
"**/dist/**",
|
|
24
|
+
"**/build/**",
|
|
25
|
+
"**/coverage/**",
|
|
26
|
+
"**/*.test.{ts,tsx,js,jsx}",
|
|
27
|
+
"**/*.spec.{ts,tsx,js,jsx}",
|
|
28
|
+
"**/__tests__/**",
|
|
29
|
+
"**/vendor/**",
|
|
30
|
+
"**/*.min.js"
|
|
31
|
+
],
|
|
32
|
+
|
|
33
|
+
"// Analyzers": "",
|
|
34
|
+
"// Enable or disable specific analyzers": "",
|
|
35
|
+
"// Available: solid, dry, security, component, data-access": "",
|
|
36
|
+
"enabledAnalyzers": [
|
|
37
|
+
"solid",
|
|
38
|
+
"dry",
|
|
39
|
+
"security",
|
|
40
|
+
"component",
|
|
41
|
+
"data-access"
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
"// Analyzer-specific configuration": "",
|
|
45
|
+
"analyzerConfig": {
|
|
46
|
+
"solid": {
|
|
47
|
+
"// Maximum allowed methods per class": "",
|
|
48
|
+
"maxMethodsPerClass": 10,
|
|
49
|
+
"// Maximum lines per method": "",
|
|
50
|
+
"maxLinesPerMethod": 50,
|
|
51
|
+
"// Maximum parameters per method": "",
|
|
52
|
+
"maxParametersPerMethod": 4,
|
|
53
|
+
"// Maximum cyclomatic complexity": "",
|
|
54
|
+
"maxComplexity": 10,
|
|
55
|
+
"// Which SOLID principles to check": "",
|
|
56
|
+
"checkPatterns": {
|
|
57
|
+
"singleResponsibility": true,
|
|
58
|
+
"openClosed": true,
|
|
59
|
+
"liskovSubstitution": true,
|
|
60
|
+
"interfaceSegregation": true,
|
|
61
|
+
"dependencyInversion": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
"dry": {
|
|
66
|
+
"// Minimum lines to consider as duplication": "",
|
|
67
|
+
"minLineThreshold": 5,
|
|
68
|
+
"// Similarity threshold (0-1)": "",
|
|
69
|
+
"similarityThreshold": 0.85,
|
|
70
|
+
"// Check for duplicate imports": "",
|
|
71
|
+
"checkImports": true,
|
|
72
|
+
"// Check for duplicate string literals": "",
|
|
73
|
+
"checkStrings": true
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
"security": {
|
|
77
|
+
"// Authentication wrapper patterns to look for": "",
|
|
78
|
+
"authPatterns": [
|
|
79
|
+
"withAuth",
|
|
80
|
+
"requireAuth",
|
|
81
|
+
"isAuthenticated",
|
|
82
|
+
"useAuth"
|
|
83
|
+
],
|
|
84
|
+
"// Admin authentication patterns": "",
|
|
85
|
+
"adminPatterns": [
|
|
86
|
+
"withAdminAuth",
|
|
87
|
+
"requireAdmin",
|
|
88
|
+
"isAdmin"
|
|
89
|
+
],
|
|
90
|
+
"// Rate limiting patterns": "",
|
|
91
|
+
"rateLimitPatterns": [
|
|
92
|
+
"rateLimit",
|
|
93
|
+
"withRateLimit",
|
|
94
|
+
"throttle"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
"component": {
|
|
99
|
+
"// Check for error boundaries": "",
|
|
100
|
+
"checkErrorBoundaries": true,
|
|
101
|
+
"// Check for prop type validation": "",
|
|
102
|
+
"checkPropTypes": true,
|
|
103
|
+
"// Maximum component complexity": "",
|
|
104
|
+
"maxComplexity": 15,
|
|
105
|
+
"// Maximum nesting depth": "",
|
|
106
|
+
"maxNesting": 4
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
"data-access": {
|
|
110
|
+
"// Security patterns to look for": "",
|
|
111
|
+
"securityPatterns": {
|
|
112
|
+
"parameterized": ["?", "$1", ":param"],
|
|
113
|
+
"sanitized": ["sanitize", "escape", "clean"]
|
|
114
|
+
},
|
|
115
|
+
"// Performance thresholds": "",
|
|
116
|
+
"performanceThresholds": {
|
|
117
|
+
"maxJoins": 5,
|
|
118
|
+
"warnOnSelectStar": true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
"// Output Configuration": "",
|
|
124
|
+
"// Available formats: html, json, csv": "",
|
|
125
|
+
"outputFormats": ["html", "json"],
|
|
126
|
+
"outputDirectory": "./audit-reports",
|
|
127
|
+
|
|
128
|
+
"// Report Theme (for HTML reports)": "",
|
|
129
|
+
"reportTheme": {
|
|
130
|
+
"primaryColor": "#007bff",
|
|
131
|
+
"criticalColor": "#dc3545",
|
|
132
|
+
"warningColor": "#ffc107",
|
|
133
|
+
"suggestionColor": "#17a2b8"
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
"// Behavior": "",
|
|
137
|
+
"// Minimum severity level to report: critical, warning, suggestion": "",
|
|
138
|
+
"minSeverity": "suggestion",
|
|
139
|
+
"// Exit with error code if critical issues found": "",
|
|
140
|
+
"failOnCritical": false,
|
|
141
|
+
"// Show detailed progress during analysis": "",
|
|
142
|
+
"verbose": false,
|
|
143
|
+
"// Show progress indicators": "",
|
|
144
|
+
"showProgress": true,
|
|
145
|
+
|
|
146
|
+
"// Performance": "",
|
|
147
|
+
"// Run analyzers in parallel": "",
|
|
148
|
+
"parallel": true,
|
|
149
|
+
"// Maximum concurrent operations": "",
|
|
150
|
+
"maxConcurrency": 4,
|
|
151
|
+
|
|
152
|
+
"// Quality Thresholds": "",
|
|
153
|
+
"// Set to undefined to disable threshold": "",
|
|
154
|
+
"thresholds": {
|
|
155
|
+
"// Maximum allowed critical issues": "",
|
|
156
|
+
"maxCritical": 0,
|
|
157
|
+
"// Maximum allowed warnings": "",
|
|
158
|
+
"maxWarnings": 50,
|
|
159
|
+
"// Minimum required health score (0-100)": "",
|
|
160
|
+
"minHealthScore": 80,
|
|
161
|
+
"// Maximum allowed complexity per file": "",
|
|
162
|
+
"maxComplexity": 10,
|
|
163
|
+
"// Maximum allowed code duplication instances": "",
|
|
164
|
+
"maxDuplication": 5
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
"// Custom Patterns": "",
|
|
168
|
+
"// Additional patterns for file discovery": "",
|
|
169
|
+
"customPatterns": {
|
|
170
|
+
"// Component file patterns": "",
|
|
171
|
+
"components": [
|
|
172
|
+
"**/*Component.{ts,tsx,js,jsx}",
|
|
173
|
+
"**/*Page.{ts,tsx,js,jsx}",
|
|
174
|
+
"**/*View.{ts,tsx,js,jsx}"
|
|
175
|
+
],
|
|
176
|
+
"// API endpoint patterns": "",
|
|
177
|
+
"endpoints": [
|
|
178
|
+
"**/api/**/*.{ts,js}",
|
|
179
|
+
"**/routes/**/*.{ts,js}",
|
|
180
|
+
"**/controllers/**/*.{ts,js}"
|
|
181
|
+
],
|
|
182
|
+
"// Test file patterns": "",
|
|
183
|
+
"tests": [
|
|
184
|
+
"**/*.test.{ts,tsx,js,jsx}",
|
|
185
|
+
"**/*.spec.{ts,tsx,js,jsx}",
|
|
186
|
+
"**/__tests__/**"
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
"// CI/CD Integration": "",
|
|
191
|
+
"integrations": {
|
|
192
|
+
"ci": {
|
|
193
|
+
"// CI provider: github, gitlab, jenkins, circleci": "",
|
|
194
|
+
"provider": "github",
|
|
195
|
+
"// Fail the build if thresholds are exceeded": "",
|
|
196
|
+
"failOnThreshold": true,
|
|
197
|
+
"// Comment on pull requests with audit results": "",
|
|
198
|
+
"commentOnPR": true
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projectRoot": ".",
|
|
3
|
+
"reportTitle": "Next.js Project Audit",
|
|
4
|
+
|
|
5
|
+
"includePaths": [
|
|
6
|
+
"app/**/*.{ts,tsx,js,jsx}",
|
|
7
|
+
"pages/**/*.{ts,tsx,js,jsx}",
|
|
8
|
+
"components/**/*.{ts,tsx,js,jsx}",
|
|
9
|
+
"lib/**/*.{ts,tsx,js,jsx}",
|
|
10
|
+
"utils/**/*.{ts,tsx,js,jsx}"
|
|
11
|
+
],
|
|
12
|
+
|
|
13
|
+
"excludePaths": [
|
|
14
|
+
"**/node_modules/**",
|
|
15
|
+
"**/.next/**",
|
|
16
|
+
"**/out/**",
|
|
17
|
+
"**/public/**",
|
|
18
|
+
"**/*.test.{ts,tsx}",
|
|
19
|
+
"**/*.spec.{ts,tsx}",
|
|
20
|
+
"**/__tests__/**",
|
|
21
|
+
"**/coverage/**"
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
"enabledAnalyzers": [
|
|
25
|
+
"component",
|
|
26
|
+
"security",
|
|
27
|
+
"solid",
|
|
28
|
+
"dry",
|
|
29
|
+
"data-access"
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
"analyzerConfig": {
|
|
33
|
+
"component": {
|
|
34
|
+
"checkErrorBoundaries": true,
|
|
35
|
+
"checkPropTypes": false,
|
|
36
|
+
"maxComplexity": 15
|
|
37
|
+
},
|
|
38
|
+
"security": {
|
|
39
|
+
"authPatterns": ["withAuth", "useSession", "getServerSession"],
|
|
40
|
+
"publicPatterns": ["public", "skipAuth"]
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
"customPatterns": {
|
|
45
|
+
"components": [
|
|
46
|
+
"**/app/**/page.{ts,tsx}",
|
|
47
|
+
"**/app/**/layout.{ts,tsx}",
|
|
48
|
+
"**/pages/**/*.{ts,tsx}",
|
|
49
|
+
"**/components/**/*.{ts,tsx}"
|
|
50
|
+
],
|
|
51
|
+
"endpoints": [
|
|
52
|
+
"**/app/api/**/route.{ts,js}",
|
|
53
|
+
"**/pages/api/**/*.{ts,js}"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
"outputFormats": ["html"],
|
|
58
|
+
"outputDirectory": "./audit-reports",
|
|
59
|
+
|
|
60
|
+
"thresholds": {
|
|
61
|
+
"maxCritical": 0,
|
|
62
|
+
"maxWarnings": 20,
|
|
63
|
+
"minHealthScore": 85
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projectRoot": ".",
|
|
3
|
+
"reportTitle": "Node.js API Audit",
|
|
4
|
+
|
|
5
|
+
"includePaths": [
|
|
6
|
+
"src/**/*.{ts,js}",
|
|
7
|
+
"lib/**/*.{ts,js}",
|
|
8
|
+
"api/**/*.{ts,js}",
|
|
9
|
+
"routes/**/*.{ts,js}",
|
|
10
|
+
"controllers/**/*.{ts,js}",
|
|
11
|
+
"services/**/*.{ts,js}",
|
|
12
|
+
"models/**/*.{ts,js}"
|
|
13
|
+
],
|
|
14
|
+
|
|
15
|
+
"excludePaths": [
|
|
16
|
+
"**/node_modules/**",
|
|
17
|
+
"**/dist/**",
|
|
18
|
+
"**/build/**",
|
|
19
|
+
"**/*.test.{ts,js}",
|
|
20
|
+
"**/*.spec.{ts,js}",
|
|
21
|
+
"**/__tests__/**",
|
|
22
|
+
"**/coverage/**"
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
"enabledAnalyzers": [
|
|
26
|
+
"security",
|
|
27
|
+
"data-access",
|
|
28
|
+
"solid",
|
|
29
|
+
"dry"
|
|
30
|
+
],
|
|
31
|
+
|
|
32
|
+
"analyzerConfig": {
|
|
33
|
+
"security": {
|
|
34
|
+
"authPatterns": ["authenticate", "authorize", "requireAuth", "passport"],
|
|
35
|
+
"rateLimitPatterns": ["rateLimit", "throttle", "limiter"],
|
|
36
|
+
"securityHeaders": [
|
|
37
|
+
"helmet",
|
|
38
|
+
"cors",
|
|
39
|
+
"Content-Security-Policy"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"data-access": {
|
|
43
|
+
"databasePatterns": {
|
|
44
|
+
"postgres": ["pg", "postgres"],
|
|
45
|
+
"mysql": ["mysql", "mysql2"],
|
|
46
|
+
"mongodb": ["mongodb", "mongoose"]
|
|
47
|
+
},
|
|
48
|
+
"securityPatterns": {
|
|
49
|
+
"parameterized": ["?", "$1", ":id"],
|
|
50
|
+
"sanitized": ["sanitize", "escape", "validator"]
|
|
51
|
+
},
|
|
52
|
+
"performanceThresholds": {
|
|
53
|
+
"maxJoins": 4,
|
|
54
|
+
"warnOnSelectStar": true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"solid": {
|
|
58
|
+
"maxMethodsPerClass": 12,
|
|
59
|
+
"maxLinesPerMethod": 60,
|
|
60
|
+
"maxParametersPerMethod": 5
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
"outputFormats": ["json", "html"],
|
|
65
|
+
"outputDirectory": "./audit-reports",
|
|
66
|
+
|
|
67
|
+
"minSeverity": "warning",
|
|
68
|
+
"failOnCritical": true,
|
|
69
|
+
|
|
70
|
+
"thresholds": {
|
|
71
|
+
"maxCritical": 0,
|
|
72
|
+
"maxWarnings": 10,
|
|
73
|
+
"minHealthScore": 90
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
"integrations": {
|
|
77
|
+
"ci": {
|
|
78
|
+
"provider": "github",
|
|
79
|
+
"failOnThreshold": true
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|