Skip to content

Commit dae0541

Browse files
authored
Explicitly list out all E checkers for Pylint (#975)
Due to a bug in Pylint where specifying `E` as enabled checks flips on `--py3k`, we need to explicitly list all `E` checkers to explicitly avoid (at least) print-statement which throws false-positives for folks not porting to Python 3. Closes #722 by partially reverting #954
1 parent 563f11d commit dae0541

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/client/linters/pylint.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,31 @@ export class Pylint extends BaseLinter {
3939
&& !await Pylint.hasConfigrationFileInWorkspace(this.fileSystem, path.dirname(uri.fsPath), workspaceRoot)
4040
// Check for pylintrc at the root and above
4141
&& !await Pylint.hasConfigurationFile(this.fileSystem, this.getWorkspaceRootPath(document), this.platformService)) {
42+
// Disable all checkers up front and then selectively add back in:
43+
// - All F checkers
44+
// - Select W checkers
45+
// - All E checkers _manually_
46+
// (see https://github.com/Microsoft/vscode-python/issues/722 for
47+
// why; see
48+
// https://gist.github.com/brettcannon/eff7f38a60af48d39814cbb2f33b3d1d
49+
// for a script to regenerate the list of E checkers)
4250
minArgs = [
4351
'--disable=all',
44-
'--enable=F,E,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-string,bad-open-mode',
45-
'–-disable=print-statement'
52+
'--enable=F'
53+
+ ',unreachable,duplicate-key,unnecessary-semicolon'
54+
+ ',global-variable-not-assigned,unused-variable'
55+
+ ',unused-wildcard-import,binary-op-exception'
56+
+ ',bad-format-string,anomalous-backslash-in-string'
57+
+ ',bad-open-mode'
58+
+ ',E0001,E0011,E0012,E0100,E0101,E0102,E0103,E0104,E0105,E0107'
59+
+ ',E0108,E0110,E0111,E0112,E0113,E0114,E0115,E0116,E0117,E0118'
60+
+ ',E0202,E0203,E0211,E0213,E0236,E0237,E0238,E0239,E0240,E0241'
61+
+ ',E0301,E0302,E0303,E0401,E0402,E0601,E0602,E0603,E0604,E0611'
62+
+ ',E0632,E0633,E0701,E0702,E0703,E0704,E0710,E0711,E0712,E1003'
63+
+ ',E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127'
64+
+ ',E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137'
65+
+ ',E1138,E1139,E1200,E1201,E1205,E1206,E1300,E1301,E1302,E1303'
66+
+ ',E1304,E1305,E1306,E1310,E1700,E1701'
4667
];
4768
}
4869
const args = [

0 commit comments

Comments
 (0)