Repair rubocop refusing to run (#97) - #262
Conversation
e89f937 to
3519ab6
Compare
3519ab6 to
6d617ee
Compare
6d617ee to
7402d95
Compare
- Upgrade dependencies - Use ESlint instead of TSLint(obsolete) - Remove a null token parameter in findFiles call, generating extension load error - Replace rootPath (deprecated) by workspaceFolders[0].uri.fsPath - Correct a language/snippet file loading problem(berkshelf vs berkfile) (chef#142) - Correct gif image url in README (master branch now is main) - Escape $ in some snippet description to avoid warning from VSCode Signed-off-by: Nicolas Blanc <sinfomicien@gmail.com>
7402d95 to
260aa8c
Compare
|
|
@clintoncwolfe , is it possible to review this PR ? Could it be merged at some point ? |
|
@nikhil2611 could you review the PR please ? |
|
Hey @sinfomicien , Please review the updated changes |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: nikhil2611 <ngupta@progress.com>
- Add null/undefined checks before accessing workspaceFolders[0] - Prevent runtime errors when no workspace is open - Extract workspaceRoot to const for cleaner code and single access point Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: nikhil2611 <ngupta@progress.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to get the VS Code Chef extension back into a healthy/runnable state by addressing several extension activation, linting, and language/snippet loading issues (including the Berksfile grammar wiring mentioned in #142), alongside dependency/CI maintenance updates.
Changes:
- Adds/rewires Berksfile language grammar support (new
chef_berksfilesyntax file + package.json grammar entry changes). - Adjusts Rubocop/Cookstyle execution logic (workspace folder handling, spawn options) and fixes a
findFilescall signature issue. - Updates snippet content to avoid
$-related snippet parsing warnings and refreshes a README asset URL.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| syntaxes/chef_berksfile.cson.json | Introduces a Berksfile TextMate grammar shim (includes Ruby scope). |
| snippets/chef_inspec_resources.json | Escapes $ in snippet bodies and adjusts a couple of description strings. |
| README.md | Updates the install/demo GIF URL. |
| package.json | Updates activation/grammar contributions, including Berksfile grammar mapping. |
| extension.ts | Fixes findFiles token usage, updates workspace root handling, and adjusts Rubocop spawning. |
| .github/dependabot.yml | Removes dependency ignore rules. |
Suppressed comments (1)
snippets/chef_inspec_resources.json:2711
- Snippet
descriptionstrings are displayed as plain text; escaping$here will show the backslash to users (e.g.\$ORACLE_HOME). Keep$ORACLE_HOMEunescaped in the description and only escape$where snippet parsing occurs (thebody).
"description": "Use the `oracledb_listener_conf` Chef InSpec audit resource to test the listeners settings of Oracle DB, typically located at `\\$ORACLE_HOME/network/admin/listener.ora` or `\\$ORACLE_HOME\\network\\admin\\listener.ora` depending upon the platform.",
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Fix scopeName mismatch in package.json (source.chef.chef_berksfile → source.chef.berksfile) - Add workspace trust check before executing external binaries - Make shell option conditional (Windows only) to reduce security risk - Fix README image URL to use raw.githubusercontent.com - Remove unnecessary escaping from snippet descriptions (keep in body only) These changes improve security, correctness, and user experience. Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: nikhil2611 <ngupta@progress.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: nikhil2611 <ngupta@progress.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (2)
package.json:30
- With only
workspaceContains:**/metadata.rbinactivationEvents, the extension won’t activate for non-cookbook workspaces (for example, InSpec profiles) even though this extension contributeschef_inspec/chef_berksfilelanguages. That prevents linting/commands from running unless ametadata.rbexists. Consider re-addingonLanguage:*activation events for the Chef languages so the extension activates when those file types are opened.
"activationEvents": [
"workspaceContains:**/metadata.rb"
],
extension.ts:231
shell: isWindowswas added for the main rubocop run here, butcheckCookstyleVersion()still spawnsrubocopPathwithoutshell. On Windows,rubocopPathis a.bat(see candidate paths), so the version check is likely to fail even though the main lint run now works. Please apply the sameshellhandling to the version check spawn as well.
const isWindows = process.platform === 'win32';
let spawn = require("child_process").spawnSync;
let rubocop: any;
if (rubocopConfigFile) {
rubocop = spawn(rubocopPath, ["--parallel", "--config", rubocopConfigFile, "-f", "j"].concat(paths), { shell: isWindows, cwd: workspaceRoot });
|
Everything seems ok to me ! |



Description
As i start to look into the problem, got multiples problem to handle. So i tried to correct them all:
Now, all problems are correctly highlighted (even if for now, it’s not possible to correct them automatically).
Types of changes
Checklist:
Gemfile.lockhas changed, I have used--conservativeto do it and included the full output in the Description above.