From 38a8afd4a475e72fb46d8205b4c3189621f129af Mon Sep 17 00:00:00 2001 From: TSMMark Date: Thu, 8 Dec 2022 13:17:31 -0500 Subject: [PATCH 1/3] try: dont warn Found multiple files when they are the same file --- src/rubocop.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rubocop.ts b/src/rubocop.ts index 0a1ecd1..fef1856 100644 --- a/src/rubocop.ts +++ b/src/rubocop.ts @@ -87,13 +87,22 @@ function getCurrentPath(fileUri: vscode.Uri): string { function getCommandArguments(fileName: string): string[] { let commandArguments = ['--stdin', fileName, '--force-exclusion']; const extensionConfig = getConfig(); + if (extensionConfig.configFilePath !== '') { - const found = [extensionConfig.configFilePath] + const expandedConfigFilePath = path.isAbsolute( + extensionConfig.configFilePath + ) + ? extensionConfig.configFilePath + : path.resolve(extensionConfig.configFilePath); + + const found = [expandedConfigFilePath] .concat( (vscode.workspace.workspaceFolders || []).map((ws) => path.join(ws.uri.path, extensionConfig.configFilePath) ) ) + // dedupe + .filter((v, i, a) => a.indexOf(v) === i) .filter((p: string) => fs.existsSync(p)); if (found.length == 0) { From 05bd093ce8bff633a642be17a1edc39662c84e1d Mon Sep 17 00:00:00 2001 From: TSMMark Date: Thu, 8 Dec 2022 13:31:32 -0500 Subject: [PATCH 2/3] s/clic/click/ typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7124c01..74b10c3 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ gem install rubocop If VSCode market place is not configured in your FLOSS distribution of code (you have Open VSX instead): -1. Go on [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=misogi.ruby-rubocop) and clic on the [Download Extension](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/misogi/vsextensions/ruby-rubocop/0.8.5/vspackage) button. +1. Go on [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=misogi.ruby-rubocop) and click on the [Download Extension](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/misogi/vsextensions/ruby-rubocop/0.8.5/vspackage) button. 2. Install the extension manually from the CLI: `code --install-extension misogi.ruby-rubocop-0.8.5.vsix` # ChangeLog From 3a5fa89e509eef96ee6a48b400d5fb7b99021c5b Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Mon, 3 Apr 2023 16:03:41 -0400 Subject: [PATCH 3/3] path.resolve is no-op when already absolute @skipants suggestion --- src/rubocop.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/rubocop.ts b/src/rubocop.ts index fef1856..1888838 100644 --- a/src/rubocop.ts +++ b/src/rubocop.ts @@ -89,11 +89,7 @@ function getCommandArguments(fileName: string): string[] { const extensionConfig = getConfig(); if (extensionConfig.configFilePath !== '') { - const expandedConfigFilePath = path.isAbsolute( - extensionConfig.configFilePath - ) - ? extensionConfig.configFilePath - : path.resolve(extensionConfig.configFilePath); + const expandedConfigFilePath = path.resolve(extensionConfig.configFilePath); const found = [expandedConfigFilePath] .concat(