Static analysis · 5 tools
Top 5 static analysis tools for writing custom code rules
For platform and AppSec engineers who want to enforce in-house coding patterns and catch internal API misuse, this shortlist starts with Semgrep, CodeQL and ESLint. Semgrep is an extensible application security platform, CodeQL lets you query code as if it were data, and ESLint accepts user-written rules alongside its built-in ones. PMD and Error Prone follow for Java-heavy teams. The order reflects how directly each tool's documentation points to writing your own rules.
| # | Tool | Best for | Key feature | Platforms / deployment | Pricing | More |
|---|---|---|---|---|---|---|
| 1 | SemgrepSemgrep | Platform teams enforcing rules through CI and pull requests | Search the Semgrep Registry and custom rules | CLI, CI/CD, VS Code and JetBrains; PR checks on GitHub, GitLab, Bitbucket and Azure | See vendor pricing page | Introduction |
| 2 | CodeQLGitHub | Expressive, query-based analysis of open source code | Query code as if it were data | Visual Studio Code extension and CodeQL CLI | See vendor pricing page | Introduction |
| 3 | ESLintESLint | Custom rules for JavaScript and JSX codebases | User-written rules alongside built-in rules | Most text editors and CI pipelines; browser and server JavaScript, with or without a framework | See vendor pricing page | Introduction |
| 4 | PMDPMD | Java and Apex teams adding their own rules | More than 400 built-in rules | Command line check command; IDE and CI plugins; Chocolatey on Windows | See vendor pricing page | Introduction |
| 5 | Error ProneGoogle | Build-time enforcement for Java projects | Augments the compiler's type analysis | Java builds, including Bazel Java compilation | See vendor pricing page | Introduction |
1 Semgrep
By Semgrep
Semgrep is an extensible application security platform that scans source code, combining SAST, SCA and secrets scanning with AI reasoning. Its documentation mentions searching the Semgrep Registry and custom rules and dry-running policies.
Why it is here: It comes first because it is described as extensible, supports custom rules alongside a registry, and ties findings to CI/CD, PR checks and policy workflows that platform teams use to enforce standards.
- Best for
- Platform teams enforcing rules through CI and pull requests
- Key features
- Search the Semgrep Registry and custom rules
- Dry-run policies before applying them
- PR checks on GitHub, GitLab, Bitbucket and Azure
- Findings routed to Jira and Slack with policy-driven remediation workflows
- Triage decisions become reusable memories that suppress repeat false positives
- Limits
- The pages we used mention custom rules but do not describe the rule-writing syntax or supported languages. Teams should check the vendor documentation for authoring details.
- Platforms / deployment
- CLI, CI/CD, VS Code and JetBrains; PR checks on GitHub, GitLab, Bitbucket and Azure
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (semgrep.dev) · Read our introduction to Semgrep
2 CodeQL
By GitHub
CodeQL is GitHub's semantic code analysis engine. It lets you query code as if it were data, so you can write a query to find all variants of a vulnerability and share it with others.
Why it is here: It sits second because its core model is writing queries against code, which is expressive for hunting internal API misuse, though it asks for more setup than a ready-made rule file.
- Best for
- Expressive, query-based analysis of open source code
- Key features
- Query code as if it were data
- Share queries that find all variants of a vulnerability
- Run queries from a Visual Studio Code extension
- Databases downloaded or built with the CodeQL CLI
- Taint tracking support
- Limits
- Use is restricted to OSI-approved open source codebases, academic research, or specific automated-analysis cases, and other CI/CD use requires contacting sales. Teams enforcing rules on private code should read the vendor terms first.
- Platforms / deployment
- Visual Studio Code extension and CodeQL CLI
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (codeql.github.com) · Read our introduction to CodeQL
3 ESLint
By ESLint
ESLint is an open source, pluggable and configurable linter that finds and reports problems in JavaScript and JSX through static analysis. It supports user-written rules alongside built-in rules.
Why it is here: It sits third because its pluggable design makes in-house rules a normal part of use, but its documented focus is JavaScript and JSX, so it suits teams with front-end or Node codebases.
- Best for
- Custom rules for JavaScript and JSX codebases
- Key features
- User-written rules alongside built-in rules
- Custom parsers and code preprocessing
- Syntax-aware automatic fixes
- Runs in editors and continuous integration pipelines
- Official support for linting shell scripts
- Limits
- Documented mainly for JavaScript and JSX, with shell scripts as a newer addition. Teams whose in-house patterns live in other languages should check the vendor documentation for support.
- Platforms / deployment
- Most text editors and CI pipelines; browser and server JavaScript, with or without a framework
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (eslint.org) · Read our introduction to ESLint
4 PMD
By PMD
PMD is an extensible, cross-language static source code analyzer that finds common flaws such as unused variables, empty catch blocks and unnecessary object creation. It ships with more than 400 built-in rules.
Why it is here: It sits fourth because custom rules are documented, in Java or as XPath queries, but they are written against a fixed set of supported languages and an AST model.
- Best for
- Java and Apex teams adding their own rules
- Key features
- More than 400 built-in rules
- Custom rules written in Java or as XPath queries
- Parses source into ASTs using JavaCC and Antlr
- CPD copy-paste detector
- Plugins for IDEs and CI, including Eclipse
- Limits
- PMD focuses mainly on Java and Apex, with 16 other languages supported. Scala is supported, but no Scala rules are currently available.
- Platforms / deployment
- Command line check command; IDE and CI plugins; Chocolatey on Windows
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (pmd.github.io) · Read our introduction to PMD
5 Error Prone
By Google
Error Prone is a Google-developed, open-source tool that augments the Java compiler's type analysis to catch mistakes at build time. Findings surface as compilation errors, each with a named bug pattern and a descriptive message.
Why it is here: It closes the list because the documentation we used centers on built-in bug patterns that run in the standard build, rather than on authoring your own checks.
- Best for
- Build-time enforcement for Java projects
- Key features
- Augments the compiler's type analysis
- Hooks into the standard build so all developers run it
- Reports mistakes immediately after they are made
- Produces suggested fixes that tooling can build on
- Named bug patterns such as CollectionIncompatibleType
- Limits
- The pages we used describe its bug patterns and build integration but not how to write your own checks. Teams that need custom rules should check the vendor documentation.
- Platforms / deployment
- Java builds, including Bazel Java compilation
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (errorprone.info) · Read our introduction to Error Prone
How we chose these tools
We looked at how well each tool fits the job of writing and enforcing your own rules, what the vendor documents about custom checks and queries, and what deployment and platform documentation exists (CLI, CI, editors, build integration). All facts come from official vendor pages and were recorded at the time we checked them. Where the pages do not describe custom rule authoring, we say that in the limits.
The order reflects editorial fit for this use case, explained in the "why here" line on each entry, and is not a statement that one tool is better overall. Language scope matters a great deal for custom rules, so check each tool's supported languages against your stack. The list is built from documentation rather than product trials, so confirm details in the vendor documentation before committing.
Order used in this guide: Ordered by how easy and expressive custom rule authoring is, most flexible first.
Frequently asked questions
Which static analysis tools let you write your own rules?
ESLint supports user-written rules alongside built-in rules, and PMD supports custom rules written in Java or as XPath queries. CodeQL lets you write queries against code, and Semgrep's documentation mentions custom rules.
How do I write a custom rule in PMD?
PMD documents two routes: custom rules written in Java or as XPath queries. PMD parses source files into abstract syntax trees and runs rules against them to find violations.
Can I share a CodeQL query with my team?
Yes. CodeQL documents that you can write a query to find all variants of a vulnerability and share it with others. Queries can be run through a Visual Studio Code extension.
Is CodeQL suitable for private company code?
CodeQL's documented use is restricted to OSI-approved open source codebases, academic research, or specific automated-analysis cases. Other CI/CD use requires contacting sales, so check the vendor terms for your situation.
Which tools here are limited to specific languages?
ESLint is documented for JavaScript and JSX, with shell script support added, and Error Prone targets Java builds. PMD focuses mainly on Java and Apex and supports 16 other languages.
- Semgrep: semgrep.dev, semgrep.dev/about, semgrep.dev/solutions/mcp — checked 21 November 2026
- CodeQL: codeql.github.com — checked 21 November 2026
- ESLint: eslint.org — checked 21 November 2026
- PMD: pmd.github.io — checked 21 November 2026
- Error Prone: errorprone.info — checked 21 November 2026
Linthelm is independent and not affiliated with the vendors listed. No vendor paid for inclusion or position. Product names belong to their owners. Features and prices change; confirm details on each official website.