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

Improves linting behavior per #722 #792

Merged
merged 87 commits into from
Feb 16, 2018
Merged

Improves linting behavior per #722 #792

merged 87 commits into from
Feb 16, 2018

Conversation

MikhailArkhipov
Copy link

#722

  • Re-lint when interpreter changes
  • Re-lint when user saves pylintrc from VSC
  • Added Run Linter command to force linting when, for example, user changed .pylintrc elsewhere or user external editor

Moved linting code from linter provider into new linter engine

@DonJayamanne
Copy link

Don't we need any tests for this new functionality?

@MikhailArkhipov
Copy link
Author

MikhailArkhipov commented Feb 15, 2018

Done

* @readonly
*/
// tslint:disable-next-line:member-ordering
readonly textDocuments: TextDocument[];

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

OK

this.interpreterService = serviceContainer.get<IInterpreterService>(IInterpreterService);

this.disposables.push(this.interpreterService.onDidChangeInterpreter(() => this.engine.lintOpenPythonFiles()));
this.disposables.push(vscode.workspace.onDidSaveTextDocument((e) => this.onDocumentSaved(e)));

Choose a reason for hiding this comment

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

Please use IWorkspaceService instead of vscode.workspace

const fileName = path.basename(document.uri.fsPath).toLowerCase();
const watchers = linters.filter((info) => info.configFileNames.indexOf(fileName) >= 0);
if (watchers.length > 0) {
setTimeout(() => this.engine.lintOpenPythonFiles(), 1000);

Choose a reason for hiding this comment

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

We need to lint just this one file, not all open files.
Else, if user has 10 python files opened, we'd be linting all 10 files everytime.
It gets worse with the auto-save feature in VS Code, as you start typing the document gets saved, i.e. linting all files again just while the user is typting.

Choose a reason for hiding this comment

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

Should just call this.engine.lintDocument(document, 'auto')

Copy link
Author

Choose a reason for hiding this comment

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

Actually, this is config change so more than a single file is affected.

@DonJayamanne
Copy link

Oops, forgot to hit the Submit button. Had done review a while back.

@codecov
Copy link

codecov bot commented Feb 15, 2018

Codecov Report

Merging #792 into master will increase coverage by 0.18%.
The diff coverage is 90.1%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #792      +/-   ##
==========================================
+ Coverage   63.26%   63.45%   +0.18%     
==========================================
  Files         257      258       +1     
  Lines       11720    11764      +44     
  Branches     2081     2081              
==========================================
+ Hits         7415     7465      +50     
+ Misses       4297     4291       -6     
  Partials        8        8
Impacted Files Coverage Δ
src/client/interpreter/display/index.ts 100% <ø> (+6.89%) ⬆️
src/client/interpreter/contracts.ts 100% <ø> (ø) ⬆️
src/client/common/application/types.ts 100% <ø> (ø) ⬆️
src/client/common/application/workspace.ts 39.13% <0%> (-3.73%) ⬇️
src/client/linters/linterInfo.ts 100% <100%> (ø) ⬆️
src/client/extension.ts 97.29% <100%> (+3.83%) ⬆️
src/client/common/application/documentManager.ts 55.55% <100%> (+12.69%) ⬆️
src/client/linters/linterManager.ts 80.26% <100%> (ø) ⬆️
src/client/linters/linterCommands.ts 88.46% <100%> (+0.96%) ⬆️
src/client/linters/types.ts 100% <100%> (ø) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc910b6...780a58d. Read the comment docs.

/**
* An event that is emitted when a [text document](#TextDocument) is opened.
*/
readonly onDidOpenTextDocument: Event<TextDocument>;

Choose a reason for hiding this comment

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

@MikhailArkhipov MikhailArkhipov merged commit 18be595 into microsoft:master Feb 16, 2018
}

// tslint:disable-next-line:no-any
public async linkJupiterExtension(jupiter: vscode.Extension<any> | undefined): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

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

Oops, misspelled "Jupyter".

@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.

3 participants