Merge pull request #12379 from Pierre-Sassoulas/more-pylint-fixes
[pylint] Fix ``consider-using-sys-exit``, ``use-yield-from``, and ``implicit-str-concat``
This commit is contained in:
commit
0ba3e91fbd
|
@ -1,5 +1,6 @@
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ def get_issues():
|
||||||
if r.status_code == 403:
|
if r.status_code == 403:
|
||||||
# API request limit exceeded
|
# API request limit exceeded
|
||||||
print(data["message"])
|
print(data["message"])
|
||||||
exit(1)
|
sys.exit(1)
|
||||||
issues.extend(data)
|
issues.extend(data)
|
||||||
|
|
||||||
# Look for next page
|
# Look for next page
|
||||||
|
|
|
@ -190,7 +190,6 @@ disable = [
|
||||||
"consider-using-from-import",
|
"consider-using-from-import",
|
||||||
"consider-using-f-string",
|
"consider-using-f-string",
|
||||||
"consider-using-in",
|
"consider-using-in",
|
||||||
"consider-using-sys-exit",
|
|
||||||
"consider-using-ternary",
|
"consider-using-ternary",
|
||||||
"consider-using-with",
|
"consider-using-with",
|
||||||
"cyclic-import",
|
"cyclic-import",
|
||||||
|
@ -201,7 +200,6 @@ disable = [
|
||||||
"expression-not-assigned",
|
"expression-not-assigned",
|
||||||
"fixme",
|
"fixme",
|
||||||
"global-statement",
|
"global-statement",
|
||||||
"implicit-str-concat",
|
|
||||||
"import-error",
|
"import-error",
|
||||||
"import-outside-toplevel",
|
"import-outside-toplevel",
|
||||||
"inconsistent-return-statements",
|
"inconsistent-return-statements",
|
||||||
|
@ -212,10 +210,9 @@ disable = [
|
||||||
"keyword-arg-before-vararg",
|
"keyword-arg-before-vararg",
|
||||||
"line-too-long",
|
"line-too-long",
|
||||||
"method-hidden",
|
"method-hidden",
|
||||||
"misplaced-bare-raise",
|
|
||||||
"missing-docstring",
|
"missing-docstring",
|
||||||
"missing-timeout",
|
"missing-timeout",
|
||||||
"multiple-statements",
|
"multiple-statements", # multiple-statements-on-one-line-colon (E701) from ruff
|
||||||
"no-else-break",
|
"no-else-break",
|
||||||
"no-else-continue",
|
"no-else-continue",
|
||||||
"no-else-raise",
|
"no-else-raise",
|
||||||
|
|
|
@ -161,15 +161,13 @@ class Visitor:
|
||||||
)
|
)
|
||||||
if not self.breadthfirst:
|
if not self.breadthfirst:
|
||||||
for subdir in dirs:
|
for subdir in dirs:
|
||||||
for p in self.gen(subdir):
|
yield from self.gen(subdir)
|
||||||
yield p
|
|
||||||
for p in self.optsort(entries):
|
for p in self.optsort(entries):
|
||||||
if self.fil is None or self.fil(p):
|
if self.fil is None or self.fil(p):
|
||||||
yield p
|
yield p
|
||||||
if self.breadthfirst:
|
if self.breadthfirst:
|
||||||
for subdir in dirs:
|
for subdir in dirs:
|
||||||
for p in self.gen(subdir):
|
yield from self.gen(subdir)
|
||||||
yield p
|
|
||||||
|
|
||||||
|
|
||||||
class FNMatcher:
|
class FNMatcher:
|
||||||
|
|
|
@ -401,7 +401,7 @@ class LogCaptureHandler(logging_StreamHandler):
|
||||||
# The default behavior of logging is to print "Logging error"
|
# The default behavior of logging is to print "Logging error"
|
||||||
# to stderr with the call stack and some extra details.
|
# to stderr with the call stack and some extra details.
|
||||||
# pytest wants to make such mistakes visible during testing.
|
# pytest wants to make such mistakes visible during testing.
|
||||||
raise
|
raise # pylint: disable=misplaced-bare-raise
|
||||||
|
|
||||||
|
|
||||||
@final
|
@final
|
||||||
|
|
|
@ -207,7 +207,7 @@ class CommonFSTests:
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"fil",
|
"fil",
|
||||||
["*dir", "*dir", pytest.mark.skip("sys.version_info <" " (3,6)")(b"*dir")],
|
["*dir", "*dir", pytest.mark.skip("sys.version_info < (3,6)")(b"*dir")],
|
||||||
)
|
)
|
||||||
def test_visit_filterfunc_is_string(self, path1, fil):
|
def test_visit_filterfunc_is_string(self, path1, fil):
|
||||||
lst = []
|
lst = []
|
||||||
|
|
|
@ -1163,7 +1163,7 @@ class TestNewFirst:
|
||||||
)
|
)
|
||||||
|
|
||||||
p1.write_text(
|
p1.write_text(
|
||||||
"def test_1(): assert 1\n" "def test_2(): assert 1\n", encoding="utf-8"
|
"def test_1(): assert 1\ndef test_2(): assert 1\n", encoding="utf-8"
|
||||||
)
|
)
|
||||||
os.utime(p1, ns=(p1.stat().st_atime_ns, int(1e9)))
|
os.utime(p1, ns=(p1.stat().st_atime_ns, int(1e9)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue