Skip to content

Commit

Permalink
chore: rename to show-unmatched-globs
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip committed Apr 1, 2020
1 parent 78a5f5f commit fa7161d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/guides/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Other options include:
--display-only-failures, -D only output results equal to or greater than --fail-severity
[boolean] [default: false]
--ignore-unknown-format do not warn about unmatched formats [boolean] [default: false]
--ignore-unmatched-globs do not warn about unmatched glob patterns [boolean] [default: true]
--show-unmatched-globs show unmatched glob patterns [boolean] [default: false]
--verbose, -v increase verbosity [boolean]
--quiet, -q no logging - output only [boolean]
```
Expand Down
18 changes: 9 additions & 9 deletions src/cli/commands/__tests__/lint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('lint', () => {
encoding: 'utf8',
format: 'stylish',
ignoreUnknownFormat: false,
ignoreUnmatchedGlobs: true,
showUnmatchedGlobs: false,
});
});
});
Expand All @@ -94,7 +94,7 @@ describe('lint', () => {
encoding: 'utf8',
format: 'stylish',
ignoreUnknownFormat: false,
ignoreUnmatchedGlobs: true,
showUnmatchedGlobs: false,
});
});

Expand All @@ -105,7 +105,7 @@ describe('lint', () => {
encoding: 'utf16',
format: 'stylish',
ignoreUnknownFormat: false,
ignoreUnmatchedGlobs: true,
showUnmatchedGlobs: false,
});
});

Expand All @@ -116,7 +116,7 @@ describe('lint', () => {
encoding: 'utf16',
format: 'json',
ignoreUnknownFormat: false,
ignoreUnmatchedGlobs: true,
showUnmatchedGlobs: false,
});
});

Expand Down Expand Up @@ -174,7 +174,7 @@ describe('lint', () => {
encoding: 'utf8',
format: 'stylish',
ignoreUnknownFormat: false,
ignoreUnmatchedGlobs: true,
showUnmatchedGlobs: false,
});
});

Expand All @@ -184,17 +184,17 @@ describe('lint', () => {
encoding: 'utf8',
format: 'stylish',
ignoreUnknownFormat: true,
ignoreUnmatchedGlobs: true,
showUnmatchedGlobs: true,
});
});

it('passes ignore-unmatched-globs to lint', async () => {
await run('lint --ignore-unmatched-globs=false ./__fixtures__/empty-oas2-document.json');
it('passes show-unmatched-globs to lint', async () => {
await run('lint --show-unmatched-globs ./__fixtures__/empty-oas2-document.json');
expect(lint).toHaveBeenCalledWith([expect.any(String)], {
encoding: 'utf8',
format: 'stylish',
ignoreUnknownFormat: false,
ignoreUnmatchedGlobs: false,
showUnmatchedGlobs: false,
});
});

Expand Down
10 changes: 5 additions & 5 deletions src/cli/commands/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ const lintCommand: CommandModule = {
type: 'boolean',
default: false,
},
'ignore-unmatched-globs': {
description: 'do not warn about unmatched glob patterns',
'show-unmatched-globs': {
description: 'show unmatched glob patterns',
type: 'boolean',
default: true,
default: false,
},
verbose: {
alias: 'v',
Expand All @@ -132,7 +132,7 @@ const lintCommand: CommandModule = {
output,
encoding,
ignoreUnknownFormat,
ignoreUnmatchedGlobs,
showUnmatchedGlobs,
...config
} = (args as unknown) as ILintConfig & {
documents: Array<number | string>;
Expand All @@ -145,7 +145,7 @@ const lintCommand: CommandModule = {
output,
encoding,
ignoreUnknownFormat,
ignoreUnmatchedGlobs,
showUnmatchedGlobs,
ruleset,
...pick<Partial<ILintConfig>, keyof ILintConfig>(config, ['skipRule', 'verbose', 'quiet', 'resolver']),
})
Expand Down
2 changes: 1 addition & 1 deletion src/cli/services/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function lint(documents: Array<number | string>, flags: ILintConfig
spectral.setRules(skipRules(ruleset.rules, flags));
}

const [targetUris, unmatchedPatterns] = await listFiles(documents, flags.ignoreUnmatchedGlobs);
const [targetUris, unmatchedPatterns] = await listFiles(documents, !flags.showUnmatchedGlobs);
const results: IRuleResult[] = [];

for (const unmatchedPattern of unmatchedPatterns) {
Expand Down
2 changes: 1 addition & 1 deletion src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ILintConfig {
ruleset?: string[];
skipRule?: string[];
ignoreUnknownFormat: boolean;
ignoreUnmatchedGlobs: boolean;
showUnmatchedGlobs: boolean;
verbose?: boolean;
quiet?: boolean;
}
2 changes: 1 addition & 1 deletion test-harness/scenarios/help-no-document.scenario
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Options:
--fail-severity, -F results of this level or above will trigger a failure exit code [string] [choices: "error", "warn", "info", "hint"] [default: "error"]
--display-only-failures, -D only output results equal to or greater than --fail-severity [boolean] [default: false]
--ignore-unknown-format do not warn about unmatched formats [boolean] [default: false]
--ignore-unmatched-globs do not warn about unmatched glob patterns [boolean] [default: true]
--show-unmatched-globs show unmatched glob patterns [boolean] [default: false]
--verbose, -v increase verbosity [boolean]
--quiet, -q no logging - output only [boolean]
2 changes: 1 addition & 1 deletion test-harness/scenarios/unmatched-glob-patterns.scenario
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
====test====
Reports unmatched glob patterns
====command====
{bin} lint ./*oops.{yml,yaml,json} --ignore-unmatched-globs=false
{bin} lint ./*oops.{yml,yaml,json} --show-unmatched-globs
====stdout====
Glob pattern `./*oops.{yml,yaml,json}` did not match any files
No results with a severity of 'error' or higher found!

0 comments on commit fa7161d

Please sign in to comment.