Fix pylint 2.16 warnings

This commit is contained in:
Rodrigo Q. Saramago 2023-02-01 13:22:08 +01:00 committed by Matheus Aguiar
parent 37953a7eb0
commit 828f95ad9e
4 changed files with 7 additions and 6 deletions

View File

@ -251,7 +251,7 @@ def detect_metadata_cli_option_support(compiler_path: Path):
f"Compiler output:\n{process.stderr}\n", f"Compiler output:\n{process.stderr}\n",
file=sys.stderr file=sys.stderr
) )
raise Exception("Failed to determine if the compiler supports the --metadata option.") raise RuntimeError("Failed to determine if the compiler supports the --metadata option.")
return process.returncode == 0 return process.returncode == 0

View File

@ -75,7 +75,7 @@ def collect_statistics(lines) -> (int, int, int, int, int, int):
""" """
if not lines: if not lines:
raise Exception("Empty list") raise RuntimeError("Empty list")
def try_parse(line): def try_parse(line):
try: try:

View File

@ -23,6 +23,7 @@ disable=
no-else-return, no-else-return,
pointless-string-statement, pointless-string-statement,
redefined-outer-name, redefined-outer-name,
superfluous-parens,
too-few-public-methods, too-few-public-methods,
too-many-arguments, too-many-arguments,
too-many-branches, too-many-branches,

View File

@ -591,7 +591,7 @@ class FileTestRunner:
for diagnostics in published_diagnostics: for diagnostics in published_diagnostics:
if not diagnostics["uri"].startswith(self.suite.project_root_uri + "/"): if not diagnostics["uri"].startswith(self.suite.project_root_uri + "/"):
raise Exception( raise RuntimeError(
f"'{self.test_name}.sol' imported file outside of test directory: '{diagnostics['uri']}'" f"'{self.test_name}.sol' imported file outside of test directory: '{diagnostics['uri']}'"
) )
self.open_tests.append(self.suite.normalizeUri(diagnostics["uri"])) self.open_tests.append(self.suite.normalizeUri(diagnostics["uri"]))
@ -804,9 +804,9 @@ class FileTestRunner:
if tag == desired_tag: if tag == desired_tag:
return tagRange return tagRange
elif tag.lower() == desired_tag.lower(): elif tag.lower() == desired_tag.lower():
raise Exception(f"Detected lower/upper case mismatch: Requested {desired_tag} but only found {tag}") raise RuntimeError(f"Detected lower/upper case mismatch: Requested {desired_tag} but only found {tag}")
raise Exception(f"Marker {desired_tag} not found in file") raise RuntimeError(f"Marker {desired_tag} not found in file")
# Check if we need markers from a specific file # Check if we need markers from a specific file
@ -1032,7 +1032,7 @@ class SolidityLSPTestSuite: # {{{
tag = self.find_tag_with_range(testname, local_sub_dir, diagnostic['range']) tag = self.find_tag_with_range(testname, local_sub_dir, diagnostic['range'])
if tag is None: if tag is None:
raise Exception(f"No tag found for diagnostic range {diagnostic['range']}") raise RuntimeError(f"No tag found for diagnostic range {diagnostic['range']}")
expectations += f" {tag} {diagnostic['code']}" expectations += f" {tag} {diagnostic['code']}"
expectations += "\n" expectations += "\n"