pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

Different output with --jobs=1 and --jobs=2 #374

Open pylint-bot opened 9 years ago

pylint-bot commented 9 years ago

Originally reported by: Robert Spier (BitBucket: robert_spier)


Parallelism (--jobs) changes the output of pylint.

It's not just the order of the tests, --jobs=2 outputs 18468 lines of output compared to only 21 for --jobs=1. pylint 1.3.1 reports no lint errors.

$ venv/bin/pylint --jobs=2 --rcfile=$PWD/pylintrc app/codein app/melange app/soc app/summerofcode app/settings.py app/urls.py app/main.py tests pavement.py setup.py 2>&1 | head ***** Module codein.callback W: 17, 0: import missing from __future__ import absolute_import (no-absolute-import) W: 18, 0: import missing from __future__ import absolute_import (no-absolute-import) W: 19, 0: import missing from __future__ import absolute_import (no-absolute-import) W: 20, 0: import missing from __future__ import absolute_import (no-absolute-import) ***** Module codein.types W: 17, 0: import missing from __future__ import absolute_import (no-absolute-import) W: 18, 0: import missing from __future__ import absolute_import (no-absolute-import) W: 20, 0: import missing from __future__ import absolute_import (no-absolute-import) W: 21, 0: import missing from __future__ import absolute_import (no-absolute-import)

$ venv/bin/pylint --jobs=1 --rcfile=$PWD/pylintrc app/codein app/melange app/soc app/summerofcode app/settings.py app/urls.py app/main.py tests pavement.py setup.py 2>&1 | head ***** Module main E: 46, 2: print statement used (print-statement) E: 47, 2: print statement used (print-statement) E: 48, 2: print statement used (print-statement) E: 49, 2: print statement used (print-statement) E: 50, 2: print statement used (print-statement) ***** Module tests.test_utils E:658, 8: print statement used (print-statement) E:662,10: print statement used (print-statement) E:667, 8: print statement used (print-statement)

This is with the current head of the pylint repository. (1889:e404dd4d6e37 tip)

The source code being linted is https://code.google.com/p/soc/


pylint-bot commented 9 years ago

Original comment by Robert Spier (BitBucket: robert_spier):


And here's the output with formatting fixed.

$ venv/bin/pylint --jobs=2 --rcfile=$PWD/pylintrc app/codein app/melange app/soc app/summerofcode app/settings.py app/urls.py app/main.py tests pavement.py setup.py 2>&1 | head

#!text

************* Module codein.callback
W: 17, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 18, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 19, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 20, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
************* Module codein.types
W: 17, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 18, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 20, 0: import missing `from __future__ import absolute_import` (no-absolute-import)
W: 21, 0: import missing `from __future__ import absolute_import` (no-absolute-import)

$ venv/bin/pylint --jobs=1 --rcfile=$PWD/pylintrc app/codein app/melange app/soc app/summerofcode app/settings.py app/urls.py app/main.py tests pavement.py setup.py 2>&1 | head

#!text

************* Module main
E: 46, 2: print statement used (print-statement)
E: 47, 2: print statement used (print-statement)
E: 48, 2: print statement used (print-statement)
E: 49, 2: print statement used (print-statement)
E: 50, 2: print statement used (print-statement)
************* Module tests.test_utils
E:658, 8: print statement used (print-statement)
E:662,10: print statement used (print-statement)
E:667, 8: print statement used (print-statement)
************* Module tests.run
E:471, 4: print statement used (print-statement)
E:473, 4: print statement used (print-statement)
pylint-bot commented 9 years ago

Original comment by Robert Spier (BitBucket: robert_spier):


FYI, I can also replicate this with the official 1.4.0 release. Although the output is slightly different. Running with --jobs=2 produces many more lint warnings than with --jobs=1.

pylint-bot commented 9 years ago

Original comment by Saulius Menkevičius (BitBucket: sauliusmenkevicius):


Can confirm.

For me, pylint seems to ignore the pylintrc file, even though it is specified via the --rcfile= option, when -j 2+ is set.

I was using an older version of pylint (with support for --jobs) from hg+http://bitbucket.org/godfryd/pylint/@763d12c3c923f0733fc5c1866c69d973475993cd#egg=pylint from this PR: https://bitbucket.org/logilab/pylint/pull-request/82/added-support-for-checking-files-in/commits; which seemed to respect --pylintrc properly in multi-process mode. Something broke inbetween that checkin and 1.4.0

pylint-bot commented 9 years ago

Original comment by Pedro Algarvio (BitBucket: s0undt3ch, GitHub: @s0undt3ch?):


I can also confirm this. I had custom plugins on the rcfile and they're not being loaded

pylint-bot commented 9 years ago

Original comment by Pedro Algarvio (BitBucket: s0undt3ch, GitHub: @s0undt3ch?):


I'm also on 1.4.0

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Yeah, --jobs is kind tricky right now, will try to fix asap. By the way, if you have any other problems with --jobs, it's better to open another ticket, so they could be tracked and fixed individually.

pylint-bot commented 9 years ago

Original comment by Pedro Algarvio (BitBucket: s0undt3ch, GitHub: @s0undt3ch?):


I believe my problem is because the rcfile is being ignored.

pylint-bot commented 9 years ago

Original comment by Michal Nowikowski (BitBucket: godfryd, GitHub: @godfryd?):


The issue has been fixed by pull request #213.

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Merged in godfryd/pylint/fix-374 (pull request #213)

Fixed passing configuration from master linter to sublinters. Closes issue #374.

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Merged in godfryd/pylint/fix-374 (pull request #213)

Fixed passing configuration from master linter to sublinters. Closes issue #374.

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Fixed passing configuration from master linter to sublinters. Closes issue #374.

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Hm, the latest patch introduced another regression related to disabling messages from the pylintrc.

pylint-bot commented 9 years ago

Original comment by Michal Nowikowski (BitBucket: godfryd, GitHub: @godfryd?):


How to reproduce that new problem?

I run:

  1. pylint --jobs=2 --rcfile=pylintrc app/codein app/melange app/soc app/summerofcode app/settings.py app/urls.py app/main.py tests pavement.py setup.py
  2. pylint --jobs=1 --rcfile=pylintrc app/codein app/melange app/soc app/summerofcode app/settings.py app/urls.py app/main.py tests pavement.py setup.py

The outputs contain the same messages. pylintrc is disabling and enabling particular messages.

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Indeed, it was due to a faulty installation. Sorry about the noise.

pylint-bot commented 9 years ago

Original comment by Robert Spier (BitBucket: robert_spier):


I confirm that it works correctly on the Melange codebase. The performance improvement from adding more jobs is not as high as expected.

pylint-bot commented 9 years ago

Original comment by Pavel Roskin (BitBucket: pavel_roskin):


The issue with absolute_import may be resolved by pull request #229. The performance is discussed in issue #479. There are still issues with different output. Not sure if I should open another ticket. I'll describe it here.

pylint-bot commented 9 years ago

Original comment by Pavel Roskin (BitBucket: pavel_roskin):


That's a minimal example showing that the issue is not fully resolved.

#!shell

echo 'pass' > first.py
echo 'pass' > second.py
pylint first.py second.py >output1
pylint --jobs=2 first.py second.py >output2
diff -u output1 output2
#!diff

--- output1 2015-02-25 18:51:36.770036133 -0500
+++ output2 2015-02-25 18:51:39.274040857 -0500
@@ -6,7 +6,7 @@

 Report
 ======
-3 statements analysed.
+4 statements analysed.

 Statistics by type
 ------------------
@@ -72,31 +72,18 @@

-% errors / warnings by module
------------------------------
-
-+-------+------+--------+---------+-----------+
-|module |error |warning |refactor |convention |
-+=======+======+========+=========+===========+
-|second |0.00  |0.00    |0.00     |50.00      |
-+-------+------+--------+---------+-----------+
-|first  |0.00  |0.00    |0.00     |50.00      |
-+-------+------+--------+---------+-----------+
-
-
-
 Messages
 --------

 +------------------+------------+
 |message id        |occurrences |
 +==================+============+
-|missing-docstring |2           |
+|missing-docstring |1           |
 +------------------+------------+

 Global evaluation
 -----------------
-Your code has been rated at 3.33/10 (previous run: 3.33/10, +0.00)
+Your code has been rated at 5.00/10 (previous run: 3.33/10, +1.67)
pylint-bot commented 8 years ago

Original comment by James Broadhead (BitBucket: jamesbroadhead, GitHub: @jamesbroadhead?):


Same here -- getting significantly more 'duplicate-code' & 'cyclic-import' with --jobs=1 over --jobs=2

Closed-source codebase, but I'm happy to run debug branches etc. over it.

$ pylint --version pylint 1.4.4, astroid 1.3.6, common 1.0.2 Python 2.7.8 (default, Sep 10 2014, 04:44:11) [GCC 4.9.1]

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Increasing to blocker, so that we'll have a fix finally in 1.5.

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


I'm trying to reproduce this issue, but unfortunately I can't reproduce Pavel's example using the latest code from the repository. Could anyone of you provide a more comprehensive example where this discrepancy happens?

pylint-bot commented 8 years ago

Original comment by Pavel Roskin (BitBucket: pavel_roskin):


I tried pylint on the current python-ly, and I see that things have improved greatly. There are only two issues that the parallel pylint missed compared to the single-job version: R0401(cyclic-import) and R0801(duplicate-code). There is also a discrepancy in the way __init__.py is referred to.

One job:

************* Module ly
ly/__init__.py(46): [C0303(trailing-whitespace)] Trailing whitespace

Two jobs:

************* Module ly.__init__
ly/__init__.py(46): [C0303(trailing-whitespace)] Trailing whitespace

I actually prefer the later notation, it's more explicit that it's just the __init__.py file, not the whole module.

pylint-bot commented 8 years ago

Original comment by Pavel Roskin (BitBucket: pavel_roskin):


Here's a simple test for the module naming issue. It turns out the parallel version uses both names, which is bad.

[proski@dell pylinttest]$ echo "pass " >__init__.py
[proski@dell pylinttest]$ pylint -r n --jobs=1 .
************* Module pylinttest
C:  1, 0: Trailing whitespace (trailing-whitespace)
C:  1, 0: Missing module docstring (missing-docstring)
[proski@dell pylinttest]$ pylint -r n --jobs=2 .
************* Module pylinttest.__init__
C:  1, 0: Trailing whitespace (trailing-whitespace)
************* Module pylinttest
C:  1, 0: Missing module docstring (missing-docstring)
pylint-bot commented 8 years ago

Original comment by Pavel Roskin (BitBucket: pavel_roskin):


Cyclic import problem

:::text
[proski@dell pylintcycle]$ touch __init__.py
[proski@dell pylintcycle]$ echo 'import pylintcycle.second' >first.py
[proski@dell pylintcycle]$ echo 'import pylintcycle.first' >second.py
[proski@dell pylintcycle]$ pylint -r n --jobs=1 first.py second.py
************* Module pylintcycle.first
C:  1, 0: Missing module docstring (missing-docstring)
W:  1, 0: Unused import pylintcycle.second (unused-import)
************* Module pylintcycle.second
C:  1, 0: Missing module docstring (missing-docstring)
W:  1, 0: Unused import pylintcycle.first (unused-import)
R:  1, 0: Cyclic import (pylintcycle.first -> pylintcycle.second) (cyclic-import)
[proski@dell pylintcycle]$ pylint -r n --jobs=2 first.py second.py
************* Module pylintcycle.first
C:  1, 0: Missing module docstring (missing-docstring)
W:  1, 0: Unused import pylintcycle.second (unused-import)
************* Module pylintcycle.second
C:  1, 0: Missing module docstring (missing-docstring)
W:  1, 0: Unused import pylintcycle.first (unused-import)
pylint-bot commented 8 years ago

Original comment by Pavel Roskin (BitBucket: pavel_roskin):


When running pylint -rn --jobs=2 pylint in an empty directory, following issue is reported:

:::text
************* Module pylint.lint
E:978,15: Instance of 'Values' has no 'persistent' member (no-member)

The single-job version does not detect that condition.

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Thank you for the detailed reports, Pavel. Will look soon.

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Regarding pylint -rn --jobs=2 pylint, this happens because there's no configuration files which disables the corresponding messages for pylint, such as the one from pylint/pylintrc. I can reproduce it with both the single-job version and with multiple jobs, it's actually expected.