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
Add CLI IgnoreViolationsOnExit option flag #380
Conversation
…iolation is found (will allow successfull build for CI)
PHPCS has a similar cli switch:
So, I would prefer the switch to be |
The doc block in https://github.com/jaymoulin/phpmd/blob/9f71d9847446a6efb92ffac1b53ab53ec8d98d0c/src/main/php/PHPMD/TextUI/Command.php#L68-L71 should be updated, too. |
Also adding it to the documentation, would make sense. I would place it under "Exit codes". https://github.com/phpmd/phpmd/blob/master/src/site/rst/documentation/index.rst#exit-codes edit: plus here: |
* | ||
* @return boolean | ||
*/ | ||
public function hasIgnoreExitViolations() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename to ignoreExitViolations()
.
Haven't looked into it, but does it need to be public
?
If not, please use protected
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method is used in src/main/php/PHPMD/TextUI/Command.php:132
@jaymoulin many thanks for your contribution. This is certainly useful. Do you see a chance for adding a unit test, too? |
Thanks for your return. I'll manage to handle that |
…ntation + add unit test for it
@@ -99,4 +99,29 @@ public function testMainReturnsViolationExitCodeForSourceWithNPathViolation() | |||
); | |||
$this->assertEquals(Command::EXIT_VIOLATION, $exitCode); | |||
} | |||
|
|||
/** | |||
* testMainReturnsViolationExitCodeForSourceWithNPathViolation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste error, better explain the meaning of the test instead of copy pasting the name of the function/method.
E.g.:
Tests if main returns success Exit Code for Source with NPath Violation and IgnoreViolationsOnExit Flag
This kind of documentation is meant for a developer, not for a computer... 😼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it was a Lead Developper choice so I just followed the testcase coding style
Apart from my nitpicking, this really looks good. |
add --ignore-exit-violations CLI flag to allow exit code 0 event if violation is found (will allow successfull build for CI)