Regular expression for matching Unix shebang lines at the beginning of files
88
{
"context": "This criteria evaluates how well the engineer uses the shebang-regex package to solve a script validation problem, particularly focusing on understanding the package's edge cases and limitations around whitespace, line positioning, and the strict start-of-string anchor behavior.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Import shebang-regex",
"description": "Correctly imports the shebang-regex package (e.g., `const shebangRegex = require('shebang-regex')` or equivalent ES6 import)",
"max_score": 10
},
{
"name": "Use .test() method",
"description": "Uses the `shebangRegex.test()` method to check if strings contain shebangs at the start position",
"max_score": 20
},
{
"name": "Understand ^ anchor",
"description": "Demonstrates understanding that shebang-regex only matches shebangs at the very beginning due to the `^` anchor, correctly distinguishing between files with shebangs at the start versus those with leading content",
"max_score": 30
},
{
"name": "Detect misplaced shebangs",
"description": "Correctly identifies files that contain shebang patterns (`#!`) but not at the start position (e.g., after whitespace or newlines) as invalid, not as non-scripts",
"max_score": 25
},
{
"name": "Handle all categories",
"description": "Properly classifies files into all three categories (valid, invalid, nonScripts) based on shebang presence and position",
"max_score": 15
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-shebang-regexdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9