Quick verdict: Semgrep is the stronger security-focused SAST tool (DryRun benchmark: 46% detection rate vs SonarQube's 19%). SonarQube is the stronger code quality tool with 6,500+ rules covering bugs, smells, and duplication. They are complementary, not interchangeable.
Semgrep and SonarQube are two of the most widely deployed static analysis tools. Both perform SAST. Both integrate into CI/CD pipelines. Both show up in enterprise procurement shortlists.
They come from opposite directions, though. Semgrep started as a security-focused pattern-matching engine. SonarQube started as a code quality platform and added security scanning later. Those origins shape everything: architecture, detection depth, rule systems, and which teams each tool actually serves.
This comparison draws on academic benchmarks, independent practitioner reports, G2 and Gartner reviews, Vendr pricing data, and official documentation. Where vendor claims diverge from independent findings, both are noted.
What Semgrep and SonarQube actually are
Semgrep
Semgrep originated at Facebook (now Meta) as a successor to an internal tool called sgrep, part of a program analysis library called pfff developed in 2009. Return To Corp (later renamed Semgrep, Inc.) open-sourced the engine in 2020 and built a commercial platform around it.
The core idea: write security rules using the target language's own syntax. If you want to find hashlib.md5(...) in Python, you literally write hashlib.md5(...) as your pattern. This makes Semgrep approachable for developers who are not security specialists.
Semgrep now ships three products: Semgrep Code (SAST), Semgrep Supply Chain (SCA with reachability analysis), and Semgrep Secrets (credential detection with semantic, entropy, and HTTP validation). The SAST engine exists in two tiers: the open-source Community Edition (CE) and the proprietary Pro engine with cross-file analysis.
Semgrep has no code quality features. It does not track code smells, duplication, test coverage, or technical debt.
SonarQube
SonarQube (now branded "SonarQube Server" for self-hosted, "SonarQube Cloud" for SaaS) was created by SonarSource in 2007 as a code quality and SAST platform. Its core mission is enforcing clean code standards through static analysis rules, quality gates, and technical debt tracking.
Security vulnerability detection exists, but it accounts for roughly 15% of SonarQube's rule set, with approximately 85% focused on code quality. The platform ships over 6,500 rules across 35+ languages, covering bugs, code smells, duplication, test coverage, and maintainability alongside security findings.
SonarQube added SCA capabilities only in 2025 via the "Advanced Security" add-on, available exclusively on Enterprise Edition and above. Its identity is fundamentally a code quality enforcement platform that also does security scanning.
| Dimension | Semgrep | SonarQube |
|---|---|---|
| Origin | 2020, SAST-first (security pattern matching) | 2007, code quality/SAST-first |
| SAST | Core product (Semgrep Code) | Original capability |
| SCA | Semgrep Supply Chain (2022, with reachability) | Advanced Security add-on (2025, Enterprise only) |
| Secrets | Semgrep Secrets (semantic + entropy + HTTP validation) | Basic secrets detection (enhanced in commercial editions) |
| Code quality metrics | None | Core identity (bugs, smells, duplication, coverage, tech debt) |
| Compliance reporting | OWASP/CWE mapping, SBOM generation, EPSS | OWASP Top 10, CWE Top 25, PCI DSS, STIG, CASA, MISRA C++ 2023 (Enterprise) |
The tools have expanded toward each other from opposite directions. Semgrep is a security-first tool that can enforce coding standards via custom rules. SonarQube is a code quality platform that has added security capabilities. This distinction shapes nearly every architectural and product decision.
How each tool works under the hood
Semgrep's architecture
Semgrep parses source code using tree-sitter parsers, converts the AST into a language-agnostic Intermediate Language (IL), and matches user-defined YAML rules against that IL. This is a build-free approach: Semgrep does not require compilation, build systems, or language runtimes to scan code. Reported throughput is 20,000 to 100,000 lines of code per second per rule (vendor claim).
The analysis depth depends on your tier:
- CE (open-source): Single-file analysis. Cross-function constant propagation. Taint tracking within a single function only (intraprocedural).
- Pro
--pro-intrafile: Cross-function analysis within a single file (interprocedural). Available for all supported languages. - Pro
--pro(full): Cross-function AND cross-file analysis. Only available for C#, Go, Java, JavaScript, Kotlin, Python, TypeScript, and C/C++.
Semgrep's own documentation is transparent about CE's limitations. The README states that CE "will miss many true positives" compared to Pro, because single-function taint tracking cannot follow data flows across function boundaries or files.
Cross-file analysis has practical constraints. It defaults to falling back to single-file mode if memory exceeds 5 GB or analysis time exceeds 3 hours. GitHub issue #10761 reports that interfile taint results can disappear with codebases exceeding 1,000 files. Semgrep recommends 4-8 GB of RAM per core for cross-file scans.
Semgrep Supply Chain (SCA) parses lockfiles and dependency manifests to identify dependency versions. It then combines two checks: whether the dependency version matches a known vulnerable range, and whether the vulnerable function or API from that dependency is actually called in the project's source code. This second step is the reachability analysis. Findings are categorized as Reachable, Conditionally reachable, Unreachable, or No reachability analysis. Semgrep's analysis of 1,100 repositories found that only ~2% of Dependabot-style alerts were reachable.
Critical limitation: Reachability analysis applies only to direct dependencies. Semgrep scans transitive dependencies for version-based vulnerabilities but does not perform reachability analysis on them.
SonarQube's architecture
SonarQube uses a client-server model. A SonarScanner runs locally or in CI, downloads language-specific analyzers from the SonarQube Server, scans code, and sends a report back to the server for computation. The server calculates metrics and evaluates Quality Gates. The server stores results in a PostgreSQL database. This server requirement means SonarQube has infrastructure overhead that Semgrep (SaaS-first) does not.
The analysis engine builds an Abstract Syntax Tree (AST) and applies rule-based checks. Three distinct analysis techniques are used:
- Pattern matching on AST: The baseline approach available in all editions. Rules navigate the AST to detect code smells, bugs, and basic security issues.
- Taint analysis: Tracks data flow from user-controlled inputs (sources) to sensitive functions (sinks) to detect injection vulnerabilities (SQLi, XSS, command injection, SSRF). Available only in Developer Edition and above. The Community Build lacks taint analysis entirely.
- Dataflow Bug Detection (DBD): Advanced dataflow analysis reviewing all feasible execution paths for complex bugs. Available in commercial editions only.
As of the 2025.1 LTA release, SonarQube's "Deeper SAST" feature traces data paths through the top 2,000 most-used Java libraries and top 1,000 C#/JavaScript/TypeScript libraries and top 100 Python libraries, understanding how data flows through third-party API calls.
The Community Edition gap is critical. No taint analysis means no ability to trace data flow from user input through to dangerous operations. No branch or PR analysis. Single-analysis-queue processing. Any evaluation of SonarQube's security capabilities on the free tier is assessing a tool that was not designed for security scanning.
For SCA, SonarQube Advanced Security collects dependency manifests and lockfiles via the scanner, sends them (not source code) to a Sonar cloud service over HTTPS for analysis, and returns vulnerability, license, and SBOM data.
Language and ecosystem support
SAST language coverage
| Language | Semgrep Code status | Semgrep analysis level | SonarQube status | SonarQube minimum edition |
|---|---|---|---|---|
| Java | GA | Cross-file + framework-specific | GA | Community |
| JavaScript | GA | Cross-file + framework-specific | GA | Community |
| TypeScript | GA | Cross-file + framework-specific | GA | Community |
| Python | GA | Cross-file + framework-specific | GA | Community |
| C# | GA | Cross-file | GA | Community |
| Go | GA | Cross-file | GA | Community |
| Kotlin | GA | Cross-file | GA | Community |
| C/C++ | GA | Cross-file | GA | Developer |
| PHP | GA | Cross-function | GA | Community |
| Ruby | GA | Cross-function | GA | Community |
| Scala | GA | Cross-function | GA | Community |
| Swift | GA | Cross-function | GA | Developer |
| Rust | GA | Cross-function | GA | Developer |
| Terraform | GA | Cross-function | GA | Community |
| Objective-C | Not supported | -- | GA | Developer |
| VB.NET | Not supported | -- | GA | Community |
| APEX | Beta | -- | GA | Enterprise |
| COBOL | Not supported | -- | GA | Enterprise |
| ABAP | Not supported | -- | GA | Enterprise |
| PL/SQL | Not supported | -- | GA | Developer |
| T-SQL | Not supported | -- | GA | Developer |
| Elixir | Beta | -- | Not supported | -- |
| Solidity | Experimental | -- | Not supported | -- |
Semgrep supports 35+ languages for SAST (8 at cross-file level, 9 at cross-function level, the rest experimental). Semgrep's rule registry includes 2,400+ community rules and 20,000+ proprietary Pro rules, with third-party contributions from Trail of Bits, GitLab, and others.
SonarQube supports up to 40 languages depending on edition (20+ in Community Build, 34 in Developer, 40 in Enterprise). SonarQube's breadth advantage is primarily in legacy enterprise languages: COBOL, ABAP, RPG, PL/I, PL/SQL, and T-SQL. Semgrep has stronger coverage of blockchain and niche languages (Solidity, Cairo, Circom).
The Community Build's lack of C/C++, Swift, Dart, and Rust forces teams working in those languages to pay for Developer Edition or higher.
SCA ecosystem coverage
| Package Ecosystem | Semgrep Supply Chain | SonarQube Advanced Security |
|---|---|---|
| npm (JS/TS) | GA with reachability | GA |
| PyPI (Python) | GA with reachability | GA |
| Maven (Java) | GA with reachability | GA |
| Gradle (Java/Kotlin) | GA with reachability | GA |
| Go modules | GA with reachability | GA |
| NuGet (C#) | GA with reachability | Not documented |
| RubyGems | GA with reachability | Not documented |
| CocoaPods/SwiftPM | GA with reachability | No |
| Composer (PHP) | GA with reachability | Not documented |
| Cargo (Rust) | Beta (no reachability) | Not documented |
| Conan/vcpkg (C/C++) | Not supported | Beta |
Semgrep Supply Chain supports 14 languages across approximately 15 package managers with reachability analysis for most GA languages. SonarQube Advanced Security currently supports 5 confirmed ecosystems (Maven, Gradle, npm, pip, Go modules). For teams with diverse dependency ecosystems, the coverage gap is significant.
SonarQube's SCA requires Enterprise Edition ($20K+/year), making it inaccessible to most teams on lower tiers. No independent evaluation of SonarQube's SCA quality exists given its recency.
Detection accuracy: what the independent data says
Accuracy benchmarks for SAST tools are sparse. Most comparisons are vendor-funded or use synthetic test suites that don't reflect real-world code. A few independent studies stand out.
EASE 2024 academic benchmark
The most rigorous recent study comes from the 28th International Conference on Evaluation and Assessment in Software Engineering (EASE 2024, ACM). Researchers tested four SAST tools against 170 manually curated commits with known vulnerabilities in production Java code.
Detection rates with default configurations:
| Tool | Detection Rate |
|---|---|
| FindSecBugs | 26.5% |
| CodeQL | 18.4% |
| Semgrep CE | 14.3% |
| Snyk Code | 11.2% |
All four tools combined detected 38.8% of vulnerabilities. That means 61.2% of real-world Java vulnerabilities were undetectable by any of the four tools with default rule sets.
After creating custom Semgrep rules targeting identified gaps, a single Semgrep instance reached 44.7% detection, outperforming any combination of the other four tools. This demonstrates both the structural limitations of current SAST tools and Semgrep's particular strength: its extensible rule system makes it the most improvable tool.
SonarQube was not included in this benchmark.
DryRun Security benchmark (2025)
DryRun Security tested five tools against 26 seeded vulnerabilities across four intentionally vulnerable applications (Ruby/Rails, Python/Django, C#/.NET, Java/Spring Boot) using default configurations:
| Tool | Detection Rate |
|---|---|
| DryRun Security | 88% (23/26) |
| Semgrep | 46% (12/26) |
| Snyk Code | 38% (10/26) |
| CodeQL | 31% (8/26) |
| SonarQube | 19% (5/26) |
SonarQube missed SQL injection in C#, SSRF in C#, and most XSS variants. Neither Semgrep nor SonarQube detected IDOR, broken authentication, or user enumeration (logic flaws beyond the scope of pattern-based or dataflow SAST).
Caveat: This benchmark was published by DryRun Security, a competing vendor. All test code and methodology are public and reproducible via GitHub.
Doyensec benchmark (Semgrep CE vs Pro)
Security consultancy Doyensec tested Semgrep CE against Semgrep Pro on OWASP test applications. This was commissioned by Semgrep but conducted independently.
| App | CE True Positives | Pro True Positives | Improvement |
|---|---|---|---|
| WebGoat (Java) | 48% (16/33) | 72% (24/33) | +50% |
| Juice Shop (Node.js) | 44% (21/48) | 75% (36/48) | +71% |
Neither version produced significant false positives on these test apps.
Vendor claim vs. reality: Semgrep claims Pro "increases true positives by 250% vs CE." The Doyensec study found 50-71%. The 250% figure has no independent verification.
SonarQube's accuracy data
The strongest independent data for SonarQube comes from Lenarduzzi et al. (2021), published in Empirical Software Engineering (Springer, peer-reviewed). Manual validation of SonarQube warnings revealed that only 18% were true positives, implying an approximately 82% false positive rate across sampled warnings. Critical context: this study covered all warning types (code smells, bugs, and security), not security vulnerabilities specifically, and used what appears to be the Community Edition.
On the OWASP Benchmark, SonarQube's Java Plugin v3.14 scored 33.34% across 2,740 test cases. This is an older version using the free Community plugin. Current Developer/Enterprise editions with taint analysis would likely score significantly higher, but no updated independent benchmark exists.
SonarSource claims a 3.2% false positive rate based on 137 million reviewed issues. The enormous discrepancy with the academic 82% figure is likely methodological: the academic study manually validated all flagged warnings, while SonarSource's figure reflects only issues users explicitly marked as false positives.
Practitioner reports on signal-to-noise
Semgrep practitioners on G2 report "low false positive rate" as a common positive, but others note: "It can produce noisy results with a lot of false positives out-of-the-box, requiring upfront tuning and rule customization to reduce irrelevant findings." The consensus: Semgrep's signal-to-noise is good after tuning but requires investment.
SonarQube practitioners on G2 report "sometimes rules feel too strict or generate false positives, requiring additional time to review and adjust." A Reddit user quoted by Aikido stated: "SonarQube is awful. Many false positives and most actual bugs are missed."
AppSecSanta (independent comparison site, 2026) summarizes: SonarQube tends to lean on the side of precision (fewer false positives, but potentially more false negatives), whereas Semgrep on the side of recall (cast a wider net, but you need to weed out some false alarms).
CI/CD integration and developer workflow
Platform support
| CI/CD Platform | Semgrep | SonarQube |
|---|---|---|
| GitHub Actions | First-class (auto diff-aware) | Official action + Quality Gate Check |
| GitLab CI/CD | First-class (auto diff-aware) | Official integration |
| Azure Pipelines | Supported | Official extension |
| Jenkins | Supported | Official plugin |
| Bitbucket Pipelines | Supported | Official pipe |
| CircleCI | Supported | Supported |
| Buildkite | Supported | Via generic scanner |
| Any Docker/CLI-capable CI | Yes (pip install or Docker) | Yes (SonarScanner CLI) |
Both tools cover all major CI/CD platforms. Semgrep also offers Managed Scans (GA late 2025), where Semgrep's infrastructure clones your repository and runs the scan without CI pipeline changes.
PR comments and diff-aware scanning
Semgrep posts inline comments on PRs with description, severity, remediation guidance, dataflow traces, and autofix suggestions. Comments only appear for new findings (not previously seen). Supported on GitHub, GitLab, Azure DevOps, and Bitbucket. Diff-aware scanning is automatic on PRs in GitHub Actions and GitLab CI. Semgrep performs two internal scans (PR tip and baseline) to determine new findings.
SonarQube PR decoration shows quality gate pass/fail status and links to new issues. Available in Developer Edition and above only. Community Build cannot decorate PRs or analyze branches. Quality gates evaluate new code against configurable thresholds. The "Clean as You Code" methodology focuses gates on new/changed code rather than legacy code. Mono-repo PR decoration requires Enterprise Edition.
Blocking vs non-blocking gates
Semgrep uses three rule modes: Monitor (finding recorded, no CI impact), Comment (PR comment posted, CI passes), and Block (PR comment posted, CI fails with exit code 1). Organizations typically start in Monitor and promote rules to Block as confidence grows.
SonarQube quality gates can be advisory or blocking. Set sonar.qualitygate.wait=true to poll for results and fail CI on gate failure, or configure branch protection rules to require gate passage. Quality gates can include conditions on issues count, coverage, duplication, and security ratings. This is a broader set of criteria than Semgrep's rule-level blocking.
Suppressing findings
Semgrep offers six mechanisms: (1) // nosemgrep or // nosemgrep: rule-id inline comments; (2) triage in the AppSec Platform with statuses (Open, Ignored, Fixed, Removed, Reviewing, To Fix); (3) PR comment replies (/fp, /ar, /other); (4) rule deactivation via Policies; (5) .semgrepignore files for path exclusions; (6) Semgrep Assistant auto-triage using AI (claimed 85% accuracy in identifying false positives).
SonarQube offers five mechanisms: (1) mark as False Positive or Won't Fix in the UI; (2) //NOSONAR inline comments or @SuppressWarnings annotations; (3) file/path exclusions via sonar.exclusions; (4) rule deactivation in Quality Profiles; (5) Sandboxing (2025.5+) to quarantine new rules from failing gates.
Scan performance at scale
Semgrep reports a 10-second median CI scan time for diff-aware scans and under 300 seconds for full Pro Engine scans (vendor claims). Practitioners on PeerSpot report: "Scan time is an issue for mono repos. Sometimes with their AI-based scanning, when you triage that scan, the scan never completes or finishes." Semgrep's troubleshooting docs acknowledge memory as "a common issue with scans, especially in memory-constrained environments."
SonarQube scans are consistently reported as slower. Aikido notes "SonarQube's scans tend to be slower and more resource-intensive." G2 reviewers state: "The one thing I dislike is how much it can slow things down when you're working with big projects." The client-server architecture means results are not available until the server processes the analysis report, adding latency. Community Build can only process one analysis at a time. Parallel processing requires commercial editions.
Where SAST and SCA overlap
Both tools now offer both SAST and SCA, which raises a natural question: how do the overlapping capabilities compare?
SAST: Semgrep Code vs SonarQube
Semgrep Code uses transparent, editable YAML rules with pattern matching and taint analysis. SonarQube uses rule-based AST analysis with transparent, documented rules. Both approaches are inspectable, unlike ML-based engines.
In the DryRun benchmark, Semgrep detected 46% of seeded vulnerabilities vs SonarQube's 19% with default configs. AppSecSanta (2026) describes SonarQube's "security depth lagging dedicated SAST tools" and names Semgrep among those that "detect more vulnerability types and do deeper inter-procedural and cross-file analysis."
Semgrep Code does not cover code quality. No code smell detection, no duplication analysis, no test coverage tracking, no technical debt scoring. For organizations wanting unified quality and security, Semgrep must be paired with another tool.
SCA: Semgrep Supply Chain vs SonarQube Advanced Security
Semgrep Supply Chain is more mature (launched 2022), covering 14 languages and 15+ package managers with reachability analysis for most GA languages. Semgrep's analysis of 1,100 repositories found that only ~2% of alerts were classified as reachable. No independent verification of this figure exists, but the methodology is well-understood.
SonarQube Advanced Security is brand new (2025) and covers 5-6 ecosystems. It generates SBOMs (CycloneDX, SPDX 2.3) and performs license compliance checking. It requires Enterprise Edition ($20K+/year). No independent practitioner evaluation of its quality exists.
Running both
Teams that need both code quality gates and deep security scanning are the most likely to use both tools together. This complementary pattern is common according to multiple practitioner sources. SonarQube handles bugs, smells, duplication, coverage thresholds. Semgrep handles security-specific SAST, SCA with reachability, and secrets detection.
The actual redundancy is limited to SAST security scanning. Both can find injection vulnerabilities via taint analysis in overlapping languages. Even here, they use different approaches and catch different things. Running both produces incrementally better detection, consistent with Bennett et al.'s finding that combining SAST tools improves coverage.
Rule customization and extensibility
This is where the tools diverge most sharply.
Semgrep's rule system
Semgrep rules are YAML files that use the target language's syntax for patterns. A minimal rule needs five fields: id, message, severity, languages, and pattern.
rules:- id: hardcoded-passwordmessage: Hardcoded password detectedseverity: WARNINGlanguages: [python]pattern: password = "..."
Available operators include pattern, patterns (AND), pattern-either (OR), pattern-not, pattern-inside, pattern-regex, metavariable-regex, metavariable-comparison, and focus-metavariable. Taint rules use mode: taint with pattern-sources, pattern-sinks, pattern-sanitizers, and pattern-propagators.
Practitioners consistently praise this approach. A Hacker News user reported: "I just wrote this Semgrep rule in 45 seconds which replicates the TC201 rule from tryceratops." The Czech Technical University thesis (2023) identified Semgrep as "the most developer-friendly tool" for custom rule creation. Doyensec found that "someone can become reasonably proficient with the tool in a matter of hours."
The Semgrep registry includes 2,400+ community rules and 20,000+ proprietary Pro rules. Trail of Bits, GitLab, and other organizations contribute rules publicly. Rules are licensed under the Semgrep Rules License v1.0, which allows internal business use but prevents use in competing commercial products.
SonarQube's rule system
SonarQube custom rules can be created in three ways:
- Java plugin API (most powerful): Write a SonarQube plugin in Java using
sonar-plugin-api, navigating the AST via language-specific visitor patterns. Deploy JARs toextensions/plugins. Requires knowledge of Java, AST structures, and the SonarQube plugin lifecycle. - XPath rules via UI (limited): Add rules through the web interface using XPath 1.0 expressions. Only available for Flex, PL/SQL, PL/I, and XML.
- Generic report import: Import findings from external tools in a standardized format. Not truly custom rules, more of an ingestion mechanism.
Quality Profiles allow granular per-language rule activation and deactivation with parameter customization, inheritance hierarchies, and export/import between instances. Enterprise Edition adds the Security Engine custom configuration, which allows extending taint analysis by configuring new sources, sanitizers, validators, and sinks for custom frameworks. This is configuration within the existing engine, not arbitrary rule authoring.
Custom rules in SonarQube cannot leverage the built-in taint/dataflow engine. Only AST pattern matching is available for custom rules. Multiple practitioner sources confirm the barrier: "Writing custom rules typically requires extensive knowledge of Java programming and abstract syntax trees. This means most teams rely on SonarSource's provided rules and can only toggle them on/off."
The built-in rule registry contains over 6,500 rules across 35+ languages. The community plugin ecosystem is mature but aging. Many plugins haven't been updated for recent SonarQube versions, and plugin compatibility is a known pain point during upgrades.
The gap
If rule customization matters to your workflow, the difference is stark. Semgrep treats custom rules as a first-class feature available to all users. SonarQube requires Java programming expertise for anything beyond toggling built-in rules. For teams with internal coding standards, banned API patterns, or framework-specific security requirements, Semgrep offers capabilities that SonarQube cannot match in accessibility.
Bennett et al. demonstrated that custom Semgrep rules lifted detection from ~14% to ~45% on production Java code. That improvement path does not exist with SonarQube's custom rule system for security use cases, because custom rules cannot access the taint engine.
Pricing
Semgrep pricing tiers
| Tier | Price | Limits | Key Inclusions |
|---|---|---|---|
| Free | $0 | Up to 10 contributors, 50 repos | Pro Engine (cross-file), Pro Rules, all languages, custom rules, AI triage, SCA with reachability |
| Team | $35/mo per contributor (Code), $35/mo (Supply Chain), $15/mo (Secrets) | No stated developer limit | Everything in Free + SSO, dedicated support |
| Enterprise | Custom | Unlimited repos and contributors | On-prem SCM support, custom CI/CD, dedicated infrastructure |
Semgrep prices per contributor, defined as anyone who committed to a private repo in the last 90 days.
SonarQube pricing tiers
| Tier | Price | Key Inclusions |
|---|---|---|
| Community Build | Free (open source, LGPL-3.0) | ~20 languages, main-branch only, no taint analysis, no PR decoration |
| Developer | From $720/yr (100K LOC) | 34 languages, branch/PR analysis, taint analysis, secrets detection |
| Enterprise | Custom (~$20K+ starting) | 40 languages, parallel processing, portfolios, security reports, Advanced Security add-on |
| Data Center | Custom | High availability, autoscaling, distributed architecture |
SonarQube prices per instance per year based on lines of code (LOC). The LOC count is the sum of the largest branch across all projects, excluding blanks, comments, and test code. This means unlimited users, projects, and scans at any tier. Adding developers costs nothing with SonarQube. With Semgrep, every new hire increases the bill.
What teams actually pay
Semgrep (from Vendr, based on 41 verified purchases): Median annual contract $58,800/year. Range: $20,000-$193,200/year. Average discount: 29%. Spendflo reports $0-$10,000/year for smaller deployments.
SonarQube (from Vendr and practitioner reports): Developer Edition at 500K LOC is roughly $2,500/year. Enterprise at 5M LOC: approximately $35,700 list price, with 39-46% discounts achievable, bringing effective cost to ~$19,000-$25,000/year. Multi-year Enterprise contracts can achieve 73-78% discounts. Data Center Edition starts at ~$130,000/year.
Hidden costs: SonarQube self-hosting requires provisioning a server and database, ongoing maintenance, and upgrade cycles. Multiple practitioners cite DevOps overhead. Semgrep is SaaS-first with no infrastructure costs, but the per-contributor model can become expensive at scale.
Approximate cost ranges by team size
| Scenario | Semgrep (estimated) | SonarQube (estimated) |
|---|---|---|
| Startup (<20 devs) | Free (up to 10 contributors) or ~$8,400-$16,800/yr (Team, 1 product) | Community Build free; Developer $720-$2,500/yr |
| Mid-market (20-200 devs) | ~$8,400-$84,000/yr (Team, 1-2 products) | Developer $2,500-$10,000/yr; Enterprise $20,000-$35,700/yr |
| Enterprise (200+ devs) | $50,000-$193,000+/yr (custom) | Enterprise $20,000-$70,000/yr + infra costs |
Semgrep's free tier is notably generous for small teams. It includes the Pro engine, cross-file analysis, and all Pro rules for up to 10 contributors and 50 repos. SonarQube's Community Build is free with no LOC or user limits, but lacks taint analysis, branch analysis, and PR decoration, making it inadequate for security use cases.
At scale, SonarQube's LOC-based model becomes significantly cheaper. A team of 200 developers pays the same SonarQube license as a team of 20 on the same codebase.
Enterprise readiness
| Capability | Semgrep | SonarQube |
|---|---|---|
| SSO (SAML) | Team + Enterprise | All editions (via SAML plugin); SCIM provisioning on Enterprise |
| SSO (OIDC) | Yes | Yes (via GitHub, GitLab, Bitbucket, Keycloak) |
| RBAC | Admin and Member roles; Teams for project-level access | Global + project-level permissions; group-based; permission templates; more granular |
| Audit logging | Token creation, scan activity, triage actions | Enterprise: dedicated Audit Logs API; Cloud: 180-day retention |
| Multi-org | Enterprise tier supports multiple deployments with SSO isolation | Portfolio management (Enterprise+) aggregates projects |
| Compliance reporting | OWASP/CWE mapping, SBOM, EPSS, license compliance | OWASP Top 10, CWE Top 25, PCI DSS, STIG, CASA, MISRA C++ 2023 (Enterprise, PDF) |
| Jira integration | Native (beta): create tickets from findings, AI remediation | Via webhooks and community plugins (no confirmed native integration) |
| Slack integration | Native Semgrep Slack app | Via webhooks |
| API | REST API (OpenAPI): deployments, findings, projects, tags | Comprehensive REST API: projects, issues, measures, quality gates, profiles, rules, users. More mature and extensive. |
| Branch analysis | All tiers (including free) | Developer Edition+ only |
| Self-hosted | SaaS-first; code analyzed locally, findings sent to cloud | Core product is self-hosted |
SonarQube's RBAC is more granular than Semgrep's, with group-based permissions, permission templates, and auto-sync with GitHub/GitLab. Semgrep's RBAC is limited to Admin/Member roles with a Teams feature that requires contacting support to enable.
SonarQube's self-hosted model gives organizations full control over data residency and infrastructure. For regulated industries, this can be a decisive advantage. Semgrep is SaaS-first. Enterprise customers can get dedicated infrastructure, but the default model sends findings to the cloud platform.
SonarQube's API is more mature and extensive than Semgrep's, covering nearly every aspect of the system. Semgrep's API is adequate for findings management and project configuration but less comprehensive for system administration.
Known weaknesses
Semgrep: top criticisms from non-vendor sources
-
CE has significant analysis limitations. Single-function taint only. Semgrep's own README acknowledges CE "will miss many true positives." The Doyensec benchmark confirmed a 50-71% improvement from CE to Pro. The gap between CE and the commercial platform is the primary driver of paid adoption.
-
Monorepo reliability issues. Multiple PeerSpot reviewers report scans that "never complete or finish" on large monorepos, requiring vendor support to "expand the resources in the back end." GitHub issue #10761 documents interfile taint results disappearing with 1,000+ files. Cross-file analysis falls back to single-file mode silently when memory is exceeded.
-
Out-of-the-box noise requires tuning. G2 reviewers report "noisy results with a lot of false positives out-of-the-box, requiring upfront tuning and rule customization." The tool's effectiveness is directly proportional to rule configuration effort.
-
No code quality capabilities. Teams using Semgrep alone cannot track code smells, duplication, test coverage, or technical debt. For organizations that want unified quality and security, Semgrep must be paired with another tool.
-
Rule ecosystem licensing. The Semgrep Rules License v1.0 (introduced December 2024) prevents commercial reuse of Semgrep-maintained rules, creating vendor lock-in. The Opengrep fork (January 2025, 10+ security vendors) was a direct response.
-
SCA is less mature than dedicated tools. Semgrep Supply Chain was not included in the Forrester Wave SCA evaluation. Reachability analysis does not cover transitive dependencies.
-
Business logic vulnerabilities missed. Shared with all SAST tools: no amount of pattern matching catches broken access control, authentication bypasses, or IDOR.
SonarQube: top criticisms from non-vendor sources
-
Security analysis depth is shallow. AppSecSanta (2026): "Security depth lags dedicated SAST tools." The DryRun benchmark found SonarQube detecting only 5/26 seeded vulnerabilities (19%). Community Build entirely lacks taint analysis for injection vulnerabilities.
-
Quality gate misuse by management. A Sonar Community thread titled "Sonar is destroying my job" (discussed on Hacker News with 121 points) describes experienced developers forced to "butcher" code to satisfy rules. A reply: "Managers, who don't understand coding well enough to police it, are now offered SonarQube as a policing tool."
-
Rule lag with modern languages. Kotlin developers report SonarQube rules flagging valid modern syntax (coroutines, import aliasing, extension functions). C++ users report "hundreds of obvious false positives." One devRant post: "SonarQube reduces our code quality through arbitrary nonsense rules."
-
Quality gate gaming. A Hacker News commenter describes a common problem: moving code and tests between files during refactoring causes coverage to drop below thresholds, forcing developers to write "padding" tests to restore percentages.
-
Slow scans and infrastructure overhead. Self-hosted SonarQube requires a server, database, and ongoing maintenance. Scans can take minutes to tens of minutes for large projects. Community Build processes one analysis at a time.
-
Custom rule authoring is prohibitively complex. Requires Java programming and AST knowledge. Most teams toggle built-in rules on/off rather than creating new ones. This limits SonarQube's ability to enforce organization-specific security patterns.
-
Pricing opacity and escalation. A Capterra reviewer (Feb 2025) reported a 3x price increase without approval. LOC-based pricing can escalate unpredictably as codebases grow.
When to pick which
There is no universally correct answer. The right tool depends on what you scan, what you need to customize, and what you can spend.
Semgrep fits best when:
- Security is the primary driver. Teams whose main goal is finding and fixing vulnerabilities will get more from Semgrep's focused security toolchain than SonarQube's broader but shallower security coverage. The DryRun benchmark found Semgrep detecting 2.4x more vulnerabilities than SonarQube with default configs.
- Programmable detection is a priority. Your team writes internal frameworks, has banned APIs, or needs domain-specific rules. Semgrep's YAML rule system is a generation ahead of anything SonarQube offers for custom detection. Bennett et al. demonstrated that custom rules can lift detection from ~14% to ~45%.
- Budget matters for a small team. Semgrep's free tier gives you the Pro engine, cross-file analysis, and all Pro rules for up to 10 contributors. SonarQube's free Community Build has no taint analysis and no branch analysis.
- Scan speed is critical. Semgrep runs locally and completes in seconds on PR scans. SonarQube's client-server architecture adds latency.
- SCA with reachability is needed. Semgrep Supply Chain's reachability analysis across 12+ languages is more mature than SonarQube's newly launched SCA.
SonarQube fits best when:
- Code quality enforcement matters as much as security. Your team needs quality gates blocking PRs on coverage, duplication, and reliability, not only security findings. Semgrep has no code quality capabilities.
- Budget is constrained at scale. LOC-based pricing means 200 developers cost the same as 20 on the same codebase. SonarQube becomes dramatically cheaper at enterprise scale.
- Self-hosted deployment is required. Regulated industries needing full data control benefit from SonarQube's on-premises architecture. Semgrep is SaaS-first.
- Legacy language support is needed. COBOL, ABAP, PL/I, RPG, PL/SQL, and T-SQL are covered at Enterprise tier.
- Management visibility and governance matter. SonarQube's portfolio management, quality gate dashboards, and compliance reporting (OWASP, CWE, STIG, CASA) serve regulated industries and organizations where non-technical stakeholders need visibility.
- Existing SonarQube investment. AppSecSanta notes: "Custom quality profiles, tuned rules, historical trend data, and team workflows built around SonarQube represent significant investment. The cost of migration often outweighs the benefit."
Common scenarios
Early-stage startup (<20 developers): Semgrep's free tier provides substantially more security coverage (SAST with Pro Engine, SCA with reachability, Secrets) than SonarQube Community Build (no taint analysis, no SCA, no branch analysis). Start with Semgrep free. Add SonarQube Community Build for code quality if desired.
Growth-stage company (50-200 developers) with an AppSec team: Semgrep's rule customization lets your AppSec engineers encode institutional knowledge into automated detection. This scales better than manually triaging generic findings. Pair with SonarQube Developer/Enterprise for code quality.
Regulated enterprise (200+ developers): SonarQube Enterprise (self-hosted, $40K-$70K/yr) with Advanced Security add-on provides compliance reporting and data residency control. Add Semgrep for deeper security scanning and custom rules. Many enterprises run both.
Team evaluating a switch from one to the other: The tools are more complementary than competitive. Switching from SonarQube to Semgrep means losing code quality metrics. Switching from Semgrep to SonarQube means losing SCA reachability depth, secrets detection quality, and custom rule simplicity. Most practitioners recommend running both.
Market trajectory
PeerSpot mindshare data (January 2026) shows SonarQube's SAST mindshare declining from 26.3% to 18.8% while Semgrep grew from 1.1% to 2.8%. SonarQube remains far larger in installed base (400,000+ organizations) but Semgrep is growing faster in relative terms. Semgrep was recognized in the 2025 Gartner Magic Quadrant for AST as a Niche Player (first-time inclusion). Sonar was included in the Forrester Wave for SAST Q3 2025.
Bottom line
Semgrep is the stronger security scanner. SonarQube is the stronger code quality enforcement tool. Neither covers what the other does best. The most common practitioner pattern is to run both.
The harder question for both tools is the same: what happens after findings are generated. Both produce noise. Both miss real vulnerabilities. The bottleneck is rarely detection. It's triage: deciding which findings are exploitable, which ones matter in your specific context, and which ones can wait. If that's where your team is stuck, that's the problem Konvu solves.
Related comparisons
- Snyk vs Semgrep: Snyk's SCA platform compared to Semgrep's customizable SAST engine, with independent benchmark data.
- Snyk vs SonarQube: How Snyk's unified security platform compares to SonarQube's code quality enforcement and mature SAST rules.