Skip to content

Commit

Permalink
Merge pull request #11 from jbeker/master
Browse files Browse the repository at this point in the history
Passes relative path to rubocop
  • Loading branch information
jsmecham authored Sep 17, 2020
2 parents e994140 + 7aaa27a commit 4fb95cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/Scripts/Linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Linter {
const contentRange = new Range(0, document.length);
const content = document.getTextInRange(contentRange);

return this.lintString(content, document.uri);
return this.lintString(content, document.path);
}

async lintString(string, uri) {
Expand Down
12 changes: 10 additions & 2 deletions Source/Scripts/RuboCopProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,21 @@ class RuboCopProcess {
}

async execute(content, uri) {
let workspaceOverlap = uri.indexOf(nova.workspace.path);
let relativePath = '';

if (workspaceOverlap != -1) {
relativePath = uri.substring(workspaceOverlap + nova.workspace.path.length + 1);
} else {
relativePath = uri;
}

const defaultArguments = [
"rubocop",
"--format=json",
"--stdin",
uri
relativePath
];

const process = await this.process(defaultArguments);
if (!process) return;

Expand Down

0 comments on commit 4fb95cc

Please sign in to comment.