Static analysis examines source code without executing it. Linters and security scanners look for suspicious patterns that may be syntactically valid but unsafe or inadvisable. These checks are useful for reviewing generated code, but a clean scan does not establish that the code behaves as intended. section 8.2.2 section 8.2.6
Flagging a vulnerable regular expression
A markup parser can use a regular expression to recognize bold text. A pattern with a repeated group containing another repetition can take exponentially longer on input that never closes the delimiter. In TypeScript, ESLint with the installed and enabled eslint-plugin-security can flag this pattern before execution. The rule also flags some safe expressions, so investigate warnings rather than treating every one as a confirmed vulnerability. section 8.2.2
const BOLD = /\*\*([^*]+)+\*\*/;
The inner and outer + quantifiers make this bold-text pattern a candidate for excessive backtracking. section 8.2.2
Static analysis can also support language-aware refactoring. When an AI-assisted package rename missed references and folder names, the application failed to compile; an IDE refactoring produced a change that compiled. For changes that can be inferred statically, a dedicated refactoring tool can be a more reliable and cheaper choice than repeated AI prompts. section 2.8.1
Use static checks as an always-on gate, not a substitute for execution. Tests must still check whether inputs produce the required outputs. Similarly, code inspection can suggest performance hot spots, but runtime measurements are needed to decide where optimization will matter. Add stronger verification when untrusted input, complex logic, integrations, or critical systems justify its cost. section 8.2.6 section 7.3.1 section 8.8.2










