# Code Analysis

## Get code analysis for a branch

> Retrieves code analysis results for a specific repository branch.\
> \
> \*\*Three-state response pattern:\*\*\
> \- \`available\`: Analysis data exists and is returned in the \`data\` field\
> \- \`pending\`: No data exists; a new analysis has been triggered. Poll using the returned \`jobId\`\
> \- \`error\`: An error occurred (e.g., project not found)\
> \
> \*\*Auto-trigger behavior:\*\*\
> \- If no analysis exists, automatically triggers a workflow to run the analysis\
> \- Creates a daily schedule (3 AM UTC) for the project if one doesn't exist\
> \
> \*\*Tools used:\*\* Salesforce Code Analyzer (PMD, ESLint, regex, retire-js, cpd)

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CodeAnalysisResponseDto":{"type":"object","properties":{"status":{"type":"string","description":"Response status indicating data availability","enum":["available","pending","error"]},"data":{"description":"Analysis data (present only when status is \"available\")","allOf":[{"$ref":"#/components/schemas/CodeAnalysisResultDto"}]},"jobId":{"type":"string","description":"Task execution ID for tracking (present when status is \"pending\")"},"message":{"type":"string","description":"Human-readable status message or error description"}},"required":["status"]},"CodeAnalysisResultDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in org/repo format"},"branch":{"type":"string","description":"Git branch name that was analyzed"},"commitId":{"type":"string","description":"Full Git commit SHA that was analyzed (used as document key)"},"analyzedAt":{"type":"string","description":"Timestamp when analysis was performed (ISO 8601 format)","format":"date-time"},"duration":{"type":"number","description":"Total analysis duration in seconds (clone + analyze + store)","minimum":0},"summary":{"description":"Pre-computed summary extracted from SARIF for quick dashboard access","allOf":[{"$ref":"#/components/schemas/CodeAnalysisSummaryDto"}]},"metadata":{"description":"Metadata about how the analysis was triggered","allOf":[{"$ref":"#/components/schemas/CodeAnalysisMetadataDto"}]},"sarif":{"type":"object","description":"Full SARIF 2.1.0 document (only included in detail views, omitted in lists)"}},"required":["repositoryIdentifier","branch","commitId","analyzedAt","duration","summary","metadata"]},"CodeAnalysisSummaryDto":{"type":"object","properties":{"totalIssues":{"type":"number","description":"Total number of issues found across all tools and severity levels","minimum":0},"issuesByLevel":{"description":"Issue counts grouped by SARIF severity level","allOf":[{"$ref":"#/components/schemas/IssuesByLevelDto"}]},"issuesByRule":{"description":"Top 10 rules by issue count, sorted descending","type":"array","items":{"$ref":"#/components/schemas/RuleSummaryDto"}},"toolsUsed":{"description":"List of analysis tools that produced results","type":"array","items":{"$ref":"#/components/schemas/ToolInfoDto"}},"filesAffected":{"type":"number","description":"Number of unique files that have at least one issue","minimum":0},"analysisSuccessful":{"type":"boolean","description":"Whether all tool invocations completed successfully (from SARIF invocations)"}},"required":["totalIssues","issuesByLevel","issuesByRule","toolsUsed","filesAffected","analysisSuccessful"]},"IssuesByLevelDto":{"type":"object","properties":{"error":{"type":"number","description":"Critical issues that must be fixed (security vulnerabilities, potential bugs)","minimum":0},"warning":{"type":"number","description":"Issues that should be addressed (code quality, best practices)","minimum":0},"note":{"type":"number","description":"Informational issues (style suggestions, minor improvements)","minimum":0},"none":{"type":"number","description":"Issues without a specified severity level","minimum":0}},"required":["error","warning","note","none"]},"RuleSummaryDto":{"type":"object","properties":{"ruleId":{"type":"string","description":"Unique rule identifier from the analysis tool"},"ruleName":{"type":"string","description":"Human-readable rule name or short description"},"count":{"type":"number","description":"Total number of violations found for this rule","minimum":0},"level":{"type":"string","description":"SARIF severity level for this rule","enum":["error","warning","note","none"]}},"required":["ruleId","count","level"]},"ToolInfoDto":{"type":"object","properties":{"name":{"type":"string","description":"Tool name as reported in SARIF (e.g., code-analyzer, pmd, eslint)"},"version":{"type":"string","description":"Tool version as reported in SARIF"}},"required":["name"]},"CodeAnalysisMetadataDto":{"type":"object","properties":{"triggeredBy":{"type":"string","enum":["schedule","manual","webhook"],"description":"Trigger source: schedule (daily cron), manual (API call), or webhook (CI/CD)"},"scheduledRun":{"type":"boolean","description":"Whether this analysis was triggered by the scheduled cron job"},"tools":{"description":"Analysis tools that produced results (e.g., code-analyzer, pmd, eslint)","type":"array","items":{"type":"string"}}}}}},"paths":{"/sfp/api/testreports/code-analysis":{"get":{"operationId":"CodeAnalysisController_getAnalysis","summary":"Get code analysis for a branch","description":"Retrieves code analysis results for a specific repository branch.\n\n**Three-state response pattern:**\n- `available`: Analysis data exists and is returned in the `data` field\n- `pending`: No data exists; a new analysis has been triggered. Poll using the returned `jobId`\n- `error`: An error occurred (e.g., project not found)\n\n**Auto-trigger behavior:**\n- If no analysis exists, automatically triggers a workflow to run the analysis\n- Creates a daily schedule (3 AM UTC) for the project if one doesn't exist\n\n**Tools used:** Salesforce Code Analyzer (PMD, ESLint, regex, retire-js, cpd)","parameters":[{"name":"repositoryIdentifier","required":true,"in":"query","description":"Repository identifier in org/repo format","schema":{"type":"string"}},{"name":"branch","required":true,"in":"query","description":"Git branch name to get analysis for","schema":{"type":"string"}},{"name":"commitId","required":false,"in":"query","description":"Specific commit SHA. If omitted, returns the latest analyzed commit.","schema":{"type":"string"}}],"responses":{"200":{"description":"Analysis data or pending/error status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeAnalysisResponseDto"}}}},"400":{"description":"Missing required query parameters"},"401":{"description":"Unauthorized - invalid or missing token"},"403":{"description":"Forbidden - Requires role: member, owner, application"}},"tags":["Code Analysis"]}}}}
```

## Force refresh code analysis

> Triggers a new code analysis regardless of whether data already exists.\
> \
> \*\*Behavior:\*\*\
> \- If \`branch\` is specified: Analyzes only that branch\
> \- If \`branch\` is omitted: Analyzes all branches configured in the project's \`configuration.branches\` (defaults to \`\["main"]\`)\
> \
> \*\*Returns:\*\* A pending response with a task execution ID to track progress.\
> \
> \*\*Use cases:\*\*\
> \- Force re-analysis after code changes\
> \- Trigger analysis for all branches at once

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CodeAnalysisResponseDto":{"type":"object","properties":{"status":{"type":"string","description":"Response status indicating data availability","enum":["available","pending","error"]},"data":{"description":"Analysis data (present only when status is \"available\")","allOf":[{"$ref":"#/components/schemas/CodeAnalysisResultDto"}]},"jobId":{"type":"string","description":"Task execution ID for tracking (present when status is \"pending\")"},"message":{"type":"string","description":"Human-readable status message or error description"}},"required":["status"]},"CodeAnalysisResultDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in org/repo format"},"branch":{"type":"string","description":"Git branch name that was analyzed"},"commitId":{"type":"string","description":"Full Git commit SHA that was analyzed (used as document key)"},"analyzedAt":{"type":"string","description":"Timestamp when analysis was performed (ISO 8601 format)","format":"date-time"},"duration":{"type":"number","description":"Total analysis duration in seconds (clone + analyze + store)","minimum":0},"summary":{"description":"Pre-computed summary extracted from SARIF for quick dashboard access","allOf":[{"$ref":"#/components/schemas/CodeAnalysisSummaryDto"}]},"metadata":{"description":"Metadata about how the analysis was triggered","allOf":[{"$ref":"#/components/schemas/CodeAnalysisMetadataDto"}]},"sarif":{"type":"object","description":"Full SARIF 2.1.0 document (only included in detail views, omitted in lists)"}},"required":["repositoryIdentifier","branch","commitId","analyzedAt","duration","summary","metadata"]},"CodeAnalysisSummaryDto":{"type":"object","properties":{"totalIssues":{"type":"number","description":"Total number of issues found across all tools and severity levels","minimum":0},"issuesByLevel":{"description":"Issue counts grouped by SARIF severity level","allOf":[{"$ref":"#/components/schemas/IssuesByLevelDto"}]},"issuesByRule":{"description":"Top 10 rules by issue count, sorted descending","type":"array","items":{"$ref":"#/components/schemas/RuleSummaryDto"}},"toolsUsed":{"description":"List of analysis tools that produced results","type":"array","items":{"$ref":"#/components/schemas/ToolInfoDto"}},"filesAffected":{"type":"number","description":"Number of unique files that have at least one issue","minimum":0},"analysisSuccessful":{"type":"boolean","description":"Whether all tool invocations completed successfully (from SARIF invocations)"}},"required":["totalIssues","issuesByLevel","issuesByRule","toolsUsed","filesAffected","analysisSuccessful"]},"IssuesByLevelDto":{"type":"object","properties":{"error":{"type":"number","description":"Critical issues that must be fixed (security vulnerabilities, potential bugs)","minimum":0},"warning":{"type":"number","description":"Issues that should be addressed (code quality, best practices)","minimum":0},"note":{"type":"number","description":"Informational issues (style suggestions, minor improvements)","minimum":0},"none":{"type":"number","description":"Issues without a specified severity level","minimum":0}},"required":["error","warning","note","none"]},"RuleSummaryDto":{"type":"object","properties":{"ruleId":{"type":"string","description":"Unique rule identifier from the analysis tool"},"ruleName":{"type":"string","description":"Human-readable rule name or short description"},"count":{"type":"number","description":"Total number of violations found for this rule","minimum":0},"level":{"type":"string","description":"SARIF severity level for this rule","enum":["error","warning","note","none"]}},"required":["ruleId","count","level"]},"ToolInfoDto":{"type":"object","properties":{"name":{"type":"string","description":"Tool name as reported in SARIF (e.g., code-analyzer, pmd, eslint)"},"version":{"type":"string","description":"Tool version as reported in SARIF"}},"required":["name"]},"CodeAnalysisMetadataDto":{"type":"object","properties":{"triggeredBy":{"type":"string","enum":["schedule","manual","webhook"],"description":"Trigger source: schedule (daily cron), manual (API call), or webhook (CI/CD)"},"scheduledRun":{"type":"boolean","description":"Whether this analysis was triggered by the scheduled cron job"},"tools":{"description":"Analysis tools that produced results (e.g., code-analyzer, pmd, eslint)","type":"array","items":{"type":"string"}}}}}},"paths":{"/sfp/api/testreports/code-analysis/refresh":{"post":{"operationId":"CodeAnalysisController_refreshAnalysis","summary":"Force refresh code analysis","description":"Triggers a new code analysis regardless of whether data already exists.\n\n**Behavior:**\n- If `branch` is specified: Analyzes only that branch\n- If `branch` is omitted: Analyzes all branches configured in the project's `configuration.branches` (defaults to `[\"main\"]`)\n\n**Returns:** A pending response with a task execution ID to track progress.\n\n**Use cases:**\n- Force re-analysis after code changes\n- Trigger analysis for all branches at once","parameters":[{"name":"repositoryIdentifier","required":true,"in":"query","description":"Repository identifier in org/repo format","schema":{"type":"string"}},{"name":"branch","required":false,"in":"query","description":"Specific branch to analyze. If omitted, analyzes all configured branches.","schema":{"type":"string"}}],"responses":{"200":{"description":"Analysis refresh triggered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CodeAnalysisResponseDto"}}}},"400":{"description":"Missing required query parameters"},"401":{"description":"Unauthorized - invalid or missing token"},"403":{"description":"Forbidden - Requires role: member, owner, application"},"404":{"description":"Project not found"}},"tags":["Code Analysis"]}}}}
```

## Store code analysis results

> Stores SARIF analysis results from an external source (typically Hatchet workflows).\
> \
> \*\*Duplicate handling:\*\* If results already exist for the given commit, the request is ignored (same commit = same results).\
> \
> \*\*Data processing:\*\*\
> \- Extracts summary metrics from SARIF (issues by severity, by rule, files affected)\
> \- Applies retention policy (keeps last 10 runs per branch)\
> \
> \*\*Note:\*\* This endpoint is primarily used by Hatchet workflows, not direct API consumers.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CreateCodeAnalysisResultDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in org/repo format"},"branch":{"type":"string","description":"Git branch name"},"commitId":{"type":"string","description":"Git commit SHA"},"analyzedAt":{"type":"string","description":"Analysis timestamp in ISO 8601 format"},"duration":{"type":"number","description":"Analysis duration in seconds"},"sarif":{"type":"object","description":"Raw SARIF 2.1.0 document from code analyzer"},"metadata":{"description":"Analysis metadata","allOf":[{"$ref":"#/components/schemas/CodeAnalysisMetadataDto"}]}},"required":["repositoryIdentifier","branch","commitId","analyzedAt","duration","sarif"]},"CodeAnalysisMetadataDto":{"type":"object","properties":{"triggeredBy":{"type":"string","enum":["schedule","manual","webhook"],"description":"Trigger source: schedule (daily cron), manual (API call), or webhook (CI/CD)"},"scheduledRun":{"type":"boolean","description":"Whether this analysis was triggered by the scheduled cron job"},"tools":{"description":"Analysis tools that produced results (e.g., code-analyzer, pmd, eslint)","type":"array","items":{"type":"string"}}}},"StoreResultSuccessDto":{"type":"object","properties":{"success":{"type":"boolean","description":"Indicates whether the operation completed successfully"}},"required":["success"]}}},"paths":{"/sfp/api/testreports/code-analysis/results":{"post":{"operationId":"CodeAnalysisController_storeResult","summary":"Store code analysis results","description":"Stores SARIF analysis results from an external source (typically Hatchet workflows).\n\n**Duplicate handling:** If results already exist for the given commit, the request is ignored (same commit = same results).\n\n**Data processing:**\n- Extracts summary metrics from SARIF (issues by severity, by rule, files affected)\n- Applies retention policy (keeps last 10 runs per branch)\n\n**Note:** This endpoint is primarily used by Hatchet workflows, not direct API consumers.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCodeAnalysisResultDto"}}}},"responses":{"201":{"description":"Result stored successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StoreResultSuccessDto"}}}},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized - invalid or missing token"},"403":{"description":"Forbidden - Requires role: owner, application"}},"tags":["Code Analysis"]}}}}
```

## Get analysis history for a branch

> Returns the last N analysis runs for a specific branch, ordered by analysis date (newest first).\
> \
> \*\*Use cases:\*\*\
> \- Display trend charts\
> \- Compare analysis results over time\
> \- Track code quality improvements

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"CodeAnalysisResultDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in org/repo format"},"branch":{"type":"string","description":"Git branch name that was analyzed"},"commitId":{"type":"string","description":"Full Git commit SHA that was analyzed (used as document key)"},"analyzedAt":{"type":"string","description":"Timestamp when analysis was performed (ISO 8601 format)","format":"date-time"},"duration":{"type":"number","description":"Total analysis duration in seconds (clone + analyze + store)","minimum":0},"summary":{"description":"Pre-computed summary extracted from SARIF for quick dashboard access","allOf":[{"$ref":"#/components/schemas/CodeAnalysisSummaryDto"}]},"metadata":{"description":"Metadata about how the analysis was triggered","allOf":[{"$ref":"#/components/schemas/CodeAnalysisMetadataDto"}]},"sarif":{"type":"object","description":"Full SARIF 2.1.0 document (only included in detail views, omitted in lists)"}},"required":["repositoryIdentifier","branch","commitId","analyzedAt","duration","summary","metadata"]},"CodeAnalysisSummaryDto":{"type":"object","properties":{"totalIssues":{"type":"number","description":"Total number of issues found across all tools and severity levels","minimum":0},"issuesByLevel":{"description":"Issue counts grouped by SARIF severity level","allOf":[{"$ref":"#/components/schemas/IssuesByLevelDto"}]},"issuesByRule":{"description":"Top 10 rules by issue count, sorted descending","type":"array","items":{"$ref":"#/components/schemas/RuleSummaryDto"}},"toolsUsed":{"description":"List of analysis tools that produced results","type":"array","items":{"$ref":"#/components/schemas/ToolInfoDto"}},"filesAffected":{"type":"number","description":"Number of unique files that have at least one issue","minimum":0},"analysisSuccessful":{"type":"boolean","description":"Whether all tool invocations completed successfully (from SARIF invocations)"}},"required":["totalIssues","issuesByLevel","issuesByRule","toolsUsed","filesAffected","analysisSuccessful"]},"IssuesByLevelDto":{"type":"object","properties":{"error":{"type":"number","description":"Critical issues that must be fixed (security vulnerabilities, potential bugs)","minimum":0},"warning":{"type":"number","description":"Issues that should be addressed (code quality, best practices)","minimum":0},"note":{"type":"number","description":"Informational issues (style suggestions, minor improvements)","minimum":0},"none":{"type":"number","description":"Issues without a specified severity level","minimum":0}},"required":["error","warning","note","none"]},"RuleSummaryDto":{"type":"object","properties":{"ruleId":{"type":"string","description":"Unique rule identifier from the analysis tool"},"ruleName":{"type":"string","description":"Human-readable rule name or short description"},"count":{"type":"number","description":"Total number of violations found for this rule","minimum":0},"level":{"type":"string","description":"SARIF severity level for this rule","enum":["error","warning","note","none"]}},"required":["ruleId","count","level"]},"ToolInfoDto":{"type":"object","properties":{"name":{"type":"string","description":"Tool name as reported in SARIF (e.g., code-analyzer, pmd, eslint)"},"version":{"type":"string","description":"Tool version as reported in SARIF"}},"required":["name"]},"CodeAnalysisMetadataDto":{"type":"object","properties":{"triggeredBy":{"type":"string","enum":["schedule","manual","webhook"],"description":"Trigger source: schedule (daily cron), manual (API call), or webhook (CI/CD)"},"scheduledRun":{"type":"boolean","description":"Whether this analysis was triggered by the scheduled cron job"},"tools":{"description":"Analysis tools that produced results (e.g., code-analyzer, pmd, eslint)","type":"array","items":{"type":"string"}}}}}},"paths":{"/sfp/api/testreports/code-analysis/history/{branch}":{"get":{"operationId":"CodeAnalysisController_getHistory","summary":"Get analysis history for a branch","description":"Returns the last N analysis runs for a specific branch, ordered by analysis date (newest first).\n\n**Use cases:**\n- Display trend charts\n- Compare analysis results over time\n- Track code quality improvements","parameters":[{"name":"branch","required":true,"in":"path","description":"Git branch name","schema":{"type":"string"}},{"name":"repositoryIdentifier","required":true,"in":"query","description":"Repository identifier in org/repo format","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"Maximum number of results (default: 10, max: 100)","schema":{"type":"number"}}],"responses":{"200":{"description":"Analysis history for the branch","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CodeAnalysisResultDto"}}}}},"400":{"description":"Missing required query parameters"},"401":{"description":"Unauthorized - invalid or missing token"},"403":{"description":"Forbidden - Requires role: member, owner, application"}},"tags":["Code Analysis"]}}}}
```

## Get branch dashboard with trends

> Returns a comprehensive dashboard view for a specific branch including:\
> \
> \- \*\*Latest analysis:\*\* Full analysis result with summary\
> \- \*\*History:\*\* Last 10 analysis runs (for trend charts)\
> \- \*\*Trends:\*\* Issue count trend direction (up/down/stable)\
> \
> \*\*Trend calculation:\*\* Compares average issues in the last 3 runs vs previous 3 runs.

```json
{"openapi":"3.0.0","info":{"title":"sfp server","version":"51.3.0"},"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"JWT","type":"http","in":"header"}},"schemas":{"BranchDashboardDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in org/repo format"},"branch":{"type":"string","description":"Git branch name"},"latestAnalysis":{"description":"Most recent analysis result (null if branch has never been analyzed)","nullable":true,"allOf":[{"$ref":"#/components/schemas/CodeAnalysisResultDto"}]},"history":{"description":"Last 10 analysis runs for trend visualization (newest first)","type":"array","items":{"$ref":"#/components/schemas/AnalysisHistoryPointDto"}},"trends":{"description":"Calculated trend indicators based on recent analysis runs","allOf":[{"$ref":"#/components/schemas/TrendsDto"}]}},"required":["repositoryIdentifier","branch","history","trends"]},"CodeAnalysisResultDto":{"type":"object","properties":{"repositoryIdentifier":{"type":"string","description":"Repository identifier in org/repo format"},"branch":{"type":"string","description":"Git branch name that was analyzed"},"commitId":{"type":"string","description":"Full Git commit SHA that was analyzed (used as document key)"},"analyzedAt":{"type":"string","description":"Timestamp when analysis was performed (ISO 8601 format)","format":"date-time"},"duration":{"type":"number","description":"Total analysis duration in seconds (clone + analyze + store)","minimum":0},"summary":{"description":"Pre-computed summary extracted from SARIF for quick dashboard access","allOf":[{"$ref":"#/components/schemas/CodeAnalysisSummaryDto"}]},"metadata":{"description":"Metadata about how the analysis was triggered","allOf":[{"$ref":"#/components/schemas/CodeAnalysisMetadataDto"}]},"sarif":{"type":"object","description":"Full SARIF 2.1.0 document (only included in detail views, omitted in lists)"}},"required":["repositoryIdentifier","branch","commitId","analyzedAt","duration","summary","metadata"]},"CodeAnalysisSummaryDto":{"type":"object","properties":{"totalIssues":{"type":"number","description":"Total number of issues found across all tools and severity levels","minimum":0},"issuesByLevel":{"description":"Issue counts grouped by SARIF severity level","allOf":[{"$ref":"#/components/schemas/IssuesByLevelDto"}]},"issuesByRule":{"description":"Top 10 rules by issue count, sorted descending","type":"array","items":{"$ref":"#/components/schemas/RuleSummaryDto"}},"toolsUsed":{"description":"List of analysis tools that produced results","type":"array","items":{"$ref":"#/components/schemas/ToolInfoDto"}},"filesAffected":{"type":"number","description":"Number of unique files that have at least one issue","minimum":0},"analysisSuccessful":{"type":"boolean","description":"Whether all tool invocations completed successfully (from SARIF invocations)"}},"required":["totalIssues","issuesByLevel","issuesByRule","toolsUsed","filesAffected","analysisSuccessful"]},"IssuesByLevelDto":{"type":"object","properties":{"error":{"type":"number","description":"Critical issues that must be fixed (security vulnerabilities, potential bugs)","minimum":0},"warning":{"type":"number","description":"Issues that should be addressed (code quality, best practices)","minimum":0},"note":{"type":"number","description":"Informational issues (style suggestions, minor improvements)","minimum":0},"none":{"type":"number","description":"Issues without a specified severity level","minimum":0}},"required":["error","warning","note","none"]},"RuleSummaryDto":{"type":"object","properties":{"ruleId":{"type":"string","description":"Unique rule identifier from the analysis tool"},"ruleName":{"type":"string","description":"Human-readable rule name or short description"},"count":{"type":"number","description":"Total number of violations found for this rule","minimum":0},"level":{"type":"string","description":"SARIF severity level for this rule","enum":["error","warning","note","none"]}},"required":["ruleId","count","level"]},"ToolInfoDto":{"type":"object","properties":{"name":{"type":"string","description":"Tool name as reported in SARIF (e.g., code-analyzer, pmd, eslint)"},"version":{"type":"string","description":"Tool version as reported in SARIF"}},"required":["name"]},"CodeAnalysisMetadataDto":{"type":"object","properties":{"triggeredBy":{"type":"string","enum":["schedule","manual","webhook"],"description":"Trigger source: schedule (daily cron), manual (API call), or webhook (CI/CD)"},"scheduledRun":{"type":"boolean","description":"Whether this analysis was triggered by the scheduled cron job"},"tools":{"description":"Analysis tools that produced results (e.g., code-analyzer, pmd, eslint)","type":"array","items":{"type":"string"}}}},"AnalysisHistoryPointDto":{"type":"object","properties":{"commitId":{"type":"string","description":"Git commit SHA (may be truncated for display purposes)"},"analyzedAt":{"type":"string","description":"Analysis timestamp (ISO 8601 format)","format":"date-time"},"totalIssues":{"type":"number","description":"Total issue count at this analysis point","minimum":0},"errors":{"type":"number","description":"Error-level issue count at this point","minimum":0},"warnings":{"type":"number","description":"Warning-level issue count at this point","minimum":0}},"required":["commitId","analyzedAt","totalIssues","errors","warnings"]},"TrendsDto":{"type":"object","properties":{"issuesTrend":{"type":"string","description":"Issue count trend: up (more issues), down (fewer issues), stable (within threshold of 2)","enum":["up","down","stable"]}},"required":["issuesTrend"]}}},"paths":{"/sfp/api/testreports/code-analysis/dashboard/{branch}":{"get":{"operationId":"CodeAnalysisController_getBranchDashboard","summary":"Get branch dashboard with trends","description":"Returns a comprehensive dashboard view for a specific branch including:\n\n- **Latest analysis:** Full analysis result with summary\n- **History:** Last 10 analysis runs (for trend charts)\n- **Trends:** Issue count trend direction (up/down/stable)\n\n**Trend calculation:** Compares average issues in the last 3 runs vs previous 3 runs.","parameters":[{"name":"branch","required":true,"in":"path","description":"Git branch name","schema":{"type":"string"}},{"name":"repositoryIdentifier","required":true,"in":"query","description":"Repository identifier in org/repo format","schema":{"type":"string"}}],"responses":{"200":{"description":"Branch dashboard with latest analysis, history, and trends","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchDashboardDto"}}}},"400":{"description":"Missing required query parameters"},"401":{"description":"Unauthorized - invalid or missing token"},"403":{"description":"Forbidden - Requires role: member, owner, application"}},"tags":["Code Analysis"]}}}}
```
