Skip to content

Add ForbiddenStaticMethods rule#31

Merged
floriankraemer merged 1 commit intomasterfrom
forbid-static-methods
Feb 9, 2026
Merged

Add ForbiddenStaticMethods rule#31
floriankraemer merged 1 commit intomasterfrom
forbid-static-methods

Conversation

@floriankraemer
Copy link
Contributor

  • Introduced the ForbiddenStaticMethodsRule to enforce restrictions on static method calls based on defined regex patterns.
  • Created multiple service classes demonstrating both allowed and forbidden static calls, including AllowedStaticCall, ForbiddenClassStaticCall, and ForbiddenMethodStaticCall.
  • Implemented utility classes like StaticHelper and LegacyHelper to serve as targets for forbidden calls.
  • Added comprehensive tests to validate the behavior of the new rule and ensure correct identification of allowed and forbidden static method calls.

This enhancement aims to improve code quality by preventing misuse of static methods in the codebase.

- Introduced the `ForbiddenStaticMethodsRule` to enforce restrictions on static method calls based on defined regex patterns.
- Created multiple service classes demonstrating both allowed and forbidden static calls, including `AllowedStaticCall`, `ForbiddenClassStaticCall`, and `ForbiddenMethodStaticCall`.
- Implemented utility classes like `StaticHelper` and `LegacyHelper` to serve as targets for forbidden calls.
- Added comprehensive tests to validate the behavior of the new rule and ensure correct identification of allowed and forbidden static method calls.

This enhancement aims to improve code quality by preventing misuse of static methods in the codebase.
@floriankraemer floriankraemer merged commit f3d2f3a into master Feb 9, 2026
8 checks passed
@floriankraemer floriankraemer deleted the forbid-static-methods branch February 9, 2026 23:09
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.

1 participant