| name | extension-code-review |
| description | Use when reviewing changes to the Black Duck Security Scan ADO extension. Checks coding standards, established patterns, and backward compatibility — covering input handling, version-gated behavior, Classic Editor parity, error construction, HTTP client usage, task.json integrity, and test coverage. Flags deviations with file:line citations and prescribes the correct pattern. |
Extension Code Review
Reviews diffs or file changes against this codebase's established patterns and backward-compatibility requirements. Always read the actual changed files before producing findings. Never flag style that matches existing code.
How to Use
When the user says "review this", "check my change", or "what did I break", do the following:
- Read all changed files (
git diff or user-provided files)
- Run each checklist section below against the changes
- Report findings as:
file:line — [SEVERITY] — problem — correct pattern
- Severities:
BREAK (will fail at runtime), COMPAT (backward compat risk), STANDARD (deviates from project convention), TEST (missing or wrong test coverage)
Checklist 1 — Input Handling Standards
Rule: Every new input must be exported from input.ts using the correct helper.
| Scenario | Correct helper |
|---|
| String, URL, token — single Classic Editor key | getInput(yamlKey, classicEditorKey, deprecatedKey|null) |
| Boolean flag | getBoolInput(yamlKey, classicEditorKey, deprecatedKey|null) |
| File or directory path | getPathInput(yamlKey, classicEditorKey, deprecatedKey|null) |
| Shared param across multiple products in Classic Editor | getInputForMultipleClassicEditor(yamlKey, polarisKey, bdKey, coverityKey, srmKey, deprecated|null) |
Checks:
Common violation: reading taskLib.getInput("my_key") directly instead of exporting from input.ts. Breaks the dual-mode contract and skips deprecation tracking.
Checklist 2 — Parameter Deprecation
Rule: Deprecated keys must route through the getInput third-argument mechanism. Never handle deprecation manually.
COMPAT risk: removing or renaming a YAML key without deprecation silently breaks pipelines that don't get re-run until the next scan.
Checklist 3 — Version-Gated Behavior
Known version thresholds (from application-constant.ts):
| Threshold | Constant | What changes |
|---|
3.5.0 | VERSION | SARIF output path — root dir vs integrations/ prefix |
3.8.0 | ASSESSMENT_MODE_UNSUPPORTED_BRIDGE_VERSION | Polaris assessment mode deprecated |
3.9.0 | COVERITY_PRCOMMENT_NEW_FORMAT_VERSION | Coverity PR comment format |
2.1.0 | MIN_SUPPORTED_BRIDGE_CLI_MAC_ARM_VERSION | ARM Mac support |
3.5.1 | MIN_SUPPORTED_BRIDGE_CLI_LINUX_ARM_VERSION | ARM Linux support |
Checks:
COMPAT risk: new behavior added without a version gate silently breaks users on older Bridge CLI versions.
Checklist 4 — HTTP Client and Network Usage
Rule: All HTTP calls use createSSLConfiguredHttpClient() or getSharedHttpClient() from utility.ts. No raw https.request, raw axios, or new HttpClient() calls.
BREAK risk: bypassing createSSLConfiguredHttpClient() means custom CA certs and proxy config are silently ignored for that request.
Checklist 5 — Error Construction
Rule: All thrown errors append an ErrorCode so the caller can map to build status.
throw new Error(
"Human readable message"
.concat(constants.SPACE)
.concat(ErrorCode.MY_CODE.toString())
);
return Promise.reject(new Error("msg".concat(constants.SPACE).concat(ErrorCode.MY_CODE.toString())));
Checklist 6 — Logging Standards
Rule: Internal state → taskLib.debug(). User-visible progress → console.log(). Errors → taskLib.error() (only from main.ts catch).
Checklist 7 — task.json Integrity
Rule: Every new YAML input must have a matching Classic Editor entry in task.json. Every Classic Editor entry must have a visibleRule and a groupName.
BREAK risk: a task.json input with a name that doesn't match the _KEY_CLASSIC_EDITOR constant means Classic Editor users silently get empty values.
Checklist 8 — Model and Type Safety
Rule: Product config shapes live in model/{product}.ts. Use typed InputData<T> wrapper. No any in model or tools-parameter code.
Checklist 9 — Backward Compatibility: ADO Pipelines
COMPAT checks that protect users from silent breakage:
Checklist 10 — Test Coverage
Rule: Every branch and every new input must be covered.
Quick Severity Reference
| Tag | Meaning |
|---|
BREAK | Will fail at runtime or silently produce wrong output |
COMPAT | Existing pipelines or Bridge CLI versions may break |
STANDARD | Deviates from project convention; inconsistency risk |
TEST | Missing or incorrect test coverage |