Description
Currently, ReferenceCop does not leverage/support NoWarn attributes in projects to allow exceptions to the rules in the csproj itself. We need to implement a NoWarn support so references with that attribute won't trigger a warning.
Problem
When defining reference rules in ReferenceCop, there's no way to create exceptions for specific references that might otherwise violate the rules but should be allowed in certain circumstances.
Proposed Solution
- Modify violation detectors (particularly
AssemblyNameViolationDetector, ProjectPathViolationDetector, and ProjectTagViolationDetector) to check if a reference has the NoWarn attribute in the csproj before reporting it as a violation (only applicable for Warning severity rule violations)
- Ensure the NoWarn attributes are considered for all references, across all detectors in both the MSBuild task and the Roslyn analyzer.
- Add unit tests for the new functionality
- Update documentation
Implementation Details
- Allow configuring exceptions at the project level
- Ensure backward compatibility with existing configuration files
Acceptance Criteria
- Users can specify references that should not trigger warnings despite matching rule patterns
- Unit tests demonstrate the feature works as expected
- Documentation is updated to explain the new NoWarn capabilities
Description
Currently, ReferenceCop does not leverage/support NoWarn attributes in projects to allow exceptions to the rules in the csproj itself. We need to implement a NoWarn support so references with that attribute won't trigger a warning.
Problem
When defining reference rules in ReferenceCop, there's no way to create exceptions for specific references that might otherwise violate the rules but should be allowed in certain circumstances.
Proposed Solution
AssemblyNameViolationDetector,ProjectPathViolationDetector, andProjectTagViolationDetector) to check if a reference has the NoWarn attribute in the csproj before reporting it as a violation (only applicable for Warning severity rule violations)Implementation Details
Acceptance Criteria