Answer to the Core Question
Qodana does not automatically resolve conflicting qodana.xml (baseline) files when branches are merged. The tool expects you to explicitly combine baseline data or regenerate it for the target branch. The only built‑in way to keep two baselines in sync is to use the qodana baseline merge CLI sub‑command, which merges two or more baseline JSON files into a single file that can then be committed to the repository.
Confirmed Facts
- Baseline files are JSON (e.g.,
baseline.json) or XML depending on the Qodana version; the CLI uses JSON in recent releases.
- The CLI provides
qodana baseline merge to combine multiple baseline files.
- After merging, the resulting file can be used with
--baseline to skip reporting on ignored issues.
- The merge operation preserves issue signatures; it does not deduplicate automatically beyond identical JSON entries.
Likely Explanation (Not 100% Verified)
When two branches have diverging baselines, the merge command will produce a file that contains the union of all issue signatures from the input baselines. If an issue appears in both, the merge keeps a single instance, but if the signatures differ (e.g., due to code changes), both may be retained. There is no automated conflict resolution beyond this union; manual review or re‑generation is recommended for large or complex histories.
Practical Steps for Your Workflow
Generate a baseline on each feature branch:
qodana --baseline path/to/branch1/baseline.json
qodana --baseline path/to/branch2/baseline.json
Merge the baselines after the branches are combined into main:
qodana baseline merge \
path/to/branch1/baseline.json \
path/to/branch2/baseline.json \
--output path/to/main/merged-baseline.json
Review the merged file:
git diff path/to/main/merged-baseline.json
Commit the merged baseline into main:
git add path/to/main/merged-baseline.json
git commit -m "Merge Qodana baselines from feature branches"
Run Qodana on the integrated branch to validate:
qodana --baseline path/to/main/merged-baseline.json
Verification Checklist
- Run
qodana --baseline merged-baseline.json and confirm that previously ignored issues no longer appear.
- Use
qodana baseline merge --dry-run to preview the merge result before committing.
- Check the size of the merged baseline; prune resolved issues if it becomes unwieldy.
Missing Diagnostic Detail
Could you confirm which Qodana CLI version you are using? The syntax of baseline merge and the file format (JSON vs XML) can differ between releases, and the exact command may need adjustment.