Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean dotplot.py and gui.py to raise its score in pylint to at least 7.5 #30

Open
maciosz opened this issue Nov 17, 2016 · 6 comments
Open
Labels

Comments

@maciosz
Copy link
Member

maciosz commented Nov 17, 2016

Dotplot.py and gui.py have score lower than 7.5 according to pylint. According to README, we don't allow that. We should clean the code - add docstrings, fix import errors, cut too long lines, get rid of unused variables etc.

@maciosz maciosz added the easy label Nov 17, 2016
@krassowski
Copy link
Member

krassowski commented Nov 17, 2016

Am I missing something? ;)

python3 -m pylint dotplot.py
Your code has been rated at 8.42/10 (previous run: 8.42/10, +0.00)
python3 -m pylint gui.py
Your code has been rated at 9.36/10 (previous run: 9.36/10, +0.00)

Maybe you have used pylint for python2, not for python3?

Edit:
I tested with python2 -m pylint *.py, it gives:

  • '8.83/10' for gui and
  • '6.84/10' for dotplot.

Is that right, @maciosz?

@kinga322
Copy link
Contributor

I get lots of errors like this:
E: 9, 0: No name 'QHBoxLayout' in module 'PyQt5.QtWidgets' (no-name-in-module)
For gui.py:
Your code has been rated at 3.51/10 (previous run: 3.51/10, +0.00)
But this is actually a problem with pylint/PyQt cooperation, not with our programm.

@maciosz
Copy link
Member Author

maciosz commented Nov 17, 2016

Weird, I've used pylint for python3 for sure. I get 7.11 for dotplot and 3.51 for gui. I'll post some details later.

@maciosz
Copy link
Member Author

maciosz commented Nov 17, 2016

Ok, my mistake with gui.py, thanks @kinga322 for noticing; I should have read the output... But for dotplot.py I get 7.11 (which of course is not that bad), I don't know why you get something else. I've cloned it just before posting the issue, so it's not because I have old version. Anyway, as I said it's not that bad, so if everyone agrees I will close this silly issue tomorrow.

@krassowski
Copy link
Member

Could you paste the full output for dotplot.py? I guess it's the same problem - we have one import from Qt5 in this file and it gets classified as 'E' (error) so it makes the score much lower. By the way, I wouldn't close this until we have some idea how to eliminate this strange behavior of pylint - it makes setting quality requirements impossible as we don't have common tool to measure it. Maybe we can migrate to flake8 or something like this.

@maciosz
Copy link
Member Author

maciosz commented Nov 18, 2016

Again, you're right. The main error was because of the import. Unfortunately, I can't paste you the output I got yesterday, because I have the newest version now and it gives me different score... (Yeah, I know that with git I can go back to the previous version, but I don't know how). Anyway, now for dotplot.py I get:

************* Module dotplot
C: 41, 0: Unnecessary parens after 'print' keyword (superfluous-parens)
C:  1, 0: Missing module docstring (missing-docstring)
E:  5, 0: Unable to import 'drawer' (invalid syntax (<string>, line 26)) (import-error)
C: 10, 0: Missing class docstring (missing-docstring)
C: 18, 4: Missing method docstring (missing-docstring)
C: 21, 4: Missing method docstring (missing-docstring)
C: 36, 0: Missing function docstring (missing-docstring)
E: 44,12: Unable to import 'PyQt5.QtWidgets' (import-error)
W: 51,12: Unused variable 'main_window' (unused-variable)
W:  7, 0: Unused Sequence imported from sequence (unused-import)
(...)
Messages
--------

+-------------------+------------+
|message id         |occurrences |
+===================+============+
|missing-docstring  |5           |
+-------------------+------------+
|import-error       |2           |
+-------------------+------------+
|unused-variable    |1           |
+-------------------+------------+
|unused-import      |1           |
+-------------------+------------+
|superfluous-parens |1           |
+-------------------+------------+


Global evaluation
-----------------
Your code has been rated at 5.26/10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants