Skip to content

Commit

Permalink
Converts paths to relative
Browse files Browse the repository at this point in the history
This allows exclusions to work.
  • Loading branch information
jbeker committed Sep 17, 2020
1 parent 658bc30 commit 2acc05c
Show file tree
Hide file tree
Showing 2 changed files with 12 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
13 changes: 11 additions & 2 deletions Source/Scripts/RuboCopProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,22 @@ 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 2acc05c

Please sign in to comment.