@iris-code/core 0.1.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.
Files changed (94) hide show
  1. package/README.md +38 -0
  2. package/dist/config.d.ts +147 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +550 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/csharp/analyser.d.ts +14 -0
  7. package/dist/csharp/analyser.d.ts.map +1 -0
  8. package/dist/csharp/analyser.js +436 -0
  9. package/dist/csharp/analyser.js.map +1 -0
  10. package/dist/csharp/lexer.d.ts +29 -0
  11. package/dist/csharp/lexer.d.ts.map +1 -0
  12. package/dist/csharp/lexer.js +182 -0
  13. package/dist/csharp/lexer.js.map +1 -0
  14. package/dist/duplicates.d.ts +53 -0
  15. package/dist/duplicates.d.ts.map +1 -0
  16. package/dist/duplicates.js +491 -0
  17. package/dist/duplicates.js.map +1 -0
  18. package/dist/fileAnalyser.d.ts +4 -0
  19. package/dist/fileAnalyser.d.ts.map +1 -0
  20. package/dist/fileAnalyser.js +8 -0
  21. package/dist/fileAnalyser.js.map +1 -0
  22. package/dist/fileNaming.d.ts +68 -0
  23. package/dist/fileNaming.d.ts.map +1 -0
  24. package/dist/fileNaming.js +343 -0
  25. package/dist/fileNaming.js.map +1 -0
  26. package/dist/gate.d.ts +49 -0
  27. package/dist/gate.d.ts.map +1 -0
  28. package/dist/gate.js +242 -0
  29. package/dist/gate.js.map +1 -0
  30. package/dist/go/analyser.d.ts +5 -0
  31. package/dist/go/analyser.d.ts.map +1 -0
  32. package/dist/go/analyser.js +576 -0
  33. package/dist/go/analyser.js.map +1 -0
  34. package/dist/guards.d.ts +16 -0
  35. package/dist/guards.d.ts.map +1 -0
  36. package/dist/guards.js +355 -0
  37. package/dist/guards.js.map +1 -0
  38. package/dist/index.d.ts +22 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +110 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/languages.d.ts +46 -0
  43. package/dist/languages.d.ts.map +1 -0
  44. package/dist/languages.js +155 -0
  45. package/dist/languages.js.map +1 -0
  46. package/dist/lines.d.ts +9 -0
  47. package/dist/lines.d.ts.map +1 -0
  48. package/dist/lines.js +58 -0
  49. package/dist/lines.js.map +1 -0
  50. package/dist/python/analyser.d.ts +5 -0
  51. package/dist/python/analyser.d.ts.map +1 -0
  52. package/dist/python/analyser.js +630 -0
  53. package/dist/python/analyser.js.map +1 -0
  54. package/dist/qualitySignals.d.ts +30 -0
  55. package/dist/qualitySignals.d.ts.map +1 -0
  56. package/dist/qualitySignals.js +101 -0
  57. package/dist/qualitySignals.js.map +1 -0
  58. package/dist/ruby/analyser.d.ts +5 -0
  59. package/dist/ruby/analyser.d.ts.map +1 -0
  60. package/dist/ruby/analyser.js +450 -0
  61. package/dist/ruby/analyser.js.map +1 -0
  62. package/dist/scoring.d.ts +4 -0
  63. package/dist/scoring.d.ts.map +1 -0
  64. package/dist/scoring.js +37 -0
  65. package/dist/scoring.js.map +1 -0
  66. package/dist/secrets.d.ts +5 -0
  67. package/dist/secrets.d.ts.map +1 -0
  68. package/dist/secrets.js +245 -0
  69. package/dist/secrets.js.map +1 -0
  70. package/dist/securityContext.d.ts +2 -0
  71. package/dist/securityContext.d.ts.map +1 -0
  72. package/dist/securityContext.js +16 -0
  73. package/dist/securityContext.js.map +1 -0
  74. package/dist/sfc.d.ts +32 -0
  75. package/dist/sfc.d.ts.map +1 -0
  76. package/dist/sfc.js +228 -0
  77. package/dist/sfc.js.map +1 -0
  78. package/dist/slop.d.ts +37 -0
  79. package/dist/slop.d.ts.map +1 -0
  80. package/dist/slop.js +81 -0
  81. package/dist/slop.js.map +1 -0
  82. package/dist/suppressions.d.ts +19 -0
  83. package/dist/suppressions.d.ts.map +1 -0
  84. package/dist/suppressions.js +152 -0
  85. package/dist/suppressions.js.map +1 -0
  86. package/dist/ts/analyser.d.ts +4 -0
  87. package/dist/ts/analyser.d.ts.map +1 -0
  88. package/dist/ts/analyser.js +769 -0
  89. package/dist/ts/analyser.js.map +1 -0
  90. package/dist/types.d.ts +139 -0
  91. package/dist/types.d.ts.map +1 -0
  92. package/dist/types.js +46 -0
  93. package/dist/types.js.map +1 -0
  94. package/package.json +43 -0
@@ -0,0 +1,436 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractCSharpThirdPartyImports = extractCSharpThirdPartyImports;
4
+ exports.analyseCSharp = analyseCSharp;
5
+ const guards_1 = require("../guards");
6
+ const lines_1 = require("../lines");
7
+ const scoring_1 = require("../scoring");
8
+ const secrets_1 = require("../secrets");
9
+ const securityContext_1 = require("../securityContext");
10
+ const lexer_1 = require("./lexer");
11
+ const ZEROED_TS_METRICS = {
12
+ anyUsages: [], tsIgnoreCount: 0, tsExpectErrorCount: 0,
13
+ nonNullAssertions: 0, typeAssertions: 0, missingReturnTypes: 0,
14
+ };
15
+ // FrameworkReference entries that name the .NET runtime itself. They are not
16
+ // third-party dependencies, so counting them would inflate every web project.
17
+ const DOTNET_FRAMEWORK_REFERENCES = new Set([
18
+ 'microsoft.netcore.app', 'microsoft.aspnetcore.app', 'microsoft.windowsdesktop.app',
19
+ ]);
20
+ function splitParameters(value) {
21
+ const params = [];
22
+ let current = '';
23
+ let depth = 0;
24
+ let genericDepth = 0;
25
+ for (const ch of value) {
26
+ if (ch === ',' && depth === 0 && genericDepth === 0) {
27
+ if (current.trim())
28
+ params.push(current.trim());
29
+ current = '';
30
+ continue;
31
+ }
32
+ current += ch;
33
+ if ('([{'.includes(ch))
34
+ depth++;
35
+ else if (')]}'.includes(ch))
36
+ depth = Math.max(0, depth - 1);
37
+ else if (ch === '<')
38
+ genericDepth++;
39
+ else if (ch === '>')
40
+ genericDepth = Math.max(0, genericDepth - 1);
41
+ }
42
+ if (current.trim())
43
+ params.push(current.trim());
44
+ // `this` marks an extension method's receiver, not a caller-supplied argument.
45
+ return params.filter(param => param && !/^this\b/.test(param));
46
+ }
47
+ function findBlockEnd(lines, startIndex) {
48
+ let depth = 0;
49
+ let foundOpen = false;
50
+ for (let i = startIndex; i < lines.length; i++) {
51
+ for (const ch of lines[i]) {
52
+ if (ch === '{') {
53
+ depth++;
54
+ foundOpen = true;
55
+ }
56
+ else if (ch === '}' && foundOpen) {
57
+ depth--;
58
+ if (depth === 0)
59
+ return i + 1;
60
+ }
61
+ }
62
+ }
63
+ return foundOpen ? lines.length : startIndex + 1;
64
+ }
65
+ // Control-flow and operator keywords that read like a call site. Belt and
66
+ // braces: the signature pattern needs a type token before the name, which
67
+ // already rejects a bare `if (`, but `checked (x) {` and friends do not.
68
+ const NON_METHOD_NAMES = new Set([
69
+ 'if', 'for', 'foreach', 'while', 'switch', 'catch', 'using', 'lock', 'fixed',
70
+ 'when', 'do', 'try', 'checked', 'unchecked', 'nameof', 'sizeof', 'typeof',
71
+ 'default', 'return', 'yield', 'throw', 'await', 'get', 'set', 'init', 'add', 'remove',
72
+ ]);
73
+ // A type declaration is not a method, and `new Foo(...) { ... }` is object
74
+ // creation. Both otherwise reach the signature pattern with the type name in
75
+ // the method-name slot - a positional `record Order(...)` was being counted as
76
+ // both a class and a method until this check landed.
77
+ const DECLARATION_PREFIX_RE = /\b(?:class|record|struct|interface|enum|namespace|delegate|event|new)\s+$/;
78
+ // The signature may start at a line start OR straight after a brace or a
79
+ // semicolon on the same line: `class C { public void M() { } }` is one line of
80
+ // legal C#, and anchoring to `^` alone reported it as a class with no methods at
81
+ // all - so function-too-long, parameter counts and nesting depth could never see
82
+ // it. All three boundary characters are needed to walk a chain of members on one
83
+ // line, because the match consumes its boundary: `{` opens the first member, `}`
84
+ // closes the previous block-bodied one, `;` ends the previous expression-bodied
85
+ // one. They are safe because the pattern still demands a return-type token, a
86
+ // name, a parameter list and a body opener, which no statement, object
87
+ // initialiser, property accessor, lambda body, switch pattern or `catch`/`while`
88
+ // clause satisfies. The boundary cannot cross a line: `[^\S\n]` excludes the
89
+ // newline, so a match is always attributed to its own line.
90
+ const SIGNATURE_RE = /(?:^|[{};])[^\S\n]*(?:(?:public|private|protected|internal|static|virtual|override|sealed|abstract|async|extern|unsafe|partial|readonly|required|new)[^\S\n]+)*(?:[\w<>[\],.?]+[^\S\n]+)+([A-Z_a-z]\w*)[^\S\n]*(?:<[^<>()]*>)?[^\S\n]*\(([^()]*)\)\s*(?::\s*(?:base|this)\s*\([^()]*\)\s*)?(?:where\b[^{;]+)?(?:\{|=>)/gm;
91
+ function detectCSharpFunctions(source) {
92
+ const code = (0, lexer_1.csharpCodeOnly)(source);
93
+ const lines = code.split('\n');
94
+ const functions = [];
95
+ const seen = new Set();
96
+ SIGNATURE_RE.lastIndex = 0;
97
+ let match;
98
+ while ((match = SIGNATURE_RE.exec(code)) !== null) {
99
+ const name = match[1];
100
+ if (NON_METHOD_NAMES.has(name))
101
+ continue;
102
+ const prefix = match[0].slice(0, match[0].indexOf(name));
103
+ if (DECLARATION_PREFIX_RE.test(prefix))
104
+ continue;
105
+ const line = (0, lines_1.lineOf)(code, match.index);
106
+ const key = `${name}:${line}`;
107
+ if (seen.has(key))
108
+ continue;
109
+ seen.add(key);
110
+ functions.push({
111
+ name,
112
+ line,
113
+ endLine: match[0].trimEnd().endsWith('=>') ? line : findBlockEnd(lines, line - 1),
114
+ params: splitParameters(match[2] ?? ''),
115
+ });
116
+ }
117
+ return functions.sort((a, b) => a.line - b.line);
118
+ }
119
+ function detectCSharpClasses(source) {
120
+ const code = (0, lexer_1.csharpCodeOnly)(source);
121
+ const lines = code.split('\n');
122
+ const classes = [];
123
+ const classRe = /^[^\S\n]*(?:(?:public|private|protected|internal|static|abstract|sealed|partial|readonly|ref)[^\S\n]+)*(?:class|record|struct)[^\S\n]+([A-Z_a-z]\w*)[^{;]*\{/gm;
124
+ let match;
125
+ while ((match = classRe.exec(code)) !== null) {
126
+ const line = (0, lines_1.lineOf)(code, match.index);
127
+ classes.push({ name: match[1], line, endLine: findBlockEnd(lines, line - 1) });
128
+ }
129
+ return classes;
130
+ }
131
+ /**
132
+ * `.csproj` reports its PackageReference/FrameworkReference entries: the
133
+ * project file is the authoritative dependency list, the way a Gemfile is.
134
+ *
135
+ * A `.cs` file reports the namespaces it imports, excluding `System.*` (the
136
+ * base class library, present in every file and never a dependency signal).
137
+ * `Microsoft.*` IS counted: EF Core, ASP.NET, Extensions and the Azure SDK all
138
+ * live there and are as much a third-party dependency as anything on NuGet.
139
+ */
140
+ function extractCSharpThirdPartyImports(source, filePath = '') {
141
+ const imports = new Set();
142
+ const lower = filePath.toLowerCase();
143
+ if (lower.endsWith('.csproj')) {
144
+ const packageRe = /<PackageReference\b[^>]*\bInclude\s*=\s*["']([^"']+)["']/gi;
145
+ let match;
146
+ while ((match = packageRe.exec(source)) !== null)
147
+ imports.add(match[1]);
148
+ const frameworkRe = /<FrameworkReference\b[^>]*\bInclude\s*=\s*["']([^"']+)["']/gi;
149
+ while ((match = frameworkRe.exec(source)) !== null) {
150
+ const name = match[1].toLowerCase();
151
+ if (!DOTNET_FRAMEWORK_REFERENCES.has(name))
152
+ imports.add(match[1]);
153
+ }
154
+ return [...imports].sort();
155
+ }
156
+ const code = (0, lexer_1.stripCSharpComments)(source);
157
+ // `global using`, `using static`, and `using Alias = Namespace;` all count.
158
+ // `using var x = ...;` and `using (...)` are statements, not directives, and
159
+ // are excluded by requiring the terminating semicolon directly after a
160
+ // dotted name.
161
+ const usingRe = /^[^\S\n]*(?:global[^\S\n]+)?using[^\S\n]+(?:static[^\S\n]+)?(?:[A-Za-z_]\w*[^\S\n]*=[^\S\n]*)?([A-Za-z_][\w.]*)[^\S\n]*;/gm;
162
+ let match;
163
+ while ((match = usingRe.exec(code)) !== null) {
164
+ const namespaceName = match[1];
165
+ if (namespaceName === 'System' || namespaceName.startsWith('System.'))
166
+ continue;
167
+ imports.add(namespaceName);
168
+ }
169
+ return [...imports].sort();
170
+ }
171
+ // Lines that legitimately carry a literal number in C#: an attribute
172
+ // ([MaxLength(200)], [Range(1, 100)]), a preprocessor directive, a const or
173
+ // readonly declaration, or an enum member with an explicit value. Each of those
174
+ // IS the name for its number, which is what the rule asks for.
175
+ const MAGIC_NUMBER_EXEMPT_RE = /^\s*[[#]|^\s*(?:(?:public|private|protected|internal|static|readonly|volatile|new|required|const)\s+)*(?:const|readonly)\s|^\s*[A-Z]\w*\s*=\s*[\d_]+\s*,?\s*$/;
176
+ function detectCSharpCodeSmells(source, methods, config, testFile) {
177
+ const lines = source.split('\n');
178
+ const code = (0, lexer_1.csharpCodeOnly)(source);
179
+ const codeLines = code.split('\n');
180
+ const consoleLogs = [];
181
+ if (config.enableConsoleLogWarnings) {
182
+ const logRe = /\b(?:Console|Debug|Trace)\.(?:Write|WriteLine|Print)\s*\(/g;
183
+ let match;
184
+ while ((match = logRe.exec(code)) !== null)
185
+ consoleLogs.push({ line: (0, lines_1.lineOf)(source, match.index) });
186
+ }
187
+ const todos = [];
188
+ if (config.enableTodoDetection)
189
+ lines.forEach((line, index) => {
190
+ const match = /\/\/.*\b(TODO|FIXME|HACK)\b[:\s]*(.*)/.exec(line);
191
+ if (match)
192
+ todos.push({ text: `${match[1]}: ${match[2].trim()}`.trim(), line: index + 1 });
193
+ });
194
+ // Nesting is measured RELATIVE to the method's own opening brace, so Allman
195
+ // style (the C# default, brace on its own line) and K&R style measure the
196
+ // same method identically. Counting raw depth made every Allman method read
197
+ // one level deeper than the same code written K&R.
198
+ let deepNesting = 0;
199
+ for (const method of methods) {
200
+ let depth = 0;
201
+ let maximum = 0;
202
+ let opened = false;
203
+ for (let i = method.line - 1; i < method.endLine; i++) {
204
+ for (const ch of codeLines[i] ?? '') {
205
+ if (ch === '{') {
206
+ depth++;
207
+ opened = true;
208
+ }
209
+ else if (ch === '}' && opened) {
210
+ depth = Math.max(0, depth - 1);
211
+ }
212
+ if (opened)
213
+ maximum = Math.max(maximum, depth - 1);
214
+ }
215
+ }
216
+ if (maximum >= 4)
217
+ deepNesting++;
218
+ }
219
+ const longParameterLists = config.enableLongParamDetection
220
+ ? methods.filter(method => method.params.length >= config.maxParameterCount).map(method => ({ name: method.name, paramCount: method.params.length, line: method.line }))
221
+ : [];
222
+ const magicNumbers = [];
223
+ if (config.enableMagicNumberDetection)
224
+ codeLines.forEach((line, index) => {
225
+ // Attributes ([MaxLength(200)]), preprocessor directives, const/readonly
226
+ // declarations and enum members are all named or declarative uses.
227
+ if (MAGIC_NUMBER_EXEMPT_RE.test(line))
228
+ return;
229
+ const number = /\b(?!0\b|1\b)(\d+(?:\.\d+)?)\b/g;
230
+ let match;
231
+ while ((match = number.exec(line)) !== null)
232
+ magicNumbers.push({ value: match[1], line: index + 1 });
233
+ });
234
+ const evalUsage = [];
235
+ const sqlConcatenation = [];
236
+ const insecureRandom = [];
237
+ const unsafeRegex = [];
238
+ const hardcodedLocalhost = [];
239
+ const disabledTlsVerification = [];
240
+ const debugFlagsEnabled = [];
241
+ const weakHashing = [];
242
+ const openRedirect = [];
243
+ if (config.enableSecuritySmells) {
244
+ const commentsRemoved = (0, lexer_1.stripCSharpComments)(source);
245
+ // Structural checks read the string-blanked source, so the same call
246
+ // written inside a string literal or a doc example is not a finding.
247
+ const evalRe = /\b(?:CSharpScript|CSScript|RoslynCodeDomProvider)\.(?:Evaluate|Eval|Run|CreateScript)\b|\bAssembly\.Load(?:From|File)?\s*\(/g;
248
+ let match;
249
+ while ((match = evalRe.exec(code)) !== null)
250
+ evalUsage.push({ line: (0, lines_1.lineOf)(source, match.index) });
251
+ const sqlRe = /\b(?:SqlCommand|NpgsqlCommand|MySqlCommand|OracleCommand|SqliteCommand)\s*\([^;\n]*(?:\+|\$")|\b(?:FromSqlRaw|ExecuteSqlRaw|ExecuteSqlRawAsync|SqlQuery)\s*\([^;\n]*(?:\+|\$")/g;
252
+ while ((match = sqlRe.exec(commentsRemoved)) !== null)
253
+ sqlConcatenation.push({ line: (0, lines_1.lineOf)(source, match.index) });
254
+ const rngRe = /\bnew\s+Random\s*\(/g;
255
+ while ((match = rngRe.exec(code)) !== null)
256
+ if ((0, securityContext_1.hasSecurityContext)(code, match.index))
257
+ insecureRandom.push({ line: (0, lines_1.lineOf)(source, match.index) });
258
+ // Confined to regex SOURCE (the 5.11 rule): the nested-quantifier
259
+ // heuristic would otherwise match ordinary arithmetic like (a+b)*c.
260
+ const regexRe = /\bRegex\.(?:IsMatch|Match|Matches|Replace|Split)\s*\(\s*[^,()]+,\s*[$@]*"([^"\n]+)"|\bnew\s+Regex\s*\(\s*[$@]*"([^"\n]+)"/g;
261
+ while ((match = regexRe.exec(commentsRemoved)) !== null)
262
+ if (/\([^)]*[+*][^)]*\)[+*]/.test(match[1] ?? match[2] ?? ''))
263
+ unsafeRegex.push({ line: (0, lines_1.lineOf)(source, match.index) });
264
+ if (!testFile) {
265
+ const localRe = /\blocalhost\b|127\.0\.0\.1/g;
266
+ while ((match = localRe.exec(commentsRemoved)) !== null)
267
+ hardcodedLocalhost.push({ line: (0, lines_1.lineOf)(source, match.index) });
268
+ const debugRe = /\bASPNETCORE_ENVIRONMENT\s*=\s*["']Development["']|\bUseDeveloperExceptionPage\s*\(|\bDeveloperExceptionPage\b|\bDEBUG\s*=\s*true\b/g;
269
+ while ((match = debugRe.exec(commentsRemoved)) !== null)
270
+ debugFlagsEnabled.push({ line: (0, lines_1.lineOf)(source, match.index) });
271
+ }
272
+ const tlsRe = /ServerCertificateCustomValidationCallback\s*=\s*[^;\n]*=>\s*true|ServerCertificateCustomValidationCallback\s*=\s*[^;\n]*AlwaysValidate|DangerousAcceptAnyServerCertificateValidator|ServerCertificateValidationCallback\s*(?:\+=|=)\s*[^;\n]*=>\s*true/g;
273
+ while ((match = tlsRe.exec(code)) !== null)
274
+ disabledTlsVerification.push({ line: (0, lines_1.lineOf)(source, match.index) });
275
+ const hashRe = /\b(?:MD5|SHA1)\.(?:Create|HashData|ComputeHash)\b|\bnew\s+(?:MD5CryptoServiceProvider|SHA1CryptoServiceProvider|SHA1Managed|MD5Cng)\b/g;
276
+ while ((match = hashRe.exec(code)) !== null)
277
+ weakHashing.push({ line: (0, lines_1.lineOf)(source, match.index) });
278
+ const redirectRe = /\b(?:Redirect|RedirectPermanent)\s*\(\s*(?:Request\.|HttpContext\.Request\.|returnUrl\b|redirectUrl\b|url\b)/g;
279
+ while ((match = redirectRe.exec(code)) !== null)
280
+ openRedirect.push({ line: (0, lines_1.lineOf)(source, match.index) });
281
+ }
282
+ return {
283
+ consoleLogs, todos, deepNesting, longParameterLists, magicNumbers,
284
+ // Reflection, dependency injection, partial classes and source generators
285
+ // make regex-only unused detection untrustworthy in C#. Empty is deliberate.
286
+ unusedVars: [], unusedFunctions: [], hardcodedSecrets: [],
287
+ bareSuppressions: [], duplicateBlocks: [], fileNamingViolations: [],
288
+ evalUsage, sqlConcatenation, insecureRandom, unsafeRegex, hardcodedLocalhost,
289
+ disabledTlsVerification, debugFlagsEnabled, weakHashing, openRedirect,
290
+ };
291
+ }
292
+ /** A project manifest carries no methods, nesting, or debug output: its numbers
293
+ * are versions and warning levels, and its literals are build settings. Only
294
+ * the dependency list and the secret scan apply. */
295
+ function emptyCSharpSmells() {
296
+ return {
297
+ consoleLogs: [], todos: [], deepNesting: 0, longParameterLists: [], magicNumbers: [],
298
+ unusedVars: [], unusedFunctions: [], hardcodedSecrets: [],
299
+ bareSuppressions: [], duplicateBlocks: [], fileNamingViolations: [],
300
+ evalUsage: [], sqlConcatenation: [], insecureRandom: [], unsafeRegex: [],
301
+ hardcodedLocalhost: [], disabledTlsVerification: [], debugFlagsEnabled: [],
302
+ weakHashing: [], openRedirect: [],
303
+ };
304
+ }
305
+ function countInLineRange(ascendingLines, from, to) {
306
+ if (to < from)
307
+ return 0;
308
+ return ascendingLines.filter(line => line >= from && line <= to).length;
309
+ }
310
+ /** LINQ operators counted per STATEMENT, not per line: an idiomatic C# chain is
311
+ * written one operator per line, so a per-line count only ever caught the
312
+ * one-liners it was least useful on. */
313
+ function detectLinqAbuse(source, severity) {
314
+ const code = (0, lexer_1.csharpCodeOnly)(source);
315
+ const operatorRe = /\.(?:Where|Select|SelectMany|GroupBy|OrderBy|OrderByDescending|ThenBy|ThenByDescending|Join|GroupJoin|Aggregate|Zip|Distinct|Union|Intersect|Except)\s*\(/g;
316
+ const warnings = [];
317
+ let statementStart = 0;
318
+ let count = 0;
319
+ let firstOperatorIndex = -1;
320
+ const flush = () => {
321
+ if (count >= 5 && firstOperatorIndex >= 0) {
322
+ warnings.push({
323
+ type: 'linq-abuse',
324
+ message: `LINQ chain has ${count} operators; consider naming intermediate steps`,
325
+ severity: severity('linq-abuse', 'warning'),
326
+ line: (0, lines_1.lineOf)(source, firstOperatorIndex),
327
+ });
328
+ }
329
+ count = 0;
330
+ firstOperatorIndex = -1;
331
+ };
332
+ for (let i = 0; i < code.length; i++) {
333
+ const ch = code[i];
334
+ if (ch !== ';' && ch !== '{' && ch !== '}')
335
+ continue;
336
+ const statement = code.slice(statementStart, i);
337
+ operatorRe.lastIndex = 0;
338
+ let match;
339
+ while ((match = operatorRe.exec(statement)) !== null) {
340
+ count++;
341
+ if (firstOperatorIndex < 0)
342
+ firstOperatorIndex = statementStart + match.index;
343
+ }
344
+ flush();
345
+ statementStart = i + 1;
346
+ }
347
+ return warnings;
348
+ }
349
+ function detectCSharpWarnings(source, methods, classes, imports, config) {
350
+ const warnings = [];
351
+ const lineCount = source.split('\n').length;
352
+ const severity = (type, fallback) => config.severityOverrides[type] ?? fallback;
353
+ const warningThreshold = Math.round(config.fileLengthThreshold * 2 / 3);
354
+ if (lineCount > config.fileLengthThreshold)
355
+ warnings.push({ type: 'file-too-long', message: `File is ${lineCount} lines (>${config.fileLengthThreshold})`, severity: severity('file-too-long', 'error') });
356
+ else if (lineCount > warningThreshold)
357
+ warnings.push({ type: 'file-too-long', message: `File is ${lineCount} lines (>${warningThreshold})`, severity: severity('file-too-long', 'warning') });
358
+ for (const method of methods) {
359
+ const span = method.endLine - method.line + 1;
360
+ const errorThreshold = config.functionLengthThreshold * 2;
361
+ if (span > errorThreshold)
362
+ warnings.push({ type: 'function-too-long', message: `${method.name} is ~${span} lines (>${errorThreshold})`, severity: severity('function-too-long', 'error'), line: method.line });
363
+ else if (span > config.functionLengthThreshold)
364
+ warnings.push({ type: 'function-too-long', message: `${method.name} is ~${span} lines (>${config.functionLengthThreshold})`, severity: severity('function-too-long', 'warning'), line: method.line });
365
+ }
366
+ if (methods.length > config.maxFunctionsPerFile)
367
+ warnings.push({ type: 'too-many-functions', message: `${methods.length} methods in one file (>${config.maxFunctionsPerFile})`, severity: severity('too-many-functions', 'warning') });
368
+ if (imports.length > config.maxImportsPerFile)
369
+ warnings.push({ type: 'too-many-imports', message: `${imports.length} third-party C# references (>${config.maxImportsPerFile})`, severity: severity('too-many-imports', 'warning') });
370
+ const methodLines = methods.map(method => method.line);
371
+ for (const cls of classes) {
372
+ const count = countInLineRange(methodLines, cls.line + 1, cls.endLine);
373
+ const limit = Math.max(15, config.maxFunctionsPerFile * 2);
374
+ const span = cls.endLine - cls.line + 1;
375
+ if (count > limit || span > config.fileLengthThreshold) {
376
+ warnings.push({ type: 'large-class', message: `${cls.name} spans ${span} lines and ${count} methods; consider extracting responsibilities`, severity: severity('large-class', 'warning'), line: cls.line });
377
+ }
378
+ }
379
+ const code = (0, lexer_1.csharpCodeOnly)(source);
380
+ // `catch (Exception)` and `catch { }` are the same smell as
381
+ // `catch (Exception ex)`, so the identifier is optional and a bare catch
382
+ // counts. A `when (...)` filter is deliberate handling and is exempt. Read off
383
+ // the string-blanked source: a catch clause quoted in a message is not one.
384
+ const catchAllRe = /\bcatch\s*\(\s*(?:System\.)?Exception\b\s*\w*\s*\)(\s*when\b)?|\bcatch\s*(?=\{)/g;
385
+ let match;
386
+ while ((match = catchAllRe.exec(code)) !== null) {
387
+ if (match[1])
388
+ continue;
389
+ warnings.push({ type: 'catch-all-exception', message: 'Catch a narrower exception type or preserve explicit handling context', severity: severity('catch-all-exception', 'warning'), line: (0, lines_1.lineOf)(source, match.index) });
390
+ }
391
+ const asyncVoidRe = /\basync\s+void\s+([A-Z_a-z]\w*)\s*\(/g;
392
+ while ((match = asyncVoidRe.exec(code)) !== null) {
393
+ const name = match[1];
394
+ // On*/*_Click*/*Handler are event handlers, where async void is the only
395
+ // signature the framework will call.
396
+ if (!/^On[A-Z]/.test(name) && !/_(?:Click|Load|Changed|Closing|Tick|Completed)$/.test(name) && !/Handler$/.test(name)) {
397
+ warnings.push({ type: 'async-void', message: `${name} is async void; return Task so callers can observe failures`, severity: severity('async-void', 'error'), line: (0, lines_1.lineOf)(source, match.index) });
398
+ }
399
+ }
400
+ warnings.push(...detectLinqAbuse(source, severity));
401
+ return warnings;
402
+ }
403
+ function scoreCSharpComplexity(source, codeLineCount, methods, imports) {
404
+ const code = (0, lexer_1.csharpCodeOnly)(source);
405
+ let score = 1;
406
+ const branchCount = (code.match(/\b(?:if|else|for|foreach|while|switch|case|catch|when)\b|&&|\|\||\?\./g) ?? []).length;
407
+ const linqCount = (code.match(/\.(?:Where|Select|SelectMany|GroupBy|OrderBy|ThenBy|Join|Aggregate)\s*\(/g) ?? []).length;
408
+ const density = codeLineCount > 0 ? methods.length / (codeLineCount / 50) : 0;
409
+ score += Math.min(3, Math.floor(density));
410
+ score += Math.min(3, Math.floor((branchCount + linqCount) / 8));
411
+ score += Math.min(2, Math.floor(imports.length / 3));
412
+ return Math.max(1, Math.min(10, score));
413
+ }
414
+ function analyseCSharp(source, config, filePath = '') {
415
+ const lines = source.split('\n');
416
+ const manifest = filePath.toLowerCase().endsWith('.csproj');
417
+ const blankLines = lines.filter(line => line.trim() === '' || /^\s*\/\//.test(line)).length;
418
+ const codeLineCount = Math.max(0, lines.length - blankLines);
419
+ const allMethods = manifest ? [] : detectCSharpFunctions(source);
420
+ const methods = config.ignoreFunctions.length > 0 ? allMethods.filter(method => !config.ignoreFunctions.includes(method.name)) : allMethods;
421
+ const classes = manifest ? [] : detectCSharpClasses(source);
422
+ const imports = extractCSharpThirdPartyImports(source, filePath);
423
+ const warnings = manifest ? [] : detectCSharpWarnings(source, methods, classes, imports, config);
424
+ const baseSmells = manifest ? emptyCSharpSmells() : detectCSharpCodeSmells(source, methods, config, (0, guards_1.isTestFile)(filePath));
425
+ const hardcodedSecrets = (0, secrets_1.detectHardcodedSecrets)(source, config, 'csharp', filePath);
426
+ const codeSmells = { ...baseSmells, hardcodedSecrets };
427
+ return {
428
+ lineCount: lines.length, blankLines, codeLines: codeLineCount,
429
+ functions: methods.map(({ name, line }) => ({ name, line })),
430
+ thirdPartyImports: imports, unusedImports: [],
431
+ complexityScore: manifest ? 1 : scoreCSharpComplexity(source, codeLineCount, methods, imports),
432
+ warnings, typeScriptMetrics: ZEROED_TS_METRICS, codeSmells,
433
+ healthScore: (0, scoring_1.computeHealthScore)(warnings, ZEROED_TS_METRICS, codeSmells, config),
434
+ };
435
+ }
436
+ //# sourceMappingURL=analyser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyser.js","sourceRoot":"","sources":["../../src/csharp/analyser.ts"],"names":[],"mappings":";;AAiJA,wEA4BC;AAuOD,sCAqBC;AAxaD,sCAAsC;AACtC,oCAAiC;AACjC,wCAA+C;AAC/C,wCAAmD;AACnD,wDAAuD;AACvD,mCAAyE;AAGzE,MAAM,iBAAiB,GAAsB;IAC3C,SAAS,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACtD,iBAAiB,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/D,CAAA;AAED,6EAA6E;AAC7E,8EAA8E;AAC9E,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC;IAC1C,uBAAuB,EAAE,0BAA0B,EAAE,8BAA8B;CACpF,CAAC,CAAA;AAaF,SAAS,eAAe,CAAC,KAAa;IACpC,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,IAAI,YAAY,GAAG,CAAC,CAAA;IACpB,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE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1,29 @@
1
+ /**
2
+ * The C# lexical layer, in its own module because TWO callers need it: the C#
3
+ * analyser (every structural rule) and `detectParseErrorReason` in guards.ts
4
+ * (the delimiter balance check that decides whether a file is analysed at all).
5
+ *
6
+ * That second caller is the reason this is not a private helper. The generic
7
+ * sanitiser treats `\"` as an escaped quote, so the everyday C# verbatim string
8
+ * `@"C:\logs\"` read as UNTERMINATED, every brace after it landed at the wrong
9
+ * depth, and the file was reported as a parse error with all findings zeroed.
10
+ * A Windows path in a verbatim string is not an edge case in C#.
11
+ *
12
+ * ONE scanner serves both "strip comments" and "strip comments and strings":
13
+ * C# has five string forms and keeping two copies of that lexer is how they
14
+ * drift. Both modes are LENGTH-PRESERVING and keep every CR/LF, so a finding's
15
+ * offset still maps to its native line with no remapping layer.
16
+ *
17
+ * Handled forms: line and block comments, char literals, regular ("..." with
18
+ * backslash escapes), verbatim (@"..." where "" is the escape and a backslash is
19
+ * literal), interpolated ($"...", $@"...", @$"..."), and C# 11 raw strings
20
+ * ("""...""", any delimiter length, $-interpolated included). Raw strings are the
21
+ * trap: scanned naively, a `"""` opens and closes on its own first two quotes and
22
+ * every following brace lands in the wrong nesting level.
23
+ */
24
+ export declare function transformCSharp(source: string, blankStrings: boolean): string;
25
+ /** Comments blanked, string contents intact. */
26
+ export declare function stripCSharpComments(source: string): string;
27
+ /** Comments AND string contents blanked: the input for anything structural. */
28
+ export declare function csharpCodeOnly(source: string): string;
29
+ //# sourceMappingURL=lexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../../src/csharp/lexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CAyH7E;AAED,gDAAgD;AAChD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}