Skip to content

Commit

Permalink
Fix a regression where the score was not reported with multiple jobs
Browse files Browse the repository at this point in the history
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 pylint-dev#3547
  • Loading branch information
PCManticore committed May 16, 2020
1 parent 489508c commit 1fc490c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Release date: TBA

Close #3538

* Fix a regression where the score was not reported with multiple jobs

Close #3547


What's New in Pylint 2.5.2?
===========================
Expand Down
4 changes: 3 additions & 1 deletion pylint/lint/check_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def _worker_check_single_file(file_item):
msgs = [_get_new_args(m) for m in _worker_linter.reporter.messages]
return (
_worker_linter.current_name,
_worker_linter.file_state.base_name,
msgs,
_worker_linter.stats,
_worker_linter.msg_status,
Expand All @@ -97,9 +98,10 @@ def check_parallel(linter, jobs, files, arguments=None):

all_stats = []

for module, messages, stats, msg_status in pool.imap_unordered(
for module, base_name, messages, stats, msg_status in pool.imap_unordered(
_worker_check_single_file, files
):
linter.file_state.base_name = base_name
linter.set_current_module(module)
for msg in messages:
msg = Message(*msg)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,3 +778,8 @@ def test_can_list_directories_without_dunder_init(self, tmpdir):
],
code=0,
)

def test_jobs_score(self):
path = join(HERE, "regrtest_data", "unused_variable.py")
expected = "Your code has been rated at 7.50/10"
self._test_output([path, "--jobs=2", "-ry"], expected_output=expected)

0 comments on commit 1fc490c

Please sign in to comment.