Measuring code health through parsing success
Parse failure rate measures the percentage of files in your repository that couldn't be successfully parsed by Spec This's code analysis engine. A file fails to parse when it contains syntax errors, uses unsupported language features, or is corrupted.
This metric is important because unparseable files prevent accurate code analysis and often indicate underlying problems with code quality, build processes, or development practices.
Example 1:
Example 2:
The most common cause - code that doesn't follow JavaScript/TypeScript syntax rules.
// Missing closing brace
function calculate(x, y) {
return x + y;
// ❌ Parse error: missing }
// Invalid syntax
const value = ; // ❌ Parse error: unexpected token
// Mismatched brackets
const arr = [1, 2, 3}; // ❌ Parse error: expected ]
// Invalid JSX
const Component = () => {
return <div>Hello // ❌ Parse error: unclosed tag
};Files that are mid-refactoring or not yet complete.
// WIP file with placeholder code
export function processData() {
// TODO: implement this
const result = // ❌ Incomplete statement
return
}
// Commented-out code with invalid syntax
// function old_code( {
// return "test"
// ❌ Parser attempts to read thisUsing JavaScript/TypeScript features not yet supported by the parser.
// Stage 1 proposal syntax not widely supported
const obj = {
property = initialValue // ❌ Might not parse
};
// Experimental decorators with non-standard syntax
@customDecorator({ options })
class MyClass { } // ❌ Depending on parser versionMalformed generated files or corrupted build outputs.
Examples:
Files with .js/.ts extensions that aren't actually JavaScript/TypeScript.
Examples:
| Sensitivity Level | Max Rate | Interpretation |
|---|---|---|
| High | ≤ 1% | Well-maintained, production-ready code |
| Medium | ≤ 5% | Active development, some WIP acceptable |
| Low | ≤ 10% | Heavy refactoring or migration in progress |
A parse failure rate above 10% is a red flag indicating serious code health issues. This should be investigated and resolved immediately, as it likely indicates:
Spec This provides detailed information about which files failed and why. Check the scan results in the Scans page to see:
Run your linter (ESLint, TSLint) to catch syntax errors:
# Check specific file npx eslint src/problematic-file.ts # Check all files npx eslint src/**/*.ts
If using TypeScript, ensure files compile:
# Type check without emitting files npx tsc --noEmit # Check specific file npx tsc --noEmit src/problematic-file.ts
Look for these common problems in failed files:
<<<<<<<, =======, >>>>>>>)If build artifacts or generated files are being scanned, exclude them:
# .gitignore dist/ build/ *.generated.js .next/ coverage/