AI Code Review
code-reviewCorrectness, performance, readability, SOLID and DRY violations, error handling, naming and anti-patterns.
ForgeAI puts eight AI analyzers inside your Jenkins pipeline. They review the code, hunt vulnerabilities, check the architecture, find test gaps, rate dependencies, read your commits and tune your Jenkinsfile. Then one composite score decides whether the build ships.
Inside the forgeAI step
Each analyzer reads only what it needs from the workspace. Release Readiness then weighs every result, the step averages the scores, and your threshold decides the build. Select any box to trace its path.
● Analyzers run in parallel. Source too large for one request is split into parts of up to 60,000 characters, and each analyzer's parts are merged into one 1–10 score and one list of findings.
Analyzers
Each analyzer runs with its own expert system prompt and returns a 1–10 score plus findings with a severity, the file and line, and a concrete fix. Turn any of them off globally in Manage Jenkins.
Correctness, performance, readability, SOLID and DRY violations, error handling, naming and anti-patterns.
OWASP Top 10, hardcoded secrets, injection, path traversal, weak crypto, SSRF and unsafe deserialization, each mapped to a CWE ID.
Works out your intended architecture, then flags layer violations, circular dependencies, god classes and leaking API boundaries.
Finds untested paths, missing boundary and error-case tests, and tests that assert nothing, then describes the tests to add.
Unpinned versions, copyleft license conflicts, unmaintained packages, duplicate libraries and deep transitive trees.
Rates commit message quality and change cohesion, and catches breaking changes that nobody announced.
Reviews your Jenkinsfile for stages that could run in parallel, missing caches, absent timeouts and retries, and unsafe secret handling.
Weighs every other result, security 3× and architecture 2×, into a release verdict and names the issues that should block it.
Quality gate
Set a threshold, drag the scores, then break something. The result and the log lines follow the same rules as the forgeAI step.
Pipelines inherit the global gate settings unless they pass failOnCritical or criticalThreshold. An analyzer that errors or returns unreadable output fails a gated build. It never passes as a neutral score.
Report
Every build that runs ForgeAI gets a ForgeAI Analysis page: the composite score, a verdict, each analyzer's score and every finding with its file, line and suggested fix. The job page charts the composite score across builds, so you can see quality move. Jenkins renders both itself, with no extra plugin. A self-contained HTML report is also written to forgeai-reports/ for archiving.
Every run also writes forgeai-report.sarif, the standard format for static-analysis results. Pass it to the Warnings NG plugin to see each finding against its source line, with trend charts and Warnings NG's own quality gates. GitHub code scanning reads the same file.
recordIssues tool: sarif(
pattern: report.sarifFile,
id: 'forgeai', name: 'ForgeAI')
payments-service • Build #128 • 2026-10-28 14:02:11 UTC
The order lookup appends a request parameter straight into the WHERE clause (CWE-89).
customerId as a parameter.PricingController calculates discounts, so the web layer now owns business logic.
LLM providers
Choose a provider in Manage Jenkins → System. API keys stay in Jenkins credentials as Secret Text, and Test Connection checks the setup before your first build.
OpenAI, plus any server that speaks the same API: LM Studio, vLLM, LocalAI, Groq.
gpt-4oCalls the Messages API directly, with a configurable endpoint for gateways and proxies.
claude-opus-4-7Runs on your own hardware for air-gapped teams. Point it at an Ollama server the Jenkins controller can reach.
codellama:13bLLMProvider is a Jenkins extension point. Ship a provider in its own plugin and it appears in the provider list.
LLMProvider + descriptorPipeline syntax
forgeAI runs the full suite on your workspace. forgeAIScan runs a single analyzer on any text you hand it. Both return values your pipeline can branch on.
stage('ForgeAI') {
steps {
script {
def report = forgeAI(
analyzers: ['code-review', 'vulnerability', 'architecture-drift',
'test-gaps', 'dependency-risk', 'commit-intel',
'pipeline-advisor', 'release-readiness'],
sourceGlob: 'src/main/java/**/*.java',
contextInfo: 'Spring Boot service, hexagonal architecture',
failOnCritical: true,
criticalThreshold: 6
)
echo "Composite: ${report.compositeScore}/10"
echo "Security: ${report.vulnerabilityScore}/10"
recordIssues tool: sarif(pattern: report.sarifFile,
id: 'forgeai', name: 'ForgeAI')
}
}
post {
always {
archiveArtifacts artifacts: 'forgeai-reports/**', allowEmptyArchive: true
}
}
}
// On a multibranch pull-request build, scope 'auto' (the default)
// analyzes only the files the PR changed, compared with its target branch.
script {
def report = forgeAI(analyzers: ['code-review', 'vulnerability', 'test-gaps'],
sourceGlob: 'src/**/*.java')
echo "Analyzed ${report.filesAnalyzed} file(s), scope: ${report.analysisScope}"
}
// Compare with a ref of your choice instead:
// forgeAI(scope: 'changes', baseRef: 'origin/release-2.x', ...)
// Always analyze every matching file:
// forgeAI(scope: 'all', ...)
script {
def sec = forgeAIScan(
analyzer: 'vulnerability',
source: readFile('src/main/java/com/acme/pay/OrderRepository.java'),
context: 'Java 17 REST API that stores card holder data'
)
echo "Security ${sec.score}/10 (${sec.severity}): ${sec.summary}"
if (sec.criticalCount > 0) {
unstable("${sec.criticalCount} critical vulnerabilities")
}
}
// Manage Jenkins → System → ForgeAI Pipeline Intelligence
// Provider: Ollama (Local)
// Endpoint: http://ollama.internal:11434 (reachable from the controller)
// Model: codellama:13b
pipeline {
agent any
stages {
stage('ForgeAI') {
steps {
script {
def r = forgeAI(analyzers: ['code-review', 'vulnerability', 'test-gaps'],
sourceGlob: 'src/**/*.py',
contextInfo: 'FastAPI service, air-gapped network')
echo "Composite: ${r.compositeScore}/10"
}
}
}
}
}
forgeAI returnschanges or all, with filesAnalyzed and filesSkippedrecordIssuesreport['code-reviewScore']forgeAIScan returnsGet started
In Manage Jenkins → Plugins → Available plugins, search for ForgeAI Pipeline Intelligence and install it. Needs Jenkins 2.528.3 or newer.
Open Manage Jenkins → System → ForgeAI Pipeline Intelligence. Pick a provider, choose the Secret Text credential with your API key, and click Test Connection.
Call forgeAI in any stage that has a workspace. The report lands in forgeai-reports/.
forgeAI analyzers: ['code-review', 'vulnerability']
Want to see it first? The Docker quickstart starts Jenkins, ForgeAI and a local Ollama model with one docker compose up. No API key, and nothing leaves your machine.
ForgeAI was designed and built in collaboration with Claude, Anthropic's AI assistant, from the provider abstraction to every analyzer prompt. Meet Claude
Free and open source under the MIT License. Install it from the Jenkins Update Center in a minute.