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

WIP PlanemoLintBear.py: Add linter bear for planemo #1337

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Shade5
Copy link

@Shade5 Shade5 commented Jan 22, 2017

Added a linter bear for planemo lint
Used planemo lint command

Closes #1321

Checks the code with pylint. This will run pylint over each file
separately.
"""
LANGUAGES = {'xml'}
Copy link
Member

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?

Copy link
Author

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?

Copy link
Member

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

Copy link
Member

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

Copy link
Author

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

@@ -6,3 +6,4 @@ pytest-timeout~=1.2
pytest-xdist~=1.15
requests_mock~=0.7.0
wheel~=0.29
planemo~=0.36
Copy link
Member

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

CAN_DETECT = {'Syntax'}

@staticmethod
def create_arguments(filename, file, config_file,):
Copy link
Member

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.

@staticmethod
def create_arguments(filename, file, config_file,):
"""
:param pylint_disable: Disable the message, report, category or
Copy link
Member

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(
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

@sims1253 sims1253 left a 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 >.>

Checks the code with pylint. This will run pylint over each file
separately.
"""
LANGUAGES = {'xml'}
Copy link
Member

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

'INFO:': RESULT_SEVERITY.INFO})
class PlanemoLintBear:
"""
Checks the code with pylint. This will run pylint over each file
Copy link
Member

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)
Copy link
Member

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.

Copy link
Member

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.

'INFO:': RESULT_SEVERITY.INFO})
class PlanemoLintBear:
"""
Checks the code with planemo lint. This will run planemo lint over each file
Copy link
Collaborator

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.

'INFO:': RESULT_SEVERITY.INFO})
class PlanemoLintBear:
"""
Checks the code with planemo lint. This will run planemo lint over each file
Copy link
Collaborator

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.

'INFO:': RESULT_SEVERITY.INFO})
class PlanemoLintBear:
"""
Checks the code with planemo lint. This will run planemo lint over each file
Copy link
Collaborator

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.

'INFO:': RESULT_SEVERITY.INFO})
class PlanemoLintBear:
"""
Checks the code with planemo lint. This will run planemo lint over each file
Copy link
Collaborator

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.

@Shade5
Copy link
Author

Shade5 commented Jan 26, 2017

Appveyor is failing because there is no planemo for windows right?
How do I exclude it ?

Copy link
Member

@jayvdb jayvdb left a 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.


@staticmethod
def create_arguments(filename, file, config_file):

Copy link
Member

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>
Copy link
Member

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.

Copy link
Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is planemo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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.

Checks the code with planemo lint. This will run
planemo lint over each file separately.
"""
LANGUAGES = {'xml'}
Copy link
Member

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.

@Techievena
Copy link
Member

Ask maintainers to trigger the rebuild. It occasionally fails.

@yash-nisar
Copy link
Member

Or maybe you can repush too.

@gitmate-bot
Copy link
Collaborator

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
@gitmate-bot
Copy link
Collaborator

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'}

Copy link
Member

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)
Copy link
Member

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 @@

Copy link
Member

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
Copy link
Member

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,)
Copy link
Member

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__),
Copy link
Member

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 ?

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@yash-nisar
Copy link
Member

Ping @Shade5

@Shade5
Copy link
Author

Shade5 commented May 19, 2017

I've been trying to fix this for a while now. Got appyer working but then circle failed. No idea now 😓

@yash-nisar
Copy link
Member

Can you spot the reason for CircleCI failure ?

@Shade5
Copy link
Author

Shade5 commented May 19, 2017

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
@gitmate-bot
Copy link
Collaborator

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
@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

@gitmate-bot
Copy link
Collaborator

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

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

Successfully merging this pull request may close these issues.

9 participants