Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Enforce own rules to the codebase #812
Comments
@Morgy93 thanks for your issue. There are indeed parts of the code that need to be changed to follow the rules. There are only some things to think about. The rules aren't holy (else there shouldn't be a way to suppress them see: https://phpmd.org/documentation/suppress-warnings.html ) And there are situations where there a rule isn't possible to use without loosing functionality. Like the exit expressions that you point out. We could Feel free to create a PR fixing (some off) the parts where PHPMD doesn't follow its own rules. Or annotate the suppressing of the places where it is impossible to follow the rules. |
Description
Hello,
it would be awesome if you could enforce your own rules to your own code, because people could then have a look at it for reference.
I just opened up the very first file I came across and immediately saw multiple rule violations:
https://phpmd.org/rules/cleancode.html#elseexpression
https://github.com/phpmd/phpmd/blob/master/src/bin/phpmd#L25
https://github.com/phpmd/phpmd/blob/master/src/bin/phpmd#L48
https://phpmd.org/rules/design.html#exitexpression
https://github.com/phpmd/phpmd/blob/master/src/bin/phpmd#L55
https://github.com/phpmd/phpmd/blob/master/src/bin/phpmd#L61
"If they don't care about their rules, why should I" - would probably be the first thought for many.😄
Checks before submitting