Skip to content

Expose a setting to allow a user modify the working directory of linters - #15171

Merged
Kim-Adeline Miguel (kimadeline) merged 10 commits into
microsoft:mainfrom
matthewshirley:issue-15170/cwd-for-linting
Apr 6, 2021
Merged

Kim-Adeline Miguel (kimadeline) merged 10 commits into
microsoft:mainfrom
matthewshirley:issue-15170/cwd-for-linting

Conversation

@matthewshirley

@matthewshirley Matt Shirley (matthewshirley) commented Jan 19, 2021 •

Copy link
Copy Markdown

Closes #15170

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • The wiki is updated with any design decisions/details.

Labels

Needs skip package*.json

Tests

I'm uncertain where to introduce tests for this PR. I couldn't identify where it would fit. Let me know if they're need and the best suite for them. 💪

@karrtikr

Copy link
Copy Markdown

This may need to change after #15266 is merged.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Matt Shirley (@matthewshirley), thank you for your contribution!

Yep please add tests, src/test/linters/lint.functional.test.ts would be a good spot for them. Adding them to the existing suite should be fine.

I left a couple of comments regarding the type of the python.linting.cwd setting, they apply to src/test/linters/common.ts and src/test/mockClasses.ts as well.

Comment thread src/client/common/configSettings.ts Resolved
Comment thread src/client/common/types.ts Resolved
@kimadeline Kim-Adeline Miguel (kimadeline) added the skip package*.json package.json and package-lock.json don't both need updating label Mar 16, 2021
@bl-ue

bl-ue commented Mar 23, 2021

Copy link
Copy Markdown

Any progress? Dying for this feature.

@karrtikr

Copy link
Copy Markdown

bl-ue Waiting on Matt Shirley (@matthewshirley) to address the comments.

@matthewshirley

Copy link
Copy Markdown
Author

I will respond and work on tests for the PR this week. 👍 Thanks for the patience.

@karrtikr Kartik Raj (karrtikr) left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at

protected getWorkspaceRootPath(document: vscode.TextDocument): string {

Attempt to find all references to the method.

It looks like we assume that is the cwd in these places. For eg.

const cwd = this.getWorkspaceRootPath(document);

I think you'll need to adjust that method to return the correct cwd using the setting instead of the workspace root, and use the workspace root as default cwd if not set.

Comment thread news/1 Enhancements/15170.md Resolved
Comment thread src/client/linters/baseLinter.ts Resolved

@karrtikr Kartik Raj (karrtikr) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again for your contribution, Matt Shirley (@matthewshirley)! 🥳

@kimadeline
Kim-Adeline Miguel (kimadeline) merged commit bbdba53 into microsoft:main Apr 6, 2021
@bl-ue

bl-ue commented Apr 7, 2021

Copy link
Copy Markdown

🚀 🎊 🎉

@lg-kialo

Copy link
Copy Markdown

Thank you so much for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip package*.json package.json and package-lock.json don't both need updating

5 participants