Skip to content

[CLI] fix command ignores --include / --exclude file filter #1757

Description

@hashiiiii

The --include and --exclude options on the fix command do not filter which files are fixed. All files in the solution are modified regardless of the specified patterns.

The analyze command correctly respects these options (fixed in #1459).

Reproduction: https://github.com/hashiiiii/roslynator-fix-include-bug-repro

roslynator fix ./TestSolution.sln \
  --include "ProjectA/**" \
  --supported-diagnostics CA1822

Expected: Only files under ProjectA/ are fixed.
Actual: Files under ProjectB/ are also fixed.

In CodeFixer.cs, FileSystemFilter is not checked in GetFixableDiagnostics or FixDiagnosticsAsync. It is only checked in GetDiagnosticsAsync, which runs after the fix loop for reporting purposes.

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