-
Notifications
You must be signed in to change notification settings - Fork 581
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
WIP PlanemoLintBear.py: Add linter bear for planemo #1337
base: master
Are you sure you want to change the base?
Conversation
5a73616
to
0e840ad
Compare
bears/planemo/PlanemoLintBear.py
Outdated
Checks the code with pylint. This will run pylint over each file | ||
separately. | ||
""" | ||
LANGUAGES = {'xml'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have asciinema too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't understand what you meant. Isn't assciinema a recorder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the bears documentation, we have asciinemas for a lot of the bears that showcase how they work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See other bears.
git grep -i asciinema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'll do that
test-requirements.txt
Outdated
@@ -6,3 +6,4 @@ pytest-timeout~=1.2 | |||
pytest-xdist~=1.15 | |||
requests_mock~=0.7.0 | |||
wheel~=0.29 | |||
planemo~=0.36 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should appear in bear-requirements.txt
, and not in test-requirements.txt
.
That will solve the error you can see at https://travis-ci.org/coala/coala-bears/jobs/195095556#L5596
bears/planemo/PlanemoLintBear.py
Outdated
CAN_DETECT = {'Syntax'} | ||
|
||
@staticmethod | ||
def create_arguments(filename, file, config_file,): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the trailing comma here.
bears/planemo/PlanemoLintBear.py
Outdated
@staticmethod | ||
def create_arguments(filename, file, config_file,): | ||
""" | ||
:param pylint_disable: Disable the message, report, category or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these arguments do not exist for this bear;
'planemolint_test.xml') | ||
|
||
def test_run(self): | ||
self.check_validity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this checks an invalid file.
this test module also needs to run a test that is a successful valid file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see a test with the check_results
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaaand I never sent this >.>
bears/planemo/PlanemoLintBear.py
Outdated
Checks the code with pylint. This will run pylint over each file | ||
separately. | ||
""" | ||
LANGUAGES = {'xml'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the bears documentation, we have asciinemas for a lot of the bears that showcase how they work
bears/planemo/PlanemoLintBear.py
Outdated
'INFO:': RESULT_SEVERITY.INFO}) | ||
class PlanemoLintBear: | ||
""" | ||
Checks the code with pylint. This will run pylint over each file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
planemo == pylint?
self.uut, | ||
[], # Doesn't matter, planemo lint will parse the file | ||
self.test_file, | ||
valid=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only test for one valid file. We wanted to improve testing, although I myself am not familiar with the details. Ask on the gitter channel about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer the check_results
method because we actually get to know the other attributes such as the message, the line no. etc.
bears/planemo/PlanemoLintBear.py
Outdated
'INFO:': RESULT_SEVERITY.INFO}) | ||
class PlanemoLintBear: | ||
""" | ||
Checks the code with planemo lint. This will run planemo lint over each file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (80 > 79 characters)'
PycodestyleBear (E501), severity NORMAL, section autopep8
.
bears/planemo/PlanemoLintBear.py
Outdated
'INFO:': RESULT_SEVERITY.INFO}) | ||
class PlanemoLintBear: | ||
""" | ||
Checks the code with planemo lint. This will run planemo lint over each file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is longer than allowed. (80 > 79)
LineLengthBear, severity NORMAL, section linelength
.
bears/planemo/PlanemoLintBear.py
Outdated
'INFO:': RESULT_SEVERITY.INFO}) | ||
class PlanemoLintBear: | ||
""" | ||
Checks the code with planemo lint. This will run planemo lint over each file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E501 line too long (80 > 79 characters)'
PycodestyleBear (E501), severity NORMAL, section autopep8
.
bears/planemo/PlanemoLintBear.py
Outdated
'INFO:': RESULT_SEVERITY.INFO}) | ||
class PlanemoLintBear: | ||
""" | ||
Checks the code with planemo lint. This will run planemo lint over each file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is longer than allowed. (80 > 79)
LineLengthBear, severity NORMAL, section linelength
.
Appveyor is failing because there is no planemo for windows right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests havent yet been improved; they are still inadequate.
bears/planemo/PlanemoLintBear.py
Outdated
|
||
@staticmethod | ||
def create_arguments(filename, file, config_file): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this blank line please
<from>Jani</from> | ||
<heading>Reminder</heading> | ||
<body>Don't forget me this weekend!</body> | ||
</note> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to review your own patches. Github shows you a red marker here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry 😓 didn't notice this
'INFO:': RESULT_SEVERITY.INFO}) | ||
class PlanemoLintBear: | ||
""" | ||
Checks the code with planemo lint. This will run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is planemo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description needs to improve IMO. A naiive user wouldn't understand much by the given description.
bears/planemo/PlanemoLintBear.py
Outdated
Checks the code with planemo lint. This will run | ||
planemo lint over each file separately. | ||
""" | ||
LANGUAGES = {'xml'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bear cand handle any xml file. If this was committed, that is what you are saying this bear can accept, and for e.g.coala-quickstart will try to use it for all xml files.
Ask maintainers to trigger the rebuild. It occasionally fails. |
Or maybe you can repush too. |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
1 similar comment
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
ASCIINEMA_URL = 'https://asciinema.org/a/0kiduzg55d59nxhm8wuwfvl3n' | ||
LICENSE = 'AGPL-3.0' | ||
CAN_DETECT = {'Syntax'} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see the SEE_MORE
attribute.
self.uut, | ||
[], # Doesn't matter, planemo lint will parse the file | ||
self.test_file, | ||
valid=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're working towards writing all the future tests with check_results
, so it would be nice if you could use check_results
which would help us to verify the output and see if the regex is working. :)
@@ -0,0 +1,30 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for leaving this line ?
@@ -0,0 +1,30 @@ | |||
|
|||
from coalib.bearlib.abstractions.Linter import linter | |||
from dependency_management.requirements.PipRequirement import PipRequirement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer the parenthesis like below...
from dependency_management.requirements.PipRequirement import ( PipRequirement)
@staticmethod | ||
def create_arguments(filename, file, config_file): | ||
args = ('lint',) | ||
return args + (filename,) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 'lint', filename
could suffice IMO.
def setUp(self): | ||
self.section = Section('test section') | ||
self.uut = PlanemoLintBear(self.section, Queue()) | ||
self.test_file = os.path.join(os.path.dirname(__file__), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason of including this in the setUp
method ?
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Ping @Shade5 |
I've been trying to fix this for a while now. Got appyer working but then circle failed. No idea now 😓 |
Can you spot the reason for CircleCI failure ? |
I've tried a lot, couldn't fix it. Please have a look. |
Added a linter bear for planemo lint Used `planemo lint` command Closes coala#1321
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
10 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Added a linter bear for planemo lint
Used
planemo lint
commandCloses #1321