Skip to content

New rule S6960 for C#: Controllers should not have too many responsibilities #9089

@mary-georgiou-sonarsource

Description

RSPEC PR: SonarSource/rspec#3845

Parts:

  • Disjoint Sets primitives: Disjoint Sets primitives #9145
  • Basic implementation: New rule S6960 for C#: Controllers should not have too many responsibilities #9111
    • Support for Func<service> and Lazy<service>: Service should not be well-known
    • Support injected classed with "service" as suffix
    • Support indexers (treated as methods, not as properties)
    • Method overloads are handled as a single group
    • Filter out groups of actions not using any service
    • Change message from "Belongs to responsibility #X" to "May belong to responsibility #X"
    • Fix ASP.NET 4x wrongly detected as good candidate for the rule
    • Exclude IHttpClientFactory (consider as well-known dependency)
    • Fix numbering of responsibilities in presence of unused services
    • Change behavior to include all classes and remove the "service suffix" exception
    • [ ] Introduce S6960IncludeAttribute and S6960ExcludeAttribute
    • Exclude abstract controllers (because of scenarios like this one)
    • Exclude controllers that don't inherit directly from ControllerBase
    • [ ]Exclude inherited methods (because there is no option than to implement them) this is canceled by previous task

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions