Method: pylint.lint.pylinter.PyLinter.check
Calls: 1069, Exceptions: 0, Paths: 5Back
Path 1: 1028 calls (0.96)
['/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/config/file_to_lint.py'] (50) ['/Users/andrehora/Documents/git/projects-pathspotter...
1def check(self, files_or_modules: Sequence[str] | str) -> None:
2 """Main checking entry: check a list of files or modules from their name.
3
4 files_or_modules is either a string or list of strings presenting modules to check.
5 """
6 # 1) Initialize
7 self.initialize()
8
9 # 2) Gather all files
10 if not isinstance(files_or_modules, (list, tuple)):
11 # TODO: 3.0: Remove deprecated typing and update docstring
12 warnings.warn(
13 "In pylint 3.0, the checkers check function will only accept sequence of string",
14 DeprecationWarning,
15 stacklevel=2,
16 )
17 files_or_modules = (files_or_modules,) # type: ignore[assignment]
18 if self.config.recursive:
19 files_or_modules = tuple(self._discover_files(files_or_modules))
20 if self.config.from_stdin:
21 if len(files_or_modules) != 1:
22 raise exceptions.InvalidArgsError(
23 "Missing filename required for --from-stdin"
24 )
25
26 # TODO: Move the parallel invocation into step 5 of the checking process
27 if not self.config.from_stdin and self.config.jobs > 1:
28 original_sys_path = sys.path[:]
29 check_parallel(
30 self,
31 self.config.jobs,
32 self._iterate_file_descrs(files_or_modules),
33 files_or_modules, # this argument patches sys.path
34 )
35 sys.path = original_sys_path
36 return
37
38 # 3) Get all FileItems
39 with fix_import_path(files_or_modules):
40 if self.config.from_stdin:
41 fileitems = self._get_file_descr_from_stdin(files_or_modules[0])
42 data: str | None = _read_stdin()
43 else:
44 fileitems = self._iterate_file_descrs(files_or_modules)
45 data = None
46
47 # The contextmanager also opens all checkers and sets up the PyLinter class
48 with fix_import_path(files_or_modules):
49 with self._astroid_module_checker() as check_astroid_module:
50 # 4) Get the AST for each FileItem
51 ast_per_fileitem = self._get_asts(fileitems, data)
52
53 # 5) Lint each ast
54 self._lint_files(ast_per_fileitem, check_astroid_module)
Path 2: 19 calls (0.02)
['/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/config/file_to_lint.py'] (11) ['/Users/andrehora/Documents/git/projects-pathspotter...
None (19)
1def check(self, files_or_modules: Sequence[str] | str) -> None:
2 """Main checking entry: check a list of files or modules from their name.
3
4 files_or_modules is either a string or list of strings presenting modules to check.
5 """
6 # 1) Initialize
7 self.initialize()
8
9 # 2) Gather all files
10 if not isinstance(files_or_modules, (list, tuple)):
11 # TODO: 3.0: Remove deprecated typing and update docstring
12 warnings.warn(
13 "In pylint 3.0, the checkers check function will only accept sequence of string",
14 DeprecationWarning,
15 stacklevel=2,
16 )
17 files_or_modules = (files_or_modules,) # type: ignore[assignment]
18 if self.config.recursive:
19 files_or_modules = tuple(self._discover_files(files_or_modules))
20 if self.config.from_stdin:
21 if len(files_or_modules) != 1:
22 raise exceptions.InvalidArgsError(
23 "Missing filename required for --from-stdin"
24 )
25
26 # TODO: Move the parallel invocation into step 5 of the checking process
27 if not self.config.from_stdin and self.config.jobs > 1:
28 original_sys_path = sys.path[:]
29 check_parallel(
30 self,
31 self.config.jobs,
32 self._iterate_file_descrs(files_or_modules),
33 files_or_modules, # this argument patches sys.path
34 )
35 sys.path = original_sys_path
36 return
37
38 # 3) Get all FileItems
39 with fix_import_path(files_or_modules):
40 if self.config.from_stdin:
41 fileitems = self._get_file_descr_from_stdin(files_or_modules[0])
42 data: str | None = _read_stdin()
43 else:
44 fileitems = self._iterate_file_descrs(files_or_modules)
45 data = None
46
47 # The contextmanager also opens all checkers and sets up the PyLinter class
48 with fix_import_path(files_or_modules):
49 with self._astroid_module_checker() as check_astroid_module:
50 # 4) Get the AST for each FileItem
51 ast_per_fileitem = self._get_asts(fileitems, data)
52
53 # 5) Lint each ast
54 self._lint_files(ast_per_fileitem, check_astroid_module)
Path 3: 15 calls (0.01)
['/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/regrtest_data/directory'] (6) ['/Users/andrehora/Documents/git/projects-pathspotter...
1def check(self, files_or_modules: Sequence[str] | str) -> None:
2 """Main checking entry: check a list of files or modules from their name.
3
4 files_or_modules is either a string or list of strings presenting modules to check.
5 """
6 # 1) Initialize
7 self.initialize()
8
9 # 2) Gather all files
10 if not isinstance(files_or_modules, (list, tuple)):
11 # TODO: 3.0: Remove deprecated typing and update docstring
12 warnings.warn(
13 "In pylint 3.0, the checkers check function will only accept sequence of string",
14 DeprecationWarning,
15 stacklevel=2,
16 )
17 files_or_modules = (files_or_modules,) # type: ignore[assignment]
18 if self.config.recursive:
19 files_or_modules = tuple(self._discover_files(files_or_modules))
20 if self.config.from_stdin:
21 if len(files_or_modules) != 1:
22 raise exceptions.InvalidArgsError(
23 "Missing filename required for --from-stdin"
24 )
25
26 # TODO: Move the parallel invocation into step 5 of the checking process
27 if not self.config.from_stdin and self.config.jobs > 1:
28 original_sys_path = sys.path[:]
29 check_parallel(
30 self,
31 self.config.jobs,
32 self._iterate_file_descrs(files_or_modules),
33 files_or_modules, # this argument patches sys.path
34 )
35 sys.path = original_sys_path
36 return
37
38 # 3) Get all FileItems
39 with fix_import_path(files_or_modules):
40 if self.config.from_stdin:
41 fileitems = self._get_file_descr_from_stdin(files_or_modules[0])
42 data: str | None = _read_stdin()
43 else:
44 fileitems = self._iterate_file_descrs(files_or_modules)
45 data = None
46
47 # The contextmanager also opens all checkers and sets up the PyLinter class
48 with fix_import_path(files_or_modules):
49 with self._astroid_module_checker() as check_astroid_module:
50 # 4) Get the AST for each FileItem
51 ast_per_fileitem = self._get_asts(fileitems, data)
52
53 # 5) Lint each ast
54 self._lint_files(ast_per_fileitem, check_astroid_module)
Path 4: 6 calls (0.01)
['mymodule.py'] (2) ['a/b.py'] (2) ['/Users/andrehora/Documents/git/projects-pathspotter/pylint/tests/mymodule.py'] (1) ['a.py'] (1)
1def check(self, files_or_modules: Sequence[str] | str) -> None:
2 """Main checking entry: check a list of files or modules from their name.
3
4 files_or_modules is either a string or list of strings presenting modules to check.
5 """
6 # 1) Initialize
7 self.initialize()
8
9 # 2) Gather all files
10 if not isinstance(files_or_modules, (list, tuple)):
11 # TODO: 3.0: Remove deprecated typing and update docstring
12 warnings.warn(
13 "In pylint 3.0, the checkers check function will only accept sequence of string",
14 DeprecationWarning,
15 stacklevel=2,
16 )
17 files_or_modules = (files_or_modules,) # type: ignore[assignment]
18 if self.config.recursive:
19 files_or_modules = tuple(self._discover_files(files_or_modules))
20 if self.config.from_stdin:
21 if len(files_or_modules) != 1:
22 raise exceptions.InvalidArgsError(
23 "Missing filename required for --from-stdin"
24 )
25
26 # TODO: Move the parallel invocation into step 5 of the checking process
27 if not self.config.from_stdin and self.config.jobs > 1:
28 original_sys_path = sys.path[:]
29 check_parallel(
30 self,
31 self.config.jobs,
32 self._iterate_file_descrs(files_or_modules),
33 files_or_modules, # this argument patches sys.path
34 )
35 sys.path = original_sys_path
36 return
37
38 # 3) Get all FileItems
39 with fix_import_path(files_or_modules):
40 if self.config.from_stdin:
41 fileitems = self._get_file_descr_from_stdin(files_or_modules[0])
42 data: str | None = _read_stdin()
43 else:
44 fileitems = self._iterate_file_descrs(files_or_modules)
45 data = None
46
47 # The contextmanager also opens all checkers and sets up the PyLinter class
48 with fix_import_path(files_or_modules):
49 with self._astroid_module_checker() as check_astroid_module:
50 # 4) Get the AST for each FileItem
51 ast_per_fileitem = self._get_asts(fileitems, data)
52
53 # 5) Lint each ast
54 self._lint_files(ast_per_fileitem, check_astroid_module)
Path 5: 1 calls (0.0)
'myfile.py' (1)
1def check(self, files_or_modules: Sequence[str] | str) -> None:
2 """Main checking entry: check a list of files or modules from their name.
3
4 files_or_modules is either a string or list of strings presenting modules to check.
5 """
6 # 1) Initialize
7 self.initialize()
8
9 # 2) Gather all files
10 if not isinstance(files_or_modules, (list, tuple)):
11 # TODO: 3.0: Remove deprecated typing and update docstring
12 warnings.warn(
13 "In pylint 3.0, the checkers check function will only accept sequence of string",
14 DeprecationWarning,
15 stacklevel=2,
16 )
17 files_or_modules = (files_or_modules,) # type: ignore[assignment]
18 if self.config.recursive:
19 files_or_modules = tuple(self._discover_files(files_or_modules))
20 if self.config.from_stdin:
21 if len(files_or_modules) != 1:
22 raise exceptions.InvalidArgsError(
23 "Missing filename required for --from-stdin"
24 )
25
26 # TODO: Move the parallel invocation into step 5 of the checking process
27 if not self.config.from_stdin and self.config.jobs > 1:
28 original_sys_path = sys.path[:]
29 check_parallel(
30 self,
31 self.config.jobs,
32 self._iterate_file_descrs(files_or_modules),
33 files_or_modules, # this argument patches sys.path
34 )
35 sys.path = original_sys_path
36 return
37
38 # 3) Get all FileItems
39 with fix_import_path(files_or_modules):
40 if self.config.from_stdin:
41 fileitems = self._get_file_descr_from_stdin(files_or_modules[0])
42 data: str | None = _read_stdin()
43 else:
44 fileitems = self._iterate_file_descrs(files_or_modules)
45 data = None
46
47 # The contextmanager also opens all checkers and sets up the PyLinter class
48 with fix_import_path(files_or_modules):
49 with self._astroid_module_checker() as check_astroid_module:
50 # 4) Get the AST for each FileItem
51 ast_per_fileitem = self._get_asts(fileitems, data)
52
53 # 5) Lint each ast
54 self._lint_files(ast_per_fileitem, check_astroid_module)