Skip to content
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

Ability to use 'show-unmatched-globs' in CI pipelines for missing specs #1117

Closed
axelssonHakan opened this issue Apr 23, 2020 · 2 comments · Fixed by #1371
Closed

Ability to use 'show-unmatched-globs' in CI pipelines for missing specs #1117

axelssonHakan opened this issue Apr 23, 2020 · 2 comments · Fixed by #1371
Assignees
Labels
enhancement New feature or request

Comments

@axelssonHakan
Copy link

Describe the bug
Right now the show-unmatched-globs only logs a message if a spec isn't found using a glob. It would be nice if it would change the exitCode as well (process.exitCode = 1;).
https://github.com/stoplightio/spectral/blob/develop/src/cli/services/linter/linter.ts#L73

Maybe the yarg option --show-unmatched-globs could be made to take a string and use that to change exit code if that is behaviour the user wants

  • --show-unmatched-globs=empty/info/warn >> exitCode=0
  • --show-unmatched-globs=error>> exitCode=1

To Reproduce

  1. Run this CLI command npx spectral lint --show-unmatched-globs globReturningEmptyArray
  2. echo $? >> 0

Expected behaviour
In CI environments it would be preferred if the --show-unmatched-globs returned an exitCode > 0 so you don't get any "false" positive tests

@nulltoken
Copy link
Contributor

@P0lip Or maybe could we add an additional switch (--fail-on-unmatched-globs)... Thoughts?

@P0lip
Copy link
Contributor

P0lip commented Sep 30, 2020

My apologies for dropping a ball on this one.
--fail-on-unmatched-globs sounds good.

@P0lip P0lip added enhancement New feature or request and removed t/bug Something isn't working labels Oct 1, 2020
@P0lip P0lip self-assigned this Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants