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

bears/hypertext: Add HTTPoliceLintBear.py #1962

Merged
merged 1 commit into from Aug 2, 2017
Merged

Conversation

yash-nisar
Copy link
Member

@yash-nisar yash-nisar commented Jul 31, 2017

Closes #596

For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!

Checklist

  • I read the commit guidelines and I've followed
    them.
  • I ran coala over my code locally. (All commits have to pass
    individually.
    It is not sufficient to have "fixup commits" on your PR,
    our bot will still report the issues for the previous commit.) You will
    likely receive a lot of bot comments and build failures if coala does not
    pass on every single commit!

After you submit your pull request, DO NOT click the 'Update Branch' button.
When asked for a rebase, consult coala.io/rebase
instead.

Please consider helping us by reviewing other peoples pull requests as well:

The more you review, the more your score will grow at coala.io and we will
review your PRs faster!

@yash-nisar
Copy link
Member Author

CC @Makman2

@yash-nisar yash-nisar force-pushed the httpolice branch 2 times, most recently from 326dd15 to 3988b72 Compare July 31, 2017 16:15

severity_map = {'E': RESULT_SEVERITY.MAJOR,
'C': RESULT_SEVERITY.NORMAL,
'D': RESULT_SEVERITY.INFO}
Copy link
Member

Choose a reason for hiding this comment

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

you have to provide this at @linter, not here^^

Copy link
Member Author

Choose a reason for hiding this comment

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

Ohh, I've seen this mapping outside the decorator in many bears. Nvm will raise an issue 😉

def create_arguments(filename, file, config_file,
silent: typed_list(str)=[]):
"""
:param silent:
Copy link
Member

Choose a reason for hiding this comment

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

hmm the name silent is very general, maybe you can make it more precise?

silent: typed_list(str)=[]):
"""
:param silent:
Silences the given list of notice IDs.
Copy link
Member

Choose a reason for hiding this comment

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

is there a sensible default list?

Copy link
Member Author

Choose a reason for hiding this comment

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

Couldn't find one. Completely depends on the user IMO.

@@ -0,0 +1,37 @@
{
"_warning": "This is not a real HAR file! It only contains the keys that are interesting to HTTPolice. Please do not use this as an example of a valid HAR file.",
Copy link
Member

Choose a reason for hiding this comment

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

do you maybe have at least one real HAR file?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I have collected a real valid HAR file manually, will update the tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

test_valid_file has a real HAR file 😄

@yash-nisar yash-nisar force-pushed the httpolice branch 2 times, most recently from 3fed145 to c56888c Compare August 1, 2017 08:19
@yash-nisar
Copy link
Member Author

@Makman2 Updated.

def create_arguments(filename, file, config_file,
silence_ids: typed_list(str)=[]):
"""
:param silence_ids:
Copy link
Member

Choose a reason for hiding this comment

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

I actually meant to name the setting to something "HTTPolice" related ;)
The concept of silencing ids is not uncommon for other linters too, so we should disambiguate :)
E.g. silence_httpolice_ids (maybe look out for other linters that have also ids you can silence (I think BanditBear has this too), and try to adapt the naming scheme 👍)

silence_ids: typed_list(str)=[]):
"""
:param silence_ids:
Silences the given list of notice IDs.
Copy link
Member

Choose a reason for hiding this comment

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

The documentation shall also state that these IDs are defined by HTTPolice, so people know where to lookup those 👍

@yash-nisar
Copy link
Member Author

Updated @Makman2

:param httpolice_silence_ids:
Silences the given list of notice IDs. You can get more information
about the available notices and their IDs at
https://httpolice.readthedocs.io/en/stable/notices.html.
Copy link
Member

Choose a reason for hiding this comment

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

since it's RST, is a special syntax required for links?

Copy link
Member

Choose a reason for hiding this comment

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

no it works fine :)

@Makman2
Copy link
Member

Makman2 commented Aug 2, 2017

ack 40dd5d4

1 similar comment
@Makman2
Copy link
Member

Makman2 commented Aug 2, 2017

ack 40dd5d4

@Makman2
Copy link
Member

Makman2 commented Aug 2, 2017

@rultor merge

@rultor
Copy link

rultor commented Aug 2, 2017

@rultor merge

@Makman2 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 40dd5d4 into coala:master Aug 2, 2017
@yash-nisar yash-nisar deleted the httpolice branch August 2, 2017 15:49
@rultor
Copy link

rultor commented Aug 2, 2017

@rultor merge

@Makman2 Done! FYI, the full log is here (took me 3min)

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.

Add httpolice bear
4 participants