Skip to content

Commit 0746f2a

Browse files
committed
pylint_all: Make better use of the PROJECT_ROOT variable
1 parent 9b3e714 commit 0746f2a

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

scripts/pylint_all.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
from sys import exit as exitwith
1010
from textwrap import dedent
1111

12-
PROJECT_ROOT = path.dirname(path.realpath(__file__))
13-
PYLINT_RCFILE = "{}/pylintrc".format(PROJECT_ROOT)
12+
PROJECT_ROOT = path.dirname(path.dirname(path.realpath(__file__)))
13+
PYLINT_RCFILE = f"{PROJECT_ROOT}/scripts/pylintrc"
1414

1515
SGR_INFO = "\033[1;32m"
1616
SGR_CLEAR = "\033[0m"
@@ -61,10 +61,14 @@ def parse_command_line():
6161

6262
def main():
6363
options = parse_command_line()
64-
failed_count, total_count = pylint_all_filenames(options.dev_mode, [
65-
path.abspath(path.dirname(__file__) + "/../docs"),
66-
path.abspath(path.dirname(__file__) + "/../scripts"),
67-
path.abspath(path.dirname(__file__) + "/../test")])
64+
65+
rootdirs = [
66+
f"{PROJECT_ROOT}/docs",
67+
f"{PROJECT_ROOT}/scripts",
68+
f"{PROJECT_ROOT}/test",
69+
]
70+
(failed_count, total_count) = pylint_all_filenames(options.dev_mode, rootdirs)
71+
6872
if failed_count != 0:
6973
exitwith("pylint failed on {}/{} files.".format(failed_count, total_count))
7074
else:

0 commit comments

Comments
 (0)