@aiready/consistency 0.21.8 → 0.21.11
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/.turbo/turbo-build.log +23 -24
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +18 -19
- package/.turbo/turbo-type-check.log +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/index.mjs +3 -3
- package/package.json +2 -2
- package/src/__tests__/provider.test.ts +6 -34
- package/src/index.ts +3 -3
- package/src/provider.ts +2 -2
- package/dist/__tests__/analyzer.test.d.ts +0 -2
- package/dist/__tests__/analyzer.test.d.ts.map +0 -1
- package/dist/__tests__/analyzer.test.js +0 -157
- package/dist/__tests__/analyzer.test.js.map +0 -1
- package/dist/__tests__/language-filter.test.d.ts +0 -2
- package/dist/__tests__/language-filter.test.d.ts.map +0 -1
- package/dist/__tests__/language-filter.test.js +0 -46
- package/dist/__tests__/language-filter.test.js.map +0 -1
- package/dist/__tests__/scoring.test.d.ts +0 -2
- package/dist/__tests__/scoring.test.d.ts.map +0 -1
- package/dist/__tests__/scoring.test.js +0 -118
- package/dist/__tests__/scoring.test.js.map +0 -1
- package/dist/analyzer.d.ts +0 -7
- package/dist/analyzer.d.ts.map +0 -1
- package/dist/analyzer.js +0 -160
- package/dist/analyzer.js.map +0 -1
- package/dist/analyzers/naming-ast.d.ts +0 -7
- package/dist/analyzers/naming-ast.d.ts.map +0 -1
- package/dist/analyzers/naming-ast.js +0 -253
- package/dist/analyzers/naming-ast.js.map +0 -1
- package/dist/analyzers/naming-constants.d.ts +0 -21
- package/dist/analyzers/naming-constants.d.ts.map +0 -1
- package/dist/analyzers/naming-constants.js +0 -96
- package/dist/analyzers/naming-constants.js.map +0 -1
- package/dist/analyzers/naming-python.d.ts +0 -16
- package/dist/analyzers/naming-python.d.ts.map +0 -1
- package/dist/analyzers/naming-python.js +0 -165
- package/dist/analyzers/naming-python.js.map +0 -1
- package/dist/analyzers/naming.d.ts +0 -6
- package/dist/analyzers/naming.d.ts.map +0 -1
- package/dist/analyzers/naming.js +0 -234
- package/dist/analyzers/naming.js.map +0 -1
- package/dist/analyzers/patterns.d.ts +0 -10
- package/dist/analyzers/patterns.d.ts.map +0 -1
- package/dist/analyzers/patterns.js +0 -197
- package/dist/analyzers/patterns.js.map +0 -1
- package/dist/chunk-2BTBNG6X.mjs +0 -814
- package/dist/chunk-3ZB6FFRL.mjs +0 -661
- package/dist/chunk-5UFRGXSB.mjs +0 -783
- package/dist/chunk-66M3TIO7.mjs +0 -837
- package/dist/chunk-6BM5MV3S.mjs +0 -719
- package/dist/chunk-6H3JHDP7.mjs +0 -832
- package/dist/chunk-7PHHJOGC.mjs +0 -1374
- package/dist/chunk-AASFXGUR.mjs +0 -1622
- package/dist/chunk-AR7DIZLP.mjs +0 -827
- package/dist/chunk-BDDMOIU2.mjs +0 -385
- package/dist/chunk-BMILMNKJ.mjs +0 -1633
- package/dist/chunk-BYY6MD5T.mjs +0 -729
- package/dist/chunk-CA4Q5JBK.mjs +0 -1143
- package/dist/chunk-CF4LU7KE.mjs +0 -384
- package/dist/chunk-CJINEUIH.mjs +0 -1369
- package/dist/chunk-CLWNLHDB.mjs +0 -909
- package/dist/chunk-CZUJTDNH.mjs +0 -848
- package/dist/chunk-DNGW3WQK.mjs +0 -810
- package/dist/chunk-DSI3TEO2.mjs +0 -662
- package/dist/chunk-EIQ5K6OO.mjs +0 -1579
- package/dist/chunk-FEJODRK5.mjs +0 -783
- package/dist/chunk-FK56AZ43.mjs +0 -817
- package/dist/chunk-H6S7WKSQ.mjs +0 -729
- package/dist/chunk-HAOJLJNB.mjs +0 -1290
- package/dist/chunk-HJCP36VW.mjs +0 -821
- package/dist/chunk-HPG7P6PD.mjs +0 -1372
- package/dist/chunk-IVRBV7SE.mjs +0 -1295
- package/dist/chunk-IXBC6GVT.mjs +0 -832
- package/dist/chunk-J5IFYDVU.mjs +0 -1579
- package/dist/chunk-KWQVBF7K.mjs +0 -831
- package/dist/chunk-LD3CHHU2.mjs +0 -1297
- package/dist/chunk-LMOXGPCM.mjs +0 -722
- package/dist/chunk-LSXZH6X6.mjs +0 -810
- package/dist/chunk-LUAREV6A.mjs +0 -508
- package/dist/chunk-MAPVFXBP.mjs +0 -708
- package/dist/chunk-MM2PLUCH.mjs +0 -1376
- package/dist/chunk-NPWCJZUG.mjs +0 -708
- package/dist/chunk-ON73WHHU.mjs +0 -1310
- package/dist/chunk-P6NVKUBB.mjs +0 -831
- package/dist/chunk-Q3KTWDSL.mjs +0 -808
- package/dist/chunk-Q5XMWG33.mjs +0 -661
- package/dist/chunk-QOIPVP6P.mjs +0 -1607
- package/dist/chunk-RMEQWG52.mjs +0 -1633
- package/dist/chunk-S6BZVTWN.mjs +0 -731
- package/dist/chunk-TE6JYZD3.mjs +0 -810
- package/dist/chunk-TLVLM3M5.mjs +0 -771
- package/dist/chunk-TXHPUU7A.mjs +0 -863
- package/dist/chunk-UMBBTNQN.mjs +0 -787
- package/dist/chunk-V2UPXL7L.mjs +0 -842
- package/dist/chunk-VODCPPET.mjs +0 -1292
- package/dist/chunk-W6UGMKRV.mjs +0 -1310
- package/dist/chunk-WGH4TGZ3.mjs +0 -1288
- package/dist/chunk-WTBDNCEN.mjs +0 -1352
- package/dist/chunk-XVW5DKJQ.mjs +0 -1619
- package/dist/chunk-YCDCIOJN.mjs +0 -842
- package/dist/chunk-YEHXYHGY.mjs +0 -1497
- package/dist/chunk-YHHXE2JX.mjs +0 -912
- package/dist/chunk-ZB6UK276.mjs +0 -662
- package/dist/chunk-ZG3KFSD3.mjs +0 -1142
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/scoring.d.ts +0 -12
- package/dist/scoring.d.ts.map +0 -1
- package/dist/scoring.js +0 -110
- package/dist/scoring.js.map +0 -1
- package/dist/types.d.ts +0 -53
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/ast-parser.d.ts +0 -46
- package/dist/utils/ast-parser.d.ts.map +0 -1
- package/dist/utils/ast-parser.js +0 -157
- package/dist/utils/ast-parser.js.map +0 -1
- package/dist/utils/config-loader.d.ts +0 -19
- package/dist/utils/config-loader.d.ts.map +0 -1
- package/dist/utils/config-loader.js +0 -31
- package/dist/utils/config-loader.js.map +0 -1
- package/dist/utils/context-detector.d.ts +0 -40
- package/dist/utils/context-detector.d.ts.map +0 -1
- package/dist/utils/context-detector.js +0 -225
- package/dist/utils/context-detector.js.map +0 -1
- package/dist/utils/scope-tracker.d.ts +0 -87
- package/dist/utils/scope-tracker.d.ts.map +0 -1
- package/dist/utils/scope-tracker.js +0 -161
- package/dist/utils/scope-tracker.js.map +0 -1
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants and utilities for naming analysis
|
|
3
|
-
* Extracted from naming.ts and naming-ast.ts to reduce duplication
|
|
4
|
-
*/
|
|
5
|
-
// Common short English words that are NOT abbreviations (full, valid words)
|
|
6
|
-
export const COMMON_SHORT_WORDS = new Set([
|
|
7
|
-
// Full English words (1-3 letters)
|
|
8
|
-
'day', 'key', 'net', 'to', 'go', 'for', 'not', 'new', 'old', 'top', 'end',
|
|
9
|
-
'run', 'try', 'use', 'get', 'set', 'add', 'put', 'map', 'log', 'row', 'col',
|
|
10
|
-
'tab', 'box', 'div', 'nav', 'tag', 'any', 'all', 'one', 'two', 'out', 'off',
|
|
11
|
-
'on', 'yes', 'no', 'now', 'max', 'min', 'sum', 'avg', 'ref', 'src', 'dst',
|
|
12
|
-
'raw', 'def', 'sub', 'pub', 'pre', 'mid', 'alt', 'opt', 'tmp', 'ext', 'sep',
|
|
13
|
-
// Prepositions and conjunctions
|
|
14
|
-
'and', 'from', 'how', 'pad', 'bar', 'non',
|
|
15
|
-
// Additional full words commonly flagged
|
|
16
|
-
'tax', 'cat', 'dog', 'car', 'bus', 'web', 'app', 'war', 'law', 'pay', 'buy',
|
|
17
|
-
'win', 'cut', 'hit', 'hot', 'pop', 'job', 'age', 'act', 'let', 'lot', 'bad',
|
|
18
|
-
'big', 'far', 'few', 'own', 'per', 'red', 'low', 'see', 'six', 'ten', 'way',
|
|
19
|
-
'who', 'why', 'yet', 'via', 'due', 'fee', 'fun', 'gas', 'gay', 'god', 'gun',
|
|
20
|
-
'guy', 'ice', 'ill', 'kid', 'mad', 'man', 'mix', 'mom', 'mrs', 'nor', 'odd',
|
|
21
|
-
'oil', 'pan', 'pet', 'pit', 'pot', 'pow', 'pro', 'raw', 'rep', 'rid', 'sad',
|
|
22
|
-
'sea', 'sit', 'sky', 'son', 'tea', 'tie', 'tip', 'van', 'war', 'win', 'won'
|
|
23
|
-
]);
|
|
24
|
-
// Comprehensive list of acceptable abbreviations and acronyms
|
|
25
|
-
export const ACCEPTABLE_ABBREVIATIONS = new Set([
|
|
26
|
-
// Standard identifiers
|
|
27
|
-
'id', 'uid', 'gid', 'pid',
|
|
28
|
-
// Loop counters and iterators
|
|
29
|
-
'i', 'j', 'k', 'n', 'm',
|
|
30
|
-
// Web/Network
|
|
31
|
-
'url', 'uri', 'api', 'cdn', 'dns', 'ip', 'tcp', 'udp', 'http', 'ssl', 'tls',
|
|
32
|
-
'utm', 'seo', 'rss', 'xhr', 'ajax', 'cors', 'ws', 'wss',
|
|
33
|
-
// Data formats
|
|
34
|
-
'json', 'xml', 'yaml', 'csv', 'html', 'css', 'svg', 'pdf',
|
|
35
|
-
// File types & extensions
|
|
36
|
-
'img', 'txt', 'doc', 'docx', 'xlsx', 'ppt', 'md', 'rst', 'jpg', 'png', 'gif',
|
|
37
|
-
// Databases
|
|
38
|
-
'db', 'sql', 'orm', 'dao', 'dto', 'ddb', 'rds', 'nosql',
|
|
39
|
-
// File system
|
|
40
|
-
'fs', 'dir', 'tmp', 'src', 'dst', 'bin', 'lib', 'pkg',
|
|
41
|
-
// Operating system
|
|
42
|
-
'os', 'env', 'arg', 'cli', 'cmd', 'exe', 'cwd', 'pwd',
|
|
43
|
-
// UI/UX
|
|
44
|
-
'ui', 'ux', 'gui', 'dom', 'ref',
|
|
45
|
-
// Request/Response
|
|
46
|
-
'req', 'res', 'ctx', 'err', 'msg', 'auth',
|
|
47
|
-
// Mathematics/Computing
|
|
48
|
-
'max', 'min', 'avg', 'sum', 'abs', 'cos', 'sin', 'tan', 'log', 'exp',
|
|
49
|
-
'pow', 'sqrt', 'std', 'var', 'int', 'num', 'idx',
|
|
50
|
-
// Time
|
|
51
|
-
'now', 'utc', 'tz', 'ms', 'sec', 'hr', 'min', 'yr', 'mo',
|
|
52
|
-
// Common patterns
|
|
53
|
-
'app', 'cfg', 'config', 'init', 'len', 'val', 'str', 'obj', 'arr',
|
|
54
|
-
'gen', 'def', 'raw', 'new', 'old', 'pre', 'post', 'sub', 'pub',
|
|
55
|
-
// Programming/Framework specific
|
|
56
|
-
'ts', 'js', 'jsx', 'tsx', 'py', 'rb', 'vue', 're', 'fn', 'fns', 'mod', 'opts', 'dev',
|
|
57
|
-
// Cloud/Infrastructure
|
|
58
|
-
's3', 'ec2', 'sqs', 'sns', 'vpc', 'ami', 'iam', 'acl', 'elb', 'alb', 'nlb', 'aws',
|
|
59
|
-
'ses', 'gst', 'cdk', 'btn', 'buf', 'agg', 'ocr', 'ai', 'cf', 'cfn', 'ga',
|
|
60
|
-
// Metrics/Performance
|
|
61
|
-
'fcp', 'lcp', 'cls', 'ttfb', 'tti', 'fid', 'fps', 'qps', 'rps', 'tps', 'wpm',
|
|
62
|
-
// Testing & i18n
|
|
63
|
-
'po', 'e2e', 'a11y', 'i18n', 'l10n', 'spy',
|
|
64
|
-
// Domain-specific abbreviations (context-aware)
|
|
65
|
-
'sk', 'fy', 'faq', 'og', 'seo', 'cta', 'roi', 'kpi', 'ttl', 'pct',
|
|
66
|
-
// Technical abbreviations
|
|
67
|
-
'mac', 'hex', 'esm', 'git', 'rec', 'loc', 'dup',
|
|
68
|
-
// Boolean helpers (these are intentional short names)
|
|
69
|
-
'is', 'has', 'can', 'did', 'was', 'are',
|
|
70
|
-
// Date/Time context (when in date contexts)
|
|
71
|
-
'd', 't', 'dt',
|
|
72
|
-
// Coverage metrics (industry standard: statements/branches/functions/lines)
|
|
73
|
-
's', 'b', 'f', 'l',
|
|
74
|
-
// Common media/content abbreviations
|
|
75
|
-
'vid', 'pic', 'img', 'doc', 'msg'
|
|
76
|
-
]);
|
|
77
|
-
/**
|
|
78
|
-
* Convert snake_case to camelCase
|
|
79
|
-
*/
|
|
80
|
-
export function snakeCaseToCamelCase(str) {
|
|
81
|
-
return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Detect naming convention patterns across the codebase
|
|
85
|
-
*/
|
|
86
|
-
export function detectNamingConventions(files, allIssues) {
|
|
87
|
-
// Count conventions
|
|
88
|
-
const camelCaseCount = allIssues.filter(i => i.type === 'convention-mix').length;
|
|
89
|
-
const totalChecks = files.length * 10; // Rough estimate
|
|
90
|
-
if (camelCaseCount / totalChecks > 0.3) {
|
|
91
|
-
return { dominantConvention: 'mixed', conventionScore: 0.5 };
|
|
92
|
-
}
|
|
93
|
-
// For TypeScript/JavaScript, default to camelCase
|
|
94
|
-
return { dominantConvention: 'camelCase', conventionScore: 0.9 };
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=naming-constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"naming-constants.js","sourceRoot":"","sources":["../../src/analyzers/naming-constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACxC,mCAAmC;IACnC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE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AAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC,MAAM,CAAC;IACjF,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,iBAAiB;IAExD,IAAI,cAAc,GAAG,WAAW,GAAG,GAAG,EAAE,CAAC;QACvC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC;IAC/D,CAAC;IAED,kDAAkD;IAClD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC;AACnE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Python Naming Analyzer - PEP 8 Compliant
|
|
3
|
-
*
|
|
4
|
-
* Analyzes Python code for PEP 8 naming convention violations
|
|
5
|
-
* https://peps.python.org/pep-0008/#naming-conventions
|
|
6
|
-
*/
|
|
7
|
-
import type { NamingIssue } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* Analyze Python files for PEP 8 naming violations
|
|
10
|
-
*/
|
|
11
|
-
export declare function analyzePythonNaming(files: string[]): Promise<NamingIssue[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Detect common Python anti-patterns in naming
|
|
14
|
-
*/
|
|
15
|
-
export declare function detectPythonNamingAntiPatterns(files: string[]): NamingIssue[];
|
|
16
|
-
//# sourceMappingURL=naming-python.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"naming-python.d.ts","sourceRoot":"","sources":["../../src/analyzers/naming-python.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CA2CjF;AAgHD;;GAEG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAW7E"}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Python Naming Analyzer - PEP 8 Compliant
|
|
3
|
-
*
|
|
4
|
-
* Analyzes Python code for PEP 8 naming convention violations
|
|
5
|
-
* https://peps.python.org/pep-0008/#naming-conventions
|
|
6
|
-
*/
|
|
7
|
-
import { getParser } from '@aiready/core';
|
|
8
|
-
/**
|
|
9
|
-
* Analyze Python files for PEP 8 naming violations
|
|
10
|
-
*/
|
|
11
|
-
export async function analyzePythonNaming(files) {
|
|
12
|
-
const issues = [];
|
|
13
|
-
const parser = getParser('dummy.py'); // Get Python parser instance
|
|
14
|
-
if (!parser) {
|
|
15
|
-
console.warn('Python parser not available');
|
|
16
|
-
return issues;
|
|
17
|
-
}
|
|
18
|
-
// Filter to only Python files
|
|
19
|
-
const pythonFiles = files.filter(f => f.toLowerCase().endsWith('.py'));
|
|
20
|
-
for (const file of pythonFiles) {
|
|
21
|
-
try {
|
|
22
|
-
const fs = await import('fs');
|
|
23
|
-
const code = await fs.promises.readFile(file, 'utf-8');
|
|
24
|
-
const result = parser.parse(code, file);
|
|
25
|
-
// Analyze each export for naming violations
|
|
26
|
-
for (const exp of result.exports) {
|
|
27
|
-
const nameIssue = checkPythonNaming(exp.name, exp.type, file, exp.loc?.start.line || 0);
|
|
28
|
-
if (nameIssue) {
|
|
29
|
-
issues.push(nameIssue);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// Analyze imports for naming issues (optional, less critical)
|
|
33
|
-
for (const imp of result.imports) {
|
|
34
|
-
for (const spec of imp.specifiers) {
|
|
35
|
-
if (spec !== '*' && spec !== 'default') {
|
|
36
|
-
const nameIssue = checkPythonNaming(spec, 'variable', file, imp.loc?.start.line || 0);
|
|
37
|
-
if (nameIssue) {
|
|
38
|
-
issues.push(nameIssue);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
console.warn(`Skipping ${file} due to error:`, error);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return issues;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Check a Python identifier against PEP 8 conventions
|
|
52
|
-
*/
|
|
53
|
-
function checkPythonNaming(identifier, type, file, line) {
|
|
54
|
-
// Get naming conventions from parser
|
|
55
|
-
const parser = getParser('dummy.py');
|
|
56
|
-
const conventions = parser?.getNamingConventions();
|
|
57
|
-
if (!conventions)
|
|
58
|
-
return null;
|
|
59
|
-
// Skip special methods and exceptions
|
|
60
|
-
if (conventions.exceptions?.includes(identifier)) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
// Check based on type
|
|
64
|
-
if (type === 'class') {
|
|
65
|
-
// Classes should be PascalCase
|
|
66
|
-
if (!conventions.classPattern.test(identifier)) {
|
|
67
|
-
return {
|
|
68
|
-
type: 'poor-naming',
|
|
69
|
-
identifier,
|
|
70
|
-
file,
|
|
71
|
-
line,
|
|
72
|
-
column: 0,
|
|
73
|
-
severity: 'major',
|
|
74
|
-
category: 'naming',
|
|
75
|
-
suggestion: `Class names should use PascalCase (e.g., ${toPascalCase(identifier)})`,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else if (type === 'function') {
|
|
80
|
-
// Functions should be snake_case
|
|
81
|
-
if (!conventions.functionPattern.test(identifier)) {
|
|
82
|
-
// Check if it's incorrectly using camelCase
|
|
83
|
-
if (/^[a-z][a-zA-Z0-9]*$/.test(identifier) && /[A-Z]/.test(identifier)) {
|
|
84
|
-
return {
|
|
85
|
-
type: 'convention-mix',
|
|
86
|
-
identifier,
|
|
87
|
-
file,
|
|
88
|
-
line,
|
|
89
|
-
column: 0,
|
|
90
|
-
severity: 'major',
|
|
91
|
-
category: 'naming',
|
|
92
|
-
suggestion: `Function names should use snake_case, not camelCase (e.g., ${toSnakeCase(identifier)})`,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else if (type === 'const' || type === 'variable') {
|
|
98
|
-
// Check if it looks like a constant (all uppercase)
|
|
99
|
-
if (identifier === identifier.toUpperCase() && identifier.length > 1) {
|
|
100
|
-
// Constants should be UPPER_CASE_WITH_UNDERSCORES
|
|
101
|
-
if (!conventions.constantPattern.test(identifier)) {
|
|
102
|
-
return {
|
|
103
|
-
type: 'poor-naming',
|
|
104
|
-
identifier,
|
|
105
|
-
file,
|
|
106
|
-
line,
|
|
107
|
-
column: 0,
|
|
108
|
-
severity: 'minor',
|
|
109
|
-
category: 'naming',
|
|
110
|
-
suggestion: 'Constants should use UPPER_CASE_WITH_UNDERSCORES',
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
// Regular variables should be snake_case
|
|
116
|
-
if (!conventions.variablePattern.test(identifier)) {
|
|
117
|
-
// Check if it's using camelCase (common mistake from JS/TS developers)
|
|
118
|
-
if (/^[a-z][a-zA-Z0-9]*$/.test(identifier) && /[A-Z]/.test(identifier)) {
|
|
119
|
-
return {
|
|
120
|
-
type: 'convention-mix',
|
|
121
|
-
identifier,
|
|
122
|
-
file,
|
|
123
|
-
line,
|
|
124
|
-
column: 0,
|
|
125
|
-
severity: 'major',
|
|
126
|
-
category: 'naming',
|
|
127
|
-
suggestion: `Variable names should use snake_case, not camelCase (e.g., ${toSnakeCase(identifier)})`,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Convert camelCase to snake_case
|
|
137
|
-
*/
|
|
138
|
-
function toSnakeCase(str) {
|
|
139
|
-
return str
|
|
140
|
-
.replace(/([A-Z])/g, '_$1')
|
|
141
|
-
.toLowerCase()
|
|
142
|
-
.replace(/^_/, '');
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Convert snake_case to PascalCase
|
|
146
|
-
*/
|
|
147
|
-
function toPascalCase(str) {
|
|
148
|
-
return str
|
|
149
|
-
.split('_')
|
|
150
|
-
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
151
|
-
.join('');
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Detect common Python anti-patterns in naming
|
|
155
|
-
*/
|
|
156
|
-
export function detectPythonNamingAntiPatterns(files) {
|
|
157
|
-
const issues = [];
|
|
158
|
-
// Anti-pattern 1: Using camelCase in Python (common for JS/TS developers)
|
|
159
|
-
// Anti-pattern 2: Using PascalCase for functions
|
|
160
|
-
// Anti-pattern 3: Not using leading underscore for private methods
|
|
161
|
-
// Anti-pattern 4: Using single letter names outside of comprehensions
|
|
162
|
-
// These will be implemented as we refine the analyzer
|
|
163
|
-
return issues;
|
|
164
|
-
}
|
|
165
|
-
//# sourceMappingURL=naming-python.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"naming-python.js","sourceRoot":"","sources":["../../src/analyzers/naming-python.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAY,MAAM,eAAe,CAAC;AAGpD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAAe;IACvD,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,6BAA6B;IAEnE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,8BAA8B;IAC9B,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC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P,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC;SAC1B,WAAW,EAAE;SACb,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACvE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAAe;IAC5D,MAAM,MAAM,GAAkB,EAAE,CAAC;IAEjC,0EAA0E;IAC1E,iDAAiD;IACjD,mEAAmE;IACnE,sEAAsE;IAEtE,sDAAsD;IAEtD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../src/analyzers/naming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQ5C;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAa3E"}
|
package/dist/analyzers/naming.js
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { readFileContent } from '@aiready/core';
|
|
2
|
-
import { COMMON_SHORT_WORDS, ACCEPTABLE_ABBREVIATIONS, snakeCaseToCamelCase, } from './naming-constants';
|
|
3
|
-
import { loadNamingConfig } from '../utils/config-loader';
|
|
4
|
-
/**
|
|
5
|
-
* Analyzes naming conventions and quality
|
|
6
|
-
*/
|
|
7
|
-
export async function analyzeNaming(files) {
|
|
8
|
-
const issues = [];
|
|
9
|
-
// Load and merge configuration
|
|
10
|
-
const { customAbbreviations, customShortWords, disabledChecks } = await loadNamingConfig(files);
|
|
11
|
-
for (const file of files) {
|
|
12
|
-
const content = await readFileContent(file);
|
|
13
|
-
const fileIssues = analyzeFileNaming(file, content, customAbbreviations, customShortWords, disabledChecks);
|
|
14
|
-
issues.push(...fileIssues);
|
|
15
|
-
}
|
|
16
|
-
return issues;
|
|
17
|
-
}
|
|
18
|
-
function analyzeFileNaming(file, content, customAbbreviations, customShortWords, disabledChecks) {
|
|
19
|
-
const issues = [];
|
|
20
|
-
// Check if this is a test file (more lenient rules)
|
|
21
|
-
const isTestFile = file.match(/\.(test|spec)\.(ts|tsx|js|jsx)$/);
|
|
22
|
-
// Split into lines for line number tracking
|
|
23
|
-
const lines = content.split('\n');
|
|
24
|
-
// Merge custom sets with defaults
|
|
25
|
-
const allAbbreviations = new Set([...ACCEPTABLE_ABBREVIATIONS, ...customAbbreviations]);
|
|
26
|
-
const allShortWords = new Set([...COMMON_SHORT_WORDS, ...customShortWords]);
|
|
27
|
-
/**
|
|
28
|
-
* Helper: Get context window around a line (for multi-line pattern detection)
|
|
29
|
-
*/
|
|
30
|
-
const getContextWindow = (index, windowSize = 3) => {
|
|
31
|
-
const start = Math.max(0, index - windowSize);
|
|
32
|
-
const end = Math.min(lines.length, index + windowSize + 1);
|
|
33
|
-
return lines.slice(start, end).join('\n');
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Helper: Check if a variable is short-lived (used only within 3-5 lines)
|
|
37
|
-
*/
|
|
38
|
-
const isShortLivedVariable = (varName, declarationIndex) => {
|
|
39
|
-
const searchRange = 5; // Check 5 lines after declaration
|
|
40
|
-
const endIndex = Math.min(lines.length, declarationIndex + searchRange + 1);
|
|
41
|
-
let usageCount = 0;
|
|
42
|
-
for (let i = declarationIndex; i < endIndex; i++) {
|
|
43
|
-
// Match variable name as whole word
|
|
44
|
-
const regex = new RegExp(`\\b${varName}\\b`, 'g');
|
|
45
|
-
const matches = lines[i].match(regex);
|
|
46
|
-
if (matches) {
|
|
47
|
-
usageCount += matches.length;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// If variable is only used 2-3 times within 5 lines, it's short-lived
|
|
51
|
-
// (1 = declaration, 1-2 = actual usage)
|
|
52
|
-
return usageCount >= 2 && usageCount <= 3;
|
|
53
|
-
};
|
|
54
|
-
// Check for naming patterns
|
|
55
|
-
lines.forEach((line, index) => {
|
|
56
|
-
const lineNumber = index + 1;
|
|
57
|
-
const contextWindow = getContextWindow(index);
|
|
58
|
-
// Check for single letter variables (except i, j, k, l in loops/common contexts)
|
|
59
|
-
if (!disabledChecks.has('single-letter')) {
|
|
60
|
-
const singleLetterMatches = line.matchAll(/\b(?:const|let|var)\s+([a-hm-z])\s*=/gi);
|
|
61
|
-
for (const match of singleLetterMatches) {
|
|
62
|
-
const letter = match[1].toLowerCase();
|
|
63
|
-
// Coverage metrics context (s/b/f/l are standard for statements/branches/functions/lines)
|
|
64
|
-
const isCoverageContext = /coverage|summary|metrics|pct|percent/i.test(line) ||
|
|
65
|
-
/\.(?:statements|branches|functions|lines)\.pct/i.test(line);
|
|
66
|
-
if (isCoverageContext && ['s', 'b', 'f', 'l'].includes(letter)) {
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
// Enhanced loop/iterator context detection
|
|
70
|
-
const isInLoopContext = line.includes('for') ||
|
|
71
|
-
/\.(map|filter|forEach|reduce|find|some|every)\s*\(/.test(line) ||
|
|
72
|
-
line.includes('=>') || // Arrow function
|
|
73
|
-
/\w+\s*=>\s*/.test(line); // Callback pattern
|
|
74
|
-
// Check for i18n/translation context
|
|
75
|
-
const isI18nContext = line.includes('useTranslation') ||
|
|
76
|
-
line.includes('i18n.t') ||
|
|
77
|
-
/\bt\s*\(['"]/.test(line); // t('key') pattern
|
|
78
|
-
// Check for arrow function parameter (improved detection with context window)
|
|
79
|
-
const isArrowFunctionParam = /\(\s*[a-z]\s*(?:,\s*[a-z]\s*)*\)\s*=>/.test(line) || // (s) => or (a, b) =>
|
|
80
|
-
/[a-z]\s*=>/.test(line) || // s => on same line
|
|
81
|
-
// Multi-line arrow function detection: look for pattern in context window
|
|
82
|
-
new RegExp(`\\b${letter}\\s*\\)\\s*$`).test(line) && /=>/.test(contextWindow) || // (s)\n =>
|
|
83
|
-
new RegExp(`\\.(?:map|filter|forEach|reduce|find|some|every)\\s*\\(\\s*$`).test(lines[index - 1] || '') && /=>/.test(contextWindow); // .map(\n s =>
|
|
84
|
-
// Check if variable is short-lived (comparison/temporary contexts)
|
|
85
|
-
const isShortLived = isShortLivedVariable(letter, index);
|
|
86
|
-
if (!isInLoopContext && !isI18nContext && !isArrowFunctionParam && !isShortLived && !['x', 'y', 'z', 'i', 'j', 'k', 'l', 'n', 'm'].includes(letter)) {
|
|
87
|
-
// Skip in test files unless it's really unclear
|
|
88
|
-
if (isTestFile && ['a', 'b', 'c', 'd', 'e', 'f', 's'].includes(letter)) {
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
issues.push({
|
|
92
|
-
file,
|
|
93
|
-
line: lineNumber,
|
|
94
|
-
type: 'poor-naming',
|
|
95
|
-
identifier: match[1],
|
|
96
|
-
severity: 'minor',
|
|
97
|
-
suggestion: `Use descriptive variable name instead of single letter '${match[1]}'`
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
// Check for overly abbreviated variables
|
|
103
|
-
if (!disabledChecks.has('abbreviation')) {
|
|
104
|
-
const abbreviationMatches = line.matchAll(/\b(?:const|let|var)\s+([a-z]{1,3})(?=[A-Z]|_|\s*=)/g);
|
|
105
|
-
for (const match of abbreviationMatches) {
|
|
106
|
-
const abbrev = match[1].toLowerCase();
|
|
107
|
-
// Skip if it's a common short English word (full word, not abbreviation)
|
|
108
|
-
if (allShortWords.has(abbrev)) {
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
// Skip acceptable abbreviations (including custom ones)
|
|
112
|
-
if (allAbbreviations.has(abbrev)) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
// Check for arrow function parameter context (with multi-line detection)
|
|
116
|
-
const isArrowFunctionParam = /\(\s*[a-z]\s*(?:,\s*[a-z]\s*)*\)\s*=>/.test(line) || // (s) => or (a, b) =>
|
|
117
|
-
new RegExp(`\\b${abbrev}\\s*=>`).test(line) || // s => on same line
|
|
118
|
-
// Multi-line arrow function: check context window
|
|
119
|
-
(new RegExp(`\\b${abbrev}\\s*\\)\\s*$`).test(line) && /=>/.test(contextWindow)) || // (s)\n =>
|
|
120
|
-
(new RegExp(`\\.(?:map|filter|forEach|reduce|find|some|every)\\s*\\(\\s*$`).test(lines[index - 1] || '') &&
|
|
121
|
-
new RegExp(`^\\s*${abbrev}\\s*=>`).test(line)); // .map(\n s =>
|
|
122
|
-
if (isArrowFunctionParam) {
|
|
123
|
-
continue;
|
|
124
|
-
}
|
|
125
|
-
// For very short names (1-2 letters), check for date/time context
|
|
126
|
-
if (abbrev.length <= 2) {
|
|
127
|
-
const isDateTimeContext = /date|time|day|hour|minute|second|timestamp/i.test(line);
|
|
128
|
-
if (isDateTimeContext && ['d', 't', 'dt'].includes(abbrev)) {
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
// Check for user/auth context
|
|
132
|
-
const isUserContext = /user|auth|account/i.test(line);
|
|
133
|
-
if (isUserContext && abbrev === 'u') {
|
|
134
|
-
continue;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
issues.push({
|
|
138
|
-
file,
|
|
139
|
-
line: lineNumber,
|
|
140
|
-
type: 'abbreviation',
|
|
141
|
-
identifier: match[1],
|
|
142
|
-
severity: 'info',
|
|
143
|
-
suggestion: `Consider using full word instead of abbreviation '${match[1]}'`
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// Check for snake_case vs camelCase mixing in TypeScript/JavaScript
|
|
148
|
-
if (!disabledChecks.has('convention-mix') && file.match(/\.(ts|tsx|js|jsx)$/)) {
|
|
149
|
-
const camelCaseVars = line.match(/\b(?:const|let|var)\s+([a-z][a-zA-Z0-9]*)\s*=/);
|
|
150
|
-
const snakeCaseVars = line.match(/\b(?:const|let|var)\s+([a-z][a-z0-9]*_[a-z0-9_]*)\s*=/);
|
|
151
|
-
if (snakeCaseVars) {
|
|
152
|
-
issues.push({
|
|
153
|
-
file,
|
|
154
|
-
line: lineNumber,
|
|
155
|
-
type: 'convention-mix',
|
|
156
|
-
identifier: snakeCaseVars[1],
|
|
157
|
-
severity: 'minor',
|
|
158
|
-
suggestion: `Use camelCase '${snakeCaseToCamelCase(snakeCaseVars[1])}' instead of snake_case in TypeScript/JavaScript`
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
// Check for unclear boolean names (should start with is/has/should/can)
|
|
163
|
-
if (!disabledChecks.has('unclear')) {
|
|
164
|
-
const booleanMatches = line.matchAll(/\b(?:const|let|var)\s+([a-z][a-zA-Z0-9]*)\s*:\s*boolean/gi);
|
|
165
|
-
for (const match of booleanMatches) {
|
|
166
|
-
const name = match[1];
|
|
167
|
-
if (!name.match(/^(is|has|should|can|will|did)/i)) {
|
|
168
|
-
issues.push({
|
|
169
|
-
file,
|
|
170
|
-
line: lineNumber,
|
|
171
|
-
type: 'unclear',
|
|
172
|
-
identifier: name,
|
|
173
|
-
severity: 'info',
|
|
174
|
-
suggestion: `Boolean variable '${name}' should start with is/has/should/can for clarity`
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// Check for function names that don't indicate action
|
|
180
|
-
if (!disabledChecks.has('unclear')) {
|
|
181
|
-
const functionMatches = line.matchAll(/function\s+([a-z][a-zA-Z0-9]*)/g);
|
|
182
|
-
for (const match of functionMatches) {
|
|
183
|
-
const name = match[1];
|
|
184
|
-
// Skip JavaScript/TypeScript keywords that shouldn't be function names
|
|
185
|
-
const isKeyword = ['for', 'if', 'else', 'while', 'do', 'switch', 'case', 'break', 'continue', 'return', 'throw', 'try', 'catch', 'finally', 'with', 'yield', 'await'].includes(name);
|
|
186
|
-
if (isKeyword) {
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
// Skip common entry point names
|
|
190
|
-
const isEntryPoint = ['main', 'init', 'setup', 'bootstrap'].includes(name);
|
|
191
|
-
if (isEntryPoint) {
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
// Functions should typically start with verbs, but allow:
|
|
195
|
-
// 1. Factory/builder patterns (ends with Factory, Builder, etc.)
|
|
196
|
-
// 2. Descriptive compound names that explain what they return
|
|
197
|
-
// 3. Event handlers (onClick, onSubmit, etc.)
|
|
198
|
-
// 4. Descriptive aggregate/collection patterns
|
|
199
|
-
// 5. Very long descriptive names (>15 chars)
|
|
200
|
-
// 6. Compound words with 3+ capitals
|
|
201
|
-
// 7. Helper/utility functions (common patterns)
|
|
202
|
-
// 8. React hooks (useX pattern)
|
|
203
|
-
const isFactoryPattern = name.match(/(Factory|Builder|Creator|Generator|Provider|Adapter|Mock)$/);
|
|
204
|
-
const isEventHandler = name.match(/^on[A-Z]/);
|
|
205
|
-
const isDescriptiveLong = name.length > 15; // Reduced from 20 to 15
|
|
206
|
-
const isReactHook = name.match(/^use[A-Z]/); // React hooks
|
|
207
|
-
// Check for descriptive patterns
|
|
208
|
-
const isDescriptivePattern = name.match(/^(default|total|count|sum|avg|max|min|initial|current|previous|next)\w+/) ||
|
|
209
|
-
name.match(/\w+(Count|Total|Sum|Average|List|Map|Set|Config|Settings|Options|Props|Data|Info|Details|State|Status|Response|Result)$/);
|
|
210
|
-
// Helper/utility function patterns
|
|
211
|
-
const isHelperPattern = name.match(/^(to|from|with|without|for|as|into)\w+/) || // toMetadata, withLogger, forPath
|
|
212
|
-
name.match(/^\w+(To|From|With|Without|For|As|Into)\w*$/); // metadataTo, pathFrom
|
|
213
|
-
// Common utility names that are descriptive
|
|
214
|
-
const isUtilityName = ['cn', 'proxy', 'sitemap', 'robots', 'gtag'].includes(name);
|
|
215
|
-
// Count capital letters for compound detection
|
|
216
|
-
const capitalCount = (name.match(/[A-Z]/g) || []).length;
|
|
217
|
-
const isCompoundWord = capitalCount >= 3; // daysSinceLastCommit has 4 capitals
|
|
218
|
-
const hasActionVerb = name.match(/^(get|set|is|has|can|should|create|update|delete|fetch|load|save|process|handle|validate|check|find|search|filter|map|reduce|make|do|run|start|stop|build|parse|format|render|calculate|compute|generate|transform|convert|normalize|sanitize|encode|decode|compress|extract|merge|split|join|sort|compare|test|verify|ensure|apply|execute|invoke|call|emit|dispatch|trigger|listen|subscribe|unsubscribe|add|remove|clear|reset|toggle|enable|disable|open|close|connect|disconnect|send|receive|read|write|import|export|register|unregister|mount|unmount|track|store|persist|upsert|derive|classify|combine|discover|activate|require|assert|expect|mask|escape|sign|put|list|complete|page|safe|mock|pick|pluralize|text)/);
|
|
219
|
-
if (!hasActionVerb && !isFactoryPattern && !isEventHandler && !isDescriptiveLong && !isDescriptivePattern && !isCompoundWord && !isHelperPattern && !isUtilityName && !isReactHook) {
|
|
220
|
-
issues.push({
|
|
221
|
-
file,
|
|
222
|
-
line: lineNumber,
|
|
223
|
-
type: 'unclear',
|
|
224
|
-
identifier: name,
|
|
225
|
-
severity: 'info',
|
|
226
|
-
suggestion: `Function '${name}' should start with an action verb (get, set, create, etc.)`
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
return issues;
|
|
233
|
-
}
|
|
234
|
-
//# sourceMappingURL=naming.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"naming.js","sourceRoot":"","sources":["../../src/analyzers/naming.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,E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CAAC;oBACnL,MAAM,CAAC,IAAI,CAAC;wBACV,IAAI;wBACJ,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,SAAS;wBACf,UAAU,EAAE,IAAI;wBAChB,QAAQ,EAAE,MAAM;wBAChB,UAAU,EAAE,aAAa,IAAI,6DAA6D;qBAC3F,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PatternIssue } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Analyzes code pattern consistency
|
|
4
|
-
*/
|
|
5
|
-
export declare function analyzePatterns(files: string[]): Promise<PatternIssue[]>;
|
|
6
|
-
/**
|
|
7
|
-
* Analyzes API design consistency
|
|
8
|
-
*/
|
|
9
|
-
export declare function analyzeAPIDesign(files: string[]): Promise<PatternIssue[]>;
|
|
10
|
-
//# sourceMappingURL=patterns.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/analyzers/patterns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAgB9E;AAkMD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAO/E"}
|