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
Refactor part of printErrorReport into method #597
Conversation
This reduces the N path complexity of the printErrorReport method and improves the readability.
ca251b4
to
e0f3f4f
Compare
I don't see a reason to break the code out like this and I actually think it makes it harder to follow. You obviously disagree, which is fine. If you have a specific need for this in a project, please let me know so I can make the change and test it for you. Otherwise, I'm going to leave that code as is. |
Well, I was about to propose two CLI switches for ignoring warnings and errors respectively for when running a CS check. php scripts/phpcs folder --standard=PHPCS --ignore-errors --ignore-warnings The reason for this is this: Without such switches, people would need set the config settings before. And with my refactoring of the code, it would be cleaner to be implemented instead of making the currrent method |
Ignoring warnings is a pretty core feature, so it has a dedicated option You can also use |
The problem is not hiding them, but the exit code, which produces Composer (or any other calling program) to recognise the execution as failed. |
But |
Yeah sorry, I was getting confused by the exit code and the actual reports. |
Anyway, the point of this PR was mainly that I think that PHPCS could benefit from shorter methods. So please reject this as you like. |
I have to balance that with the number of function calls. When running for several minutes, the overhead of those call really adds up. But I've begun refactoring things in the 3.0 branch if you want to poke around. Some stuff is better, some stuff is the same. |
This reduces the N path complexity of the printErrorReport method and improves the readability.