Skip to content

Commit c4c96ec

Browse files
committed
Fix a regression where the score was not reported with multiple jobs
The linter depends on `FileState.base_name` to be set for emitting the reports. This has been removed inadvertently in 21dc875 during refactoring of the multiprocessing implementation. Close #3547
1 parent 5cbdd94 commit c4c96ec

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Release date: TBA
1919

2020
Close #3604
2121

22+
* Fix a regression where the score was not reported with multiple jobs
23+
24+
Close #3547
25+
2226

2327
What's New in Pylint 2.5.2?
2428
===========================

pylint/lint/check_parallel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def _worker_check_single_file(file_item):
7171
msgs = [_get_new_args(m) for m in _worker_linter.reporter.messages]
7272
return (
7373
_worker_linter.current_name,
74+
_worker_linter.file_state.base_name,
7475
msgs,
7576
_worker_linter.stats,
7677
_worker_linter.msg_status,
@@ -97,9 +98,10 @@ def check_parallel(linter, jobs, files, arguments=None):
9798

9899
all_stats = []
99100

100-
for module, messages, stats, msg_status in pool.imap_unordered(
101+
for module, base_name, messages, stats, msg_status in pool.imap_unordered(
101102
_worker_check_single_file, files
102103
):
104+
linter.file_state.base_name = base_name
103105
linter.set_current_module(module)
104106
for msg in messages:
105107
msg = Message(*msg)

tests/test_self.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,3 +778,8 @@ def test_can_list_directories_without_dunder_init(self, tmpdir):
778778
],
779779
code=0,
780780
)
781+
782+
def test_jobs_score(self):
783+
path = join(HERE, "regrtest_data", "unused_variable.py")
784+
expected = "Your code has been rated at 7.50/10"
785+
self._test_output([path, "--jobs=2", "-ry"], expected_output=expected)

0 commit comments

Comments
 (0)