diff --git a/Source/Scripts/Linter.js b/Source/Scripts/Linter.js index 9bdb7b0..4cb8469 100644 --- a/Source/Scripts/Linter.js +++ b/Source/Scripts/Linter.js @@ -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) { diff --git a/Source/Scripts/RuboCopProcess.js b/Source/Scripts/RuboCopProcess.js index eb33e0b..2144680 100644 --- a/Source/Scripts/RuboCopProcess.js +++ b/Source/Scripts/RuboCopProcess.js @@ -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;