Skip to content

Commit bf017ff

Browse files
Merge pull request #7 from Bandwidth/DX-2928
Update Ruleset Argument to use given file path.
2 parents 90fa839 + edc15d6 commit bf017ff

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/lint.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ export const handler = async (argv: Arguments<Options>): Promise<void> => {
7979
const { specPath, save, json, ruleset } = argv;
8080
const specFile = fs.readFileSync(specPath, "utf8");
8181
const spec = YAML.parse(specFile);
82-
var specName = path.basename(specPath,path.extname(specPath));
82+
var specName = path.basename(specPath, path.extname(specPath));
8383

8484
// attempt to download the ruleset if no local file was provided
85-
var downloadSuccess;
86-
if(!ruleset){
85+
var downloadSuccess;
86+
if (!ruleset) {
8787
downloadSuccess = true;
8888
try {
8989
await downloadRuleset(rulesetUrl, rulesetFilepath);
@@ -97,7 +97,7 @@ export const handler = async (argv: Arguments<Options>): Promise<void> => {
9797
downloadSuccess = false;
9898
}
9999
} else {
100-
rulesetFilepath = path.join(__dirname, "..", ruleset);
100+
rulesetFilepath = ruleset;
101101
}
102102

103103
// Setup Spectral and load ruleset

tests/cli.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const testLint = (args) => {
1010
};
1111

1212
const testLintWithLocalRuleset = (args) => {
13-
return execSync(`node build/cli.js lint ${args} -j -r ../src/static/.local.spectral.yaml`).toString();
13+
return execSync(`node build/cli.js lint ${args} -j -r ${__dirname + "/../src/static/.local.spectral.yaml"}`).toString();
1414
};
1515

1616
describe("cli", () => {

0 commit comments

Comments
 (0)