Skip to content

[BUG][code-analyzer] Recreating config file ignores deactivations and file ignore, and deletes rules #2013

@dschach

Description

@dschach

Have you tried to resolve this issue yourself first?

  • I confirm I have gone through the above steps and still have an issue to report.

Bug Description

When I recreated the config file with the line sf code-analyzer config --include-unmodified-rules --rule-selector all --config-file code-analyzer.yml --output-file code-analyzer.yml last week, it removed the disabled: true tags.

This week, it removes the rule entirely from the config file, which does not disable the rule.

Additionally, my ignores section was completely removed.

Separately, it is interesting that entire sections are rearranged, making diffs difficult to analyze. (The flow section was moved.)

Losing customizations can be exremely costly.

Output / Logs

Steps To Reproduce

  1. Create a code-analyzer.yml file by whatever means you like
  2. Add an ignores array
  3. Set a rule to disabled by inserting a line disabled: true below the rule severity
  4. Run sf code-analyzer config --include-unmodified-rules --rule-selector all --config-file code-analyzer.yml --output-file code-analyzer.yml
  5. Note that the disabled tag is gone and so is the ignores array

Expected Behavior

disabled attributes should be retained
ignores should be retained

Operating System

Tahoe 26.3.1

Salesforce CLI Version

@salesforce/cli/2.127.2 darwin-arm64 node-v22.22.0

Code Analyzer Plugin (code-analyzer) Version

code-analyzer 5.10.2 (5.10.2)

Node Version

v24.13.0

Java Version

openjdk version "21.0.6" 2025-01-21 LTS

Python Version

zsh: command not found: python

Additional Context (Screenshots, Files, etc)

No response

Workaround

Run the command, then copy/paste any new rules back to the original file, or use the diff in VS Code.

Urgency

High

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions