Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/5087.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
No prompt displayed to install pylint
2 changes: 1 addition & 1 deletion src/client/linters/linterInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class PylintLinterInfo extends LinterInfo {
}
// If we're using new LS, then by default Pylint is disabled (unless the user provides a value).
const inspection = this.workspaceService.getConfiguration('python', resource).inspect<boolean>('linting.pylintEnabled');
if (!inspection || (inspection.globalValue === undefined && (inspection.workspaceFolderValue === undefined || inspection.workspaceValue === undefined))) {
if (!inspection || (inspection.globalValue === undefined && (inspection.workspaceFolderValue === undefined && inspection.workspaceValue === undefined))) {
return false;
}
return enabled;
Expand Down
45 changes: 30 additions & 15 deletions src/test/linters/linterinfo.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,37 @@ suite('Linter Info - Pylint', () => {

expect(linterInfo.isEnabled()).to.be.false;
});
test('Test enabled when using Language Server and Pylint is configured', async () => {
const config = mock(ConfigurationService);
const workspaceService = mock(WorkspaceService);
const linterInfo = new PylintLinterInfo(instance(config), instance(workspaceService), []);
const testsForisEnabled =
[
{
testName: 'When workspaceFolder setting is provided',
inspection: { workspaceFolderValue: true }
},
{
testName: 'When workspace setting is provided',
inspection: { workspaceValue: true }
},
{
testName: 'When global setting is provided',
inspection: { globalValue: true }
}
];

const inspection = {
globalValue: 'something',
workspaceFolderValue: 'something',
workspaceValue: 'something'
};
const pythonConfig = {
inspect: () => inspection
};
when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: true }, jediEnabled: false } as any);
when(workspaceService.getConfiguration('python', anything())).thenReturn(pythonConfig as any);
suite('Test is enabled when using Language Server and Pylint is configured', () => {
Comment thread
karrtikr marked this conversation as resolved.
testsForisEnabled.forEach(testParams => {
test(testParams.testName, async () => {
const config = mock(ConfigurationService);
const workspaceService = mock(WorkspaceService);
const linterInfo = new PylintLinterInfo(instance(config), instance(workspaceService), []);

expect(linterInfo.isEnabled()).to.be.true;
const pythonConfig = {
inspect: () => testParams.inspection
};
when(config.getSettings(anything())).thenReturn({ linting: { pylintEnabled: true }, jediEnabled: false } as any);
when(workspaceService.getConfiguration('python', anything())).thenReturn(pythonConfig as any);

expect(linterInfo.isEnabled()).to.be.true;
});
});
});
});