| name | plugin-code-review |
| description | Code quality review for Black Duck Security Scan Jenkins Plugin. Audit patterns, test coverage, exception handling, Jackson/LoggerWrapper usage, and architecture alignment. Use when user asks to review code, a PR, or a diff in this plugin repo — especially when changes touch service/, extension/, or global/ code. Triggered via /plugin-code-review. Do NOT use the generic code-review skill for this repo; use this one instead. |
| compatibility | Jenkins 2.492.3+ |
Black Duck Plugin — Code Review
Correctness and pattern audit for this Jenkins plugin repo only. NOT for security — use /plugin-security-review for credential/injection/masking issues.
What to Check
1. Pattern Adherence
Service Layer (service/):
Jackson JSON Serialization (everywhere):
Logging (LoggerWrapper):
Exception Handling:
FilePath Usage (Jenkins standard):
2. Test Coverage
Check tests match production code:
Excluded from coverage (expected, don't test):
- Extension classes (
extension/, extension/freestyle/, extension/pipeline/)
SecurityScanner, SCMRepositoryService (complex orchestration, hard to mock)
- Input classes (POJOs)
3. Enum & Config Classes
4. Parameter Flow
Trace scanParams map from UI config → CLI args:
5. Report Handling (UploadReportService, IssueCalculator)
6. SCM Integration (service/scm/)
7. Code Style & Naming
8. Spotless Compliance
Common Findings
| Issue | Fix |
|---|
| New service has no test class | Add FooServiceTest.java in src/test/java/ |
Logging with raw TaskListener | Use LoggerWrapper.getLogger() |
| Parameter built via string concat | Use Jackson ObjectMapper + POJO |
| Exception caught silently | Either log + rethrow, or document why silent |
File operations on File in multi-agent job | Replace with FilePath |
Hardcoded /tmp path | Use Jenkins temp dir: workspace.tmp/ |
| Large if-else for product logic | Consider SecurityProduct enum switch |
| New product enum added, but ParameterMappingService unchanged | Add product-specific mappings to ParameterMappingService |
Review Flow
- Read PR diff
- Identify changed files (service/, extension/, global/)
- Check patterns above for each file
- Output one-liner findings:
file:line: issue. fix.
Example Findings
service/ToolsParametersService.java:47: URL built via string concat, use Jackson POJO.
extension/freestyle/FooBuilder.java:23: No corresponding test class FooBuilderTest.java.
global/Utility.java:100: Raw TaskListener log, use LoggerWrapper.
service/scm/GitService.java:15: File operations, use FilePath for agent safety.
Do NOT Check
- Security issues (use
/plugin-security-review)
- Code formatting details (Spotless handles that)
- Performance optimization (unless obvious bug)
- Documentation/comments (unless missing critical context)