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/pug: Add PugLintBear #1936

Merged
merged 1 commit into from Jul 21, 2017
Merged

bears/pug: Add PugLintBear #1936

merged 1 commit into from Jul 21, 2017

Conversation

@yash-nisar
Copy link
Member

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

Closes #290

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

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

def process_output(self, output, filename, file):
stdout, stderr = output
yield from self.process_output_regex(stderr, filename, file,
self._output_regex)

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

why you don't use output_format=regex?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 🎉

div


div

This comment has been minimized.

@Makman2

Makman2 Jul 17, 2017
Member

are the missing \n at EOF on purpose?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Nope, my bad.

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Fixed. 👍

use_stderr=True)
class PugLintBear:
"""
A configurable linter and style checker for Pug (formerly Jade) that is a

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

"""Pug"'' (formerly "jade"

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

enclose them within backsticks

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍

validate_extensions: bool=True,
validate_self_closing_tags: bool=True,
preferred_quotation: str='\'',
max_lines_per_file: int=None,

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

change max_lines_per_file -> max_file_length, for consistency.

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

We have named the setting as max_lines_per_file in LineCountBear, so I think we should keep max_lines_per_file for consistency of the settings throughout.

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

there is the TailorBear that has max_file_length

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Should we open an issue for that ?

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

@Makman2 , @yash-nisar let's vote 😄 and get rid of the other setting
i am for using max_file_length as we have max_line_length

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Nvm, doing so right away 😄

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Haha okay, lets vote 👍

This comment has been minimized.

@Makman2

Makman2 Jul 18, 2017
Member

max_file_length might refer to the number of chars inside a document, max_lines_per_file is less ambigious^^ So imo max_lines_per_file is better 👍

For example: If set to ``True``, prefer
``input(type='text').class`` over ``input.class(type='text')``.
:param prohibit_class_literals_before_id_literals:
When ``True``, prefer all ID literals to be written before any

This comment has been minimized.

When ``True``, all attributes should be written in lower case.
For example: If set to ``True``, prefer ``div(class='class')``
over ``div(Class='class')``.
:param require_lower_case_tags:

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

enforce_lower_case_tags

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍

When ``True``, all tags must be written in lower case.
For example: If set to ``True``, prefer ``div(class='class')``
over ``Div(class='class')``.
:param require_spaces_inside_attribute_brackets:

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

enforce_spaces_inside_attribute_brackets

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍

:param require_spaces_inside_attribute_brackets:
When ``True``, enforce space after opening attribute bracket and
before closing attribute bracket.
:param require_strict_equality_operators:

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 18, 2017
Member

enforce_...

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍

@yash-nisar
Copy link
Member Author

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

Updated @Makman2

validate_div_tags: bool=True,
validate_extensions: bool=True,
validate_self_closing_tags: bool=True,
preferred_quotation: str='\'',

This comment has been minimized.

@Makman2

Makman2 Jul 18, 2017
Member

use "'" instead of '\''

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Done 👍

When ``True``, prefer all attribute blocks to be written before
any class literals.
For example: If set to ``True``, prefer
``input(type='text').class`` over ``input.class(type='text')``.

This comment has been minimized.

@Makman2

Makman2 Jul 18, 2017
Member

what's with enforcing the other way around?

def create_arguments(filename, file, config_file, puglint_config: str=''):
"""
:param puglint_config:
The location of the ``.pug-lintrc`` config file.

This comment has been minimized.

@Makman2

Makman2 Jul 18, 2017
Member

Maybe

The location of a custom  ``.pug-lintrc`` config file.

So it doesn't sound that this parameter is mandatory?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Sounds good 👍

@yash-nisar yash-nisar force-pushed the yash-nisar:pug-bear branch from 56f8642 to 4134edd Jul 18, 2017
"requireClassLiteralsBeforeIdLiterals":false,
"validateDivTags":true,
"disallowTagInterpolation":true
}

This comment has been minimized.

@yash-nisar

yash-nisar Jul 18, 2017
Author Member

Ah, eof damnit.

@yash-nisar yash-nisar force-pushed the yash-nisar:pug-bear branch 2 times, most recently from 763e01b to d41309b Jul 18, 2017
enforce_lower_case_attributes: bool=True,
enforce_lower_case_tags: bool=True,
require_spaces_inside_attribute_brackets: bool=False,
require_strict_equality_operators: bool=True,

This comment has been minimized.

@Makman2

Makman2 Jul 18, 2017
Member

what's with these using enforce as prefix?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 19, 2017
Author Member

Okay, I'll use it for them too 👍

@AsnelChristian
Copy link
Member

@AsnelChristian AsnelChristian commented Jul 18, 2017

@AsnelChristian
Copy link
Member

@AsnelChristian AsnelChristian commented Jul 18, 2017

``input.class#id(type='text')``.
:param prohibit_class_literals:
When ``True``, disallow any class literals.
For example: If set to ``True``, prefer ``div(class='class')``

This comment has been minimized.

@AsnelChristian

AsnelChristian Jul 19, 2017
Member

i am kind of lost prohibit_class_attribute_with_static_value default value is True so you make use of class literals but here prohibit_class_literals you prohibit them.... isn't that contradicting?

This comment has been minimized.

@yash-nisar

yash-nisar Jul 19, 2017
Author Member

Fixed 👍

@yash-nisar yash-nisar force-pushed the yash-nisar:pug-bear branch from d41309b to 973a9b7 Jul 19, 2017
@yash-nisar
Copy link
Member Author

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

One weird thing that I noticed was that the config (which is later converted to json) only takes the values true and null, so I've made the required changes.

@yash-nisar
Copy link
Member Author

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

options = {
'disallowBlockExpansion':
prohibit_block_expansion if prohibit_block_expansion
else None,

This comment has been minimized.

@Makman2

Makman2 Jul 19, 2017
Member

can you maybe loop over the dict and assign None for each entry if needed?

options = {...}
for k, v in options.items():
    options[k] = v if v else None

This comment has been minimized.

@Makman2

Makman2 Jul 19, 2017
Member

or write a little function like map_bool()

This comment has been minimized.

@yash-nisar

yash-nisar Jul 19, 2017
Author Member

I had initially done a settings_map where I mapped False to None

@yash-nisar yash-nisar force-pushed the yash-nisar:pug-bear branch from 973a9b7 to 4cfe907 Jul 19, 2017
@yash-nisar
Copy link
Member Author

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

@Makman2 Updated.

@AsnelChristian
Copy link
Member

@AsnelChristian AsnelChristian commented Jul 20, 2017

👍

@AsnelChristian
Copy link
Member

@AsnelChristian AsnelChristian commented Jul 20, 2017

ack 4cfe907

@AsnelChristian
Copy link
Member

@AsnelChristian AsnelChristian commented Jul 20, 2017

@Makman2 ping! 😄

@Makman2
Copy link
Member

@Makman2 Makman2 commented Jul 20, 2017

@AsnelChristian bam! 💥
thanks for reviewing :D
rebase and lgtm @yash-nisar :)

Closes #290
@yash-nisar yash-nisar force-pushed the yash-nisar:pug-bear branch from 4cfe907 to 1d31827 Jul 21, 2017
@yash-nisar
Copy link
Member Author

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

reack 1d31827

@sils
Copy link
Member

@sils sils commented Jul 21, 2017

@rultor merge

@rultor
Copy link

@rultor rultor commented Jul 21, 2017

@rultor merge

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

@rultor rultor merged commit 1d31827 into coala:master Jul 21, 2017
6 of 8 checks passed
6 of 8 checks passed
ci/circleci CircleCI is running your tests
Details
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
codecov/project 100% (target 100%)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
review/gitmate/commit No issues with this one - go ahead! :)
Details
review/gitmate/manual This commit was acknowledged.
Details
review/gitmate/pr All is well! :) (0 problems solved)
Details
@yash-nisar yash-nisar deleted the yash-nisar:pug-bear branch Jul 21, 2017
@rultor
Copy link

@rultor rultor commented Jul 21, 2017

@rultor merge

@sils Done! FYI, the full log is here (took me 2min)

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

Successfully merging this pull request may close these issues.

8 participants
You can’t perform that action at this time.