Skip to content

TCE-1548: Update default values for ccn issues#21

Open
stefanvacareanu7 wants to merge 7 commits into
masterfrom
feat/tce-1548
Open

TCE-1548: Update default values for ccn issues#21
stefanvacareanu7 wants to merge 7 commits into
masterfrom
feat/tce-1548

Conversation

@stefanvacareanu7

@stefanvacareanu7 stefanvacareanu7 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates the default values for the Cyclomatic Complexity (ccn) issues in docs/patterns.json as requested in TCE-1548.

Pattern Threshold (before → after) Enabled (before → after)
ccn-minor 5 → 10 false → true
ccn-medium 8 → 15 true → false
ccn-critical 12 → 20 false → false (unchanged)

Only ccn-minor is enabled by default now.

Changes

  • docs/patterns.json — the canonical source of the defaults; thresholds and enabled flags updated as above.
  • docs/description/description.json — the ccn pattern descriptions reference the default thresholds ("The default threshold is …"); updated 5→10, 8→15, 12→20 to stay in sync.
  • docs/description/ccn-{minor,medium,critical}.md — same description text. ⚠️ These files previously carried stale values (4 / 7 / 10) that did not match patterns.json (5 / 8 / 12) — a pre-existing inconsistency. They are now aligned to the new defaults (10 / 15 / 20).

The docs/multiple-tests/all-patterns/patterns.xml integration fixture uses explicit thresholds (not the defaults), so it is intentionally left unchanged and the tests still pass.

codacy-tools validation checklist

Step 1 — Dependency vulnerability scan (trivy)

trivy fs --exit-code 0 --severity HIGH,CRITICAL .

Result: 0 HIGH/CRITICAL vulnerabilities in package-lock.json. No new vulnerabilities introduced by this change.

Note: GitHub/Dependabot reports vulnerabilities on the default branch (1 high, 4 moderate, 2 low). These are pre-existing and unrelated to this docs-only change; trivy's fs scan of the dependency lockfile reports clean for HIGH/CRITICAL.

Step 2 — Pattern/docs generation

The README.md does not document any pattern/docs generation command (the "Docs" section only links to external developer guides; package.json scripts are build/lint/test/upgrade only). The docs under docs/ are hand-maintained, so this step has no command to run and was skipped.

Step 3 — Integration test with codacy-plugins-test

Tool name (per README / src/toolMetadata.ts): lizard. Built the docker image locally (codacy/codacy-lizard:latest) and ran the test suite:

multiple:

[MultipleTests] Running MultipleTests:
[MultipleTests] all-patterns should have 3 results
[ResultPrinter] Got 3 results.
[DockerTest] [Success] MultipleTests$
[DockerTest] [Success] All tests passed!

json (extra check, since the change touches patterns.json + description.json):

[JsonTests] Read /docs/patterns.json successfully
[JsonTests] Read /docs/description/description.json successfully
[JsonTests] Read /docs/description/ccn-critical.md successfully
[JsonTests] Read /docs/description/ccn-medium.md successfully
[JsonTests] Read /docs/description/ccn-minor.md successfully
[DockerTest] [Success] JsonTests$
[DockerTest] [Success] All tests passed!

(The file-nloc-*.md "could not read" lines are pre-existing — those description files do not exist — and are unrelated to this change; the test still passes.)

🤖 Generated with Claude Code

Update the Cyclomatic Complexity (ccn) pattern defaults in
docs/patterns.json:
- ccn-minor: threshold 5 -> 10, enabled false -> true
- ccn-medium: threshold 8 -> 15, enabled true -> false
- ccn-critical: threshold 12 -> 20 (stays disabled)

Only ccn-minor is now enabled by default.

Keep the documentation in sync with the new defaults by updating the
ccn descriptions in docs/description/description.json and the per-pattern
files docs/description/ccn-{minor,medium,critical}.md. The .md files
previously carried stale values (4/7/10) that no longer matched
patterns.json; they are now aligned to 10/15/20.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the default thresholds for the minor, medium, and critical cyclomatic complexity controls in both the documentation and configuration files, while also adjusting their default enabled states. The reviewer correctly noted that the phrasing 'If the threshold is not met' is misleading for cyclomatic complexity, as issues are raised when the complexity exceeds the threshold, and provided suggestions to correct this phrasing across all description files.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread docs/description/ccn-minor.md Outdated
Comment thread docs/description/ccn-medium.md Outdated
Comment thread docs/description/ccn-critical.md Outdated
Comment thread docs/description/description.json Outdated
Comment thread docs/description/description.json Outdated
Comment thread docs/description/description.json Outdated
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The pull request synchronizes Cyclomatic Complexity (CCN) thresholds across configuration and documentation. Although the changes meet the stated acceptance criteria, the review surfaced a significant concern regarding pattern enablement in docs/patterns.json. By enabling ccn-minor while disabling ccn-medium and ccn-critical, the configuration deviates from repository standards seen in other tools (e.g., nloc). This results in high-complexity code (>= 15) being reported only as a 'Minor' issue, which may lead to significant logic complexity being overlooked during development. It is recommended to verify if this shift in severity strategy was intended.

About this PR

  • The update enables 'Minor' complexity checks while disabling 'Medium' and 'Critical' tiers. This shift in severity strategy deviates from the established baseline in this repository where 'Medium' checks are typically enabled by default. Ensure this change is intentional as it impacts how complexity alerts are escalated.

Test suggestions

  • Verify patterns.json schema and values for ccn-minor, ccn-medium, and ccn-critical\n- [x] Verify description.json matches the new default thresholds\n- [x] Verify markdown documentation files reflect the new default thresholds

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment thread docs/patterns.json
}
],
"enabled": true
"enabled": false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

The enabled status for ccn-medium should remain true. Disabling this pattern while updating its threshold results in code with high cyclomatic complexity (>= 15) being reported only as a 'Minor' issue rather than a 'Medium' warning. This is inconsistent with repository conventions for other complexity checks like nloc.\n\nsuggestion\n "enabled": true\n

Comment thread docs/patterns.json
stefanvacareanu7 and others added 6 commits June 30, 2026 18:16
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@stefanvacareanu7 stefanvacareanu7 enabled auto-merge (squash) June 30, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant