CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-shebang-regex

Regular expression for matching Unix shebang lines at the beginning of files

88

1.54x
Overview
Eval results
Files

rubric.jsonevals/scenario-9/

{
  "context": "This criteria evaluates how effectively the engineer uses the shebang-regex package to detect and parse shebang lines from script content. The focus is on proper usage of the package's regex methods (test and exec) and capture groups to extract interpreter information from various script types.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Import shebang-regex",
      "description": "Correctly imports the shebang-regex package using require() or import statement",
      "max_score": 10
    },
    {
      "name": "Use test() method",
      "description": "Uses shebangRegex.test() method to check if a script has a shebang line in the hasShebang() function",
      "max_score": 15
    },
    {
      "name": "Use exec() method",
      "description": "Uses shebangRegex.exec() method to extract shebang information from script content",
      "max_score": 15
    },
    {
      "name": "Extract full shebang",
      "description": "Correctly extracts the complete shebang line using exec()[0] or equivalent to get the full match including #!",
      "max_score": 15
    },
    {
      "name": "Extract interpreter path",
      "description": "Correctly extracts the interpreter path without #! using exec()[1] or equivalent to access the first capture group",
      "max_score": 20
    },
    {
      "name": "Handle null results",
      "description": "Properly handles cases where exec() returns null (no shebang present) using null checks, optional chaining, or similar defensive programming",
      "max_score": 15
    },
    {
      "name": "Support multiple interpreters",
      "description": "Implementation works correctly for multiple interpreter types (node, python, bash, ruby, perl) as demonstrated by test cases, leveraging shebang-regex's universal interpreter support",
      "max_score": 10
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-shebang-regex

tile.json