Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Add forceExclusion flag to rubocop setting
Browse files Browse the repository at this point in the history
  • Loading branch information
cyangle committed Oct 29, 2017
1 parent e2ff810 commit b5cb94b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Join the chat at https://rubyide-slackin.azurewebsites.net](./images/badge.png)](https://rubyide-slackin.azurewebsites.net) [![Build Status](https://api.travis-ci.org/rubyide/vscode-ruby.svg?branch=master)](https://travis-ci.org/rubyide/vscode-ruby) [![Build status](https://ci.appveyor.com/api/projects/status/vlgs2y7tsc4xpj4c?svg=true)](https://ci.appveyor.com/project/rebornix/vscode-ruby)

This extension provides rich Ruby language and debugging support for VS Code. It's still in progress ( [GitHub](https://github.com/rubyide/vscode-ruby.git) ), please expect frequent updates with breaking changes before 1.0.
This extension provides rich Ruby language and debugging support for VS Code. It's still in progress ( [GitHub](https://github.com/rubyide/vscode-ruby.git) ), please expect frequent updates with breaking changes before 1.0.

It started as a personal project of [@rebornix](https://github.com/rebornix), aiming to bring Ruby debugging experience to VS Code. Then it turned to be a community driven project. With his amazing commits, [@HookyQR](https://github.com/HookyQR) joined as a contributor and brought users Linting/Formatting/etc, made the debugger more robust and more! If you are interested in this project, feel free to join the [community](https://github.com/rubyide/vscode-ruby/graphs/contributors): file [issues](https://github.com/rubyide/vscode-ruby/issues/new), fork [our project](https://github.com/rubyide/vscode-ruby) and hack it around and send us PRs, or subscribe to our [mailing list](http://eepurl.com/bTBAfv).

Expand Down Expand Up @@ -106,6 +106,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
}
Expand Down
4 changes: 4 additions & 0 deletions src/lint/lib/linters/RuboCop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(','));
Expand All @@ -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;
Expand Down

0 comments on commit b5cb94b

Please sign in to comment.