Skip to content

[release-1.9-post-cqa] [RHIDP-12950]: Rewrite CQA scripts from bash to Node.js ESM#1997

Merged
themr0c merged 17 commits into
redhat-developer:release-1.9-post-cqafrom
openshift-cherrypick-robot:cherry-pick-1989-to-release-1.9-post-cqa
Apr 1, 2026
Merged

[release-1.9-post-cqa] [RHIDP-12950]: Rewrite CQA scripts from bash to Node.js ESM#1997
themr0c merged 17 commits into
redhat-developer:release-1.9-post-cqafrom
openshift-cherrypick-robot:cherry-pick-1989-to-release-1.9-post-cqa

Conversation

@openshift-cherrypick-robot

Copy link
Copy Markdown
Contributor

This is an automated cherry-pick of #1989

/assign themr0c

themr0c and others added 17 commits April 1, 2026 17:20
Replace 21 bash CQA scripts with a modular Node.js ESM system at
build/scripts/cqa/. Key improvements:

- 19 checks as ES modules with shared Checker base class
- Single Vale invocation in --all mode (3m31s -> 22s, ~10x speedup)
- Vale-based detection for CQA-01, CQA-12, CQA-16 with result caching
- Rename DeveloperHub.Attributes to DeveloperHub.ProductNames
- Add .vale-product-names.ini for CQA-16 dedicated Vale config
- Deduplication of shared module issues across titles
- --help flag with full usage documentation
- --all report sorted alphabetically by check ID
- collectTitle() memoization eliminates redundant include-tree walks
- Claude Code plugin (project-cqa) with 21 skills and 9 resources
- Update CI workflow for Node.js + Vale

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ibute

Add subs="+attributes,+quotes" to listing/literal code blocks when CQA-16
fix replaces hardcoded product names with attributes inside them. Filter
out false positives on comment and attribute definition lines. Add
{product-cli} attribute for rhdh-cli and fix content using it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add Vale and autofix detection for {product-very-short} Local (propose
{product-local-very-short}) and {product-very-short}-cli (propose
{product-cli}). Fix all content occurrences.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace execSync with execFileSync to prevent command injection (S4721)
- Tighten regexes to prevent super-linear backtracking (S5852)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The blanket replaceAll('{{', '{') collapsed legitimate {{inherit}}
placeholders in YAML code blocks. Restrict the cleanup to only collapse
double braces around known attribute references (e.g., {{product-very-short}}
→ {product-very-short}), leaving {{inherit}} and similar patterns intact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Re-run CQA-16 autofix after the double-brace regex correction. The RHDH
to {product-very-short} replacement in identifiers is now applied without
corrupting Helm template {{ .Values }} expressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Re-run CQA-16 autofix on troubleshoot module after the double-brace
regex correction to preserve Helm {{ .Release.Name }} expressions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused imports (S1128): isInBlock, basename
- Reduce cognitive complexity (S3776): extract helpers in cqa-00a,
  cqa-00b, cqa-01, cqa-12, cqa-14, cqa-16, index.js
- Use String#startsWith/endsWith (S6557): cqa-01, cqa-10
- Use optional chaining (S6582): cqa-10
- Use RegExp.exec() (S6594): cqa-14
- Use .includes() instead of .some() (S7765): cqa-02/03/04/05/13
- Use .indexOf() instead of .findIndex() (S7753): cqa-08/09/11
- Use String.raw (S7780): cqa-12
- Prefer replaceAll (S7781): cqa-09
- Combine push() calls (S7778): cqa-02, cqa-13
- Fix negated conditions (S7735): cqa-00b, cqa-05, index, output
- Use Boolean directly (S7770): cqa-15

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The autofix now recognizes both +attributes and attributes+ forms when
checking if a code block already has attribute substitution enabled,
preventing duplicate subs like subs="attributes+,+attributes".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Kubernetes CR kind field should use {product-custom-resource-type}
not {backstage}. Add context-aware pre-replacement in the autofix and
fix 6 occurrences across 5 files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The regex-based double-brace cleanup was still too broad, matching
{{inherit}} and other non-attribute patterns. Replace with explicit
per-attribute cleanup using INSERTED_ATTRS set derived from PATTERNS.
Restore {{inherit}} in orchestrator config and fix missing }} in
LDAP JSON patch command.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace regex-based include path extraction with indexOf, and replace
dynamic RegExp pattern matching with string-segment glob matching to
eliminate super-linear backtracking risk.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add lib/bin.js that resolves git, vale, sed to absolute paths via
`which` at startup. All execFileSync calls now use the resolved paths
instead of bare binary names.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously the workflow only created a new comment when changed files
were found. Now it always creates or updates the comment, consistent
with other PR workflows.

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

sonarqubecloud Bot commented Apr 1, 2026

Copy link
Copy Markdown

@themr0c themr0c merged commit 990016b into redhat-developer:release-1.9-post-cqa Apr 1, 2026
7 of 9 checks passed
@rhdh-bot

rhdh-bot commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Shellcheck Analysis Results

No shell scripts were changed in this PR.


Automated shellcheck analysis • See shellcheck.net for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants