Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pylint not enabled by default, can be easily enabled for workspaces that have it available. #2913

Merged
merged 16 commits into from
Oct 24, 2018

Conversation

d3r3kk
Copy link

@d3r3kk d3r3kk commented Oct 17, 2018

Fix for #974

pylint is easily enabled for workspaces that have it available, but it is no longer set at the global default for the vscode-python extension.

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Has a news entry file (remember to thank yourself!)
  • Unit tests & system/integration tests are added/updated
  • package-lock.json has been regenerated by running npm install (if dependencies have changed)

src/test/common/configSettings.multiroot.test.ts Outdated Show resolved Hide resolved
src/client/linters/linterManager.ts Outdated Show resolved Hide resolved
src/client/linters/linterManager.ts Outdated Show resolved Hide resolved
src/client/linters/linterManager.ts Outdated Show resolved Hide resolved
src/client/linters/linterManager.ts Outdated Show resolved Hide resolved
src/client/linters/linterManager.ts Outdated Show resolved Hide resolved
src/client/linters/types.ts Outdated Show resolved Hide resolved
src/client/linters/types.ts Outdated Show resolved Hide resolved
src/test/linters/lint.test.ts Show resolved Hide resolved
src/client/linters/linterAvailability.ts Outdated Show resolved Hide resolved
public isFeatureEnabled(): boolean {
const ws = this.workspaceConfig.getConfiguration('python');
const jediEnabled = ws!.inspect('jediEnabled');
return (!jediEnabled || jediEnabled.defaultValue === false);

Choose a reason for hiding this comment

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

Please use IConfigurationService instead, that's strongly typed.
You don't need to use inspect and such low level checks.

@inject(IConfigurationService) private readonly configurationServivce.... in the constructor

Then, use the following code:

public get isFeatureEnabled(){
return this.configurationService.getSettings().jediEnabled;

Copy link
Author

Choose a reason for hiding this comment

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

Unfortunately in this case we need the lower level.

Our new availability check feature is enabled only after python.jediEnabled default value is false.

Our availability check will only prompt when the linter being checked (pylint for now, maybe others later) has not been configured by the user in any way yet.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, slight misunderstanding here - getting the python.jediEnabled setting is definitely better off using the IConfigurationService so we can enable this feature for all people using the Python Language Server, not just when we make it the default. Made the change.

@d3r3kk d3r3kk closed this Oct 23, 2018
@d3r3kk

This comment has been minimized.

@d3r3kk d3r3kk reopened this Oct 23, 2018
@d3r3kk d3r3kk closed this Oct 24, 2018
@d3r3kk d3r3kk reopened this Oct 24, 2018
Fix for microsoft#974

- Pylint is easily enabled for workspaces that have it available
- Revert removal of skip() from test suite.
- Fix naming of a few methods
- Update method documentation to jsdocs format
- flag changed from `checkAvailable` to `silent`
- affects calls to `getActiveLinters` and `isLintingEnabled`
- new class `AvailableLinterActivator`
- DI enable the new class
- correct some issues with DI usage in the original logic
- add check for 'is feature enabled' and test for it too
- feature is enabled when python.jediEnabled=false by default
- Also fixed up tests to make them far simpler to read.
- When determining the jediEnabled state.
- Turns this feature on for anyone using the MPLS
- ensure only valid linters can be set (we can't default to pylint anymore)
- ensure await is called for isLintingEnabled.
- update test suite setup
  - include the new linter availability dependancy
- correct linterProvider to be async onDocumentSave
- remove previous debugging-only code from linterManager!
@d3r3kk d3r3kk merged commit 724bcce into microsoft:master Oct 24, 2018
@d3r3kk d3r3kk deleted the 974_non-default-pylint branch October 24, 2018 22:34
@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants