Skip to content

Commit

Permalink
Configured RuboCop to omit cop names from returned messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmecham committed Feb 22, 2020
1 parent 1cdf126 commit 6faab92
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 4 additions & 1 deletion RuboCop.novaextension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# ChangeLog
## UNRELEASED

- Configured RuboCop to omit cop names from returned messages (the names were
previously being stripped manually during parsing).

## Version 0.2.1

Expand Down
4 changes: 1 addition & 3 deletions Source/Scripts/Offense.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ class Offense {

issue.source = "RuboCop";
issue.code = this.cop;

const cleanedMessage = this.message.replace(`${this.cop}: `, "");
issue.message = cleanedMessage;
issue.message = this.message;

if (this.severity == "warning") {
issue.severity = IssueSeverity.Warning;
Expand Down
6 changes: 5 additions & 1 deletion Source/Scripts/RuboCopProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ class RuboCopProcess {
constructor(path, content) {
this.path = path;
this.content = content;
this.defaultArguments = [
"--format=json",
"--no-display-cop-names"
];
}

get process() {
if (this._process) return this._process;

const process = new Process("/usr/bin/env", {
args: ["rubocop", "--format=json", "--stdin", this.path],
args: ["rubocop", this.defaultArguments, "--stdin", this.path].flat(),
cwd: nova.workspace.path,
stdio: "pipe"
});
Expand Down

0 comments on commit 6faab92

Please sign in to comment.