diff --git a/readme.md b/readme.md index e1127cb48..de706cc85 100644 --- a/readme.md +++ b/readme.md @@ -130,6 +130,7 @@ Settings available (in your VSCode workspace) for each of the linters: "lint": true, //enable all lint cops. "only": [/* array: Run only the specified cop(s) and/or cops in the specified departments. */], "except": [/* array: Run all cops enabled by configuration except the specified cop(s) and/or departments. */], + "forceExclusion": true, //Add --force-exclusion option "require": [/* array: Require Ruby files. */], "rails": true //Run extra rails cops } diff --git a/src/lint/lib/linters/RuboCop.js b/src/lint/lib/linters/RuboCop.js index d0b1b68da..96c1cce08 100644 --- a/src/lint/lib/linters/RuboCop.js +++ b/src/lint/lib/linters/RuboCop.js @@ -8,6 +8,7 @@ function RuboCop(opts) { this.args = ["-s", "{path}", "-f", "json"] ; + if (opts.forceExclusion) this.args.push("--force-exclusion"); if (opts.lint) this.args.push("-l"); if (opts.only) this.args = this.args.concat("--only", opts.only.join(',')); if (opts.except) this.args = this.args.concat("--except", opts.except.join(',')); @@ -20,6 +21,9 @@ RuboCop.prototype.processResult = function (data) { return []; } let offenses = JSON.parse(data); + if (offenses.summary.offense_count == 0) { + return []; + } return (offenses.files || [{ offenses: [] }])[0].offenses;