-
Notifications
You must be signed in to change notification settings - Fork 317
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
Allow for script to exit with code 0 even if circular dependencies are found #303
base: master
Are you sure you want to change the base?
Conversation
@pahen would you consider adding this? Or, perhaps some variation of this? |
@@ -265,7 +266,7 @@ function createOutputFromOptions(program, res) { | |||
json: program.json | |||
}); | |||
|
|||
if (circular.length) { | |||
if (circular.length && !program.allowFailures) { |
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.
if (circular.length && !program.allowFailures) { | |
if (!program.allowFailures && circular.length) { |
Kinda niche-picking but in this way it express better which is more important
@@ -37,6 +37,7 @@ program | |||
.option('--stdin', 'read predefined tree from STDIN', false) | |||
.option('--warning', 'show warnings about skipped files', false) | |||
.option('--debug', 'turn on debug output', false) | |||
.option('--allow-circular', 'exit with code 0 when circular dependencies are found', false) |
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.
.option('--allow-circular', 'exit with code 0 when circular dependencies are found', false) | |
.option('--allow-circular', 'not exit with code 1 when circular dependencies are found', false) |
Describe what's done instead of using its converse. The old description is ambiguous: imagine the case where circular dependencies are found along with other errors. By the old description, madge was meant to exit with 0
, which is untrue.
Hi, @louisscruz , thanks for this handy idea. I'm here to help with the PR. |
Due to the inactivity, I'm going to do the edit myself and add some output test. |
In some cases, one might aim to use
madge
to get a list of circular dependencies without necessarily exiting1
in the case that some are found. This PR adds an--allow-circular
flag that will allow for that.