Skip to content

Disallow more than 1 public method named with regex #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

NanoSector
Copy link

Right now it is possible to define a class that has two public methods: exampleOne and exampleTwo. If you do not give this class extra methods and configure the ShouldHaveOnlyOnePublicMethodNamed rule to look for ^example.+$ then it will report success, despite two methods existing with this naming scheme.

This rule will only start failing after introducing a method which does not follow the naming scheme, e.g. foo. This PR aims to fix this by also failing in the exampleOne and exampleTwo scenario.

Note that we interpreted this rule as "can have several public methods, but only one named ...", instead of "should have only one public method and it is named ...", so this might not follow the original intention of the rule.

Right now it is possible to define a class that has two public methods:
`exampleOne` and `exampleTwo`. If you do not give this class extra
methods and configure the ShouldHaveOnlyOnePublicMethodNamed rule to
look for `^example.+$` then it will report success, despite two methods
existing with this naming scheme.

This rule will only start failing after introducing a method which does
*not* follow the naming scheme, e.g. `foo`. This PR aims to fix this by
also failing in the `exampleOne` and `exampleTwo` scenario.

Note that we interpreted this rule as "can have several public methods,
but only one named ...", instead of "should have only one public method
*and* it is named ...", so this might not follow the original intention
of the rule.
@NanoSector
Copy link
Author

@carlosas Your CI setup seems to be completely broken at the moment; is this something you could take a look at?

@carlosas
Copy link
Owner

I'll be able to check it on Monday. Sorry but I'm traveling atm

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.

2 participants