1. DeepSource Analysis Not Running
Understanding the Issue
DeepSource fails to trigger an analysis for a repository, preventing code quality checks.
Root Causes
- Repository not linked to DeepSource.
- Missing
.deepsource.toml
configuration file. - Branch restrictions preventing analysis on certain branches.
Fix
Ensure the repository is linked to DeepSource:
1. Go to DeepSource dashboard. 2. Verify that the repository appears under "Your Repositories".
Check if the .deepsource.toml
file exists at the repository root:
ls -la .deepsource.toml
Manually trigger an analysis if needed:
git commit --allow-empty -m "Trigger DeepSource analysis" git push origin main
2. DeepSource Failing to Analyze Code
Understanding the Issue
DeepSource fails to complete analysis, often showing errors in logs.
Root Causes
- Invalid syntax in the
.deepsource.toml
file. - Unsupported programming language or framework.
- Conflicting configurations with CI/CD tools.
Fix
Validate the .deepsource.toml
file syntax:
deepsource config validate
Ensure the project’s language is supported by DeepSource:
Check supported languages on https://deepsource.io/docs/
Review CI/CD settings to avoid conflicts:
Disable duplicate linting steps in GitHub Actions, GitLab CI/CD, or Jenkins.
3. False Positives in DeepSource Reports
Understanding the Issue
DeepSource flags issues that may not be actual problems in the codebase.
Root Causes
- Overly strict rules configured in
.deepsource.toml
. - Custom logic in the code not accounted for by static analysis.
- Incorrect language-specific settings.
Fix
Suppress specific false positives using DeepSource directives:
# skipcq: PYL-R0913
Modify rule severity in .deepsource.toml
:
[[analyzers]] name = "python" ignore_patterns = ["migrations/**"]
Report false positives to DeepSource:
Click "Report as False Positive" in the DeepSource dashboard.
4. DeepSource Not Integrating with CI/CD Pipelines
Understanding the Issue
DeepSource does not run as expected in CI/CD environments.
Root Causes
- DeepSource not configured as a required check.
- Incorrect API token usage in pipeline scripts.
- Conflict with other linters running in CI.
Fix
Ensure DeepSource is a required check in GitHub:
1. Go to Repository Settings > Branch Protection. 2. Add "DeepSource Analysis" as a required check.
Verify API token setup in CI/CD scripts:
export DEEPSOURCE_DSN="your-api-token"
Disable redundant linters in CI/CD:
Comment out unnecessary linting steps in pipeline scripts.
5. DeepSource Not Detecting Security Issues
Understanding the Issue
DeepSource does not flag security vulnerabilities in the codebase.
Root Causes
- Security analyzer not enabled in
.deepsource.toml
. - Insufficient scanning depth configured.
- Project dependencies not being analyzed.
Fix
Enable security analyzer in .deepsource.toml
:
[[analyzers]] name = "security" enabled = true
Increase analysis depth if needed:
depth = "deep"
Ensure dependency scanning is enabled:
Enable "Dependency Analysis" in the DeepSource dashboard.
Conclusion
DeepSource is a powerful tool for improving code quality, but troubleshooting repository integration, analysis failures, false positives, CI/CD integration, and security issue detection is essential for maximizing its benefits. By optimizing configurations, refining rule settings, and ensuring proper CI/CD setup, developers can streamline their static analysis workflows.
FAQs
1. Why is DeepSource not running on my repository?
Ensure the repository is linked, check for the .deepsource.toml
file, and manually trigger an analysis.
2. How do I fix DeepSource analysis failures?
Validate .deepsource.toml
, ensure the project language is supported, and check CI/CD configurations.
3. Why is DeepSource reporting false positives?
Modify rule severity, suppress specific issues, and report incorrect detections in the dashboard.
4. How do I integrate DeepSource with CI/CD pipelines?
Configure it as a required check, verify API token setup, and disable redundant linters.
5. How do I enable security scanning in DeepSource?
Enable the security analyzer in .deepsource.toml
, increase scanning depth, and verify dependency analysis settings.