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
Conversation
CC @Makman2 |
bears/pug/PugLintBear.py
Outdated
def process_output(self, output, filename, file): | ||
stdout, stderr = output | ||
yield from self.process_output_regex(stderr, filename, file, | ||
self._output_regex) |
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.
why you don't use output_format=regex
?
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.
Done
div | ||
|
||
|
||
div |
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.
are the missing \n at EOF on purpose?
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.
Nope, my bad.
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.
Fixed.
bears/pug/PugLintBear.py
Outdated
use_stderr=True) | ||
class PugLintBear: | ||
""" | ||
A configurable linter and style checker for Pug (formerly Jade) that is a |
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.
"""Pug
"'' (formerly "jade
"
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.
enclose them within backsticks
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.
Done
bears/pug/PugLintBear.py
Outdated
validate_extensions: bool=True, | ||
validate_self_closing_tags: bool=True, | ||
preferred_quotation: str='\'', | ||
max_lines_per_file: int=None, |
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.
change max_lines_per_file
-> max_file_length
, for consistency.
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 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.
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 is the TailorBear
that has max_file_length
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.
Should we open an issue for that ?
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.
@Makman2 , @yash-nisar let's vote
i am for using max_file_length
as we have max_line_length
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.
Nvm, doing so right away
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.
Haha okay, lets vote
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.
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 |
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.
^^
bears/pug/PugLintBear.py
Outdated
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: |
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.
enforce_lower_case_tags
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.
Done
bears/pug/PugLintBear.py
Outdated
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: |
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.
enforce_spaces_inside_attribute_brackets
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.
Done
bears/pug/PugLintBear.py
Outdated
:param require_spaces_inside_attribute_brackets: | ||
When ``True``, enforce space after opening attribute bracket and | ||
before closing attribute bracket. | ||
:param require_strict_equality_operators: |
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.
enforce_...
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.
Done
Updated @Makman2 |
bears/pug/PugLintBear.py
Outdated
validate_div_tags: bool=True, | ||
validate_extensions: bool=True, | ||
validate_self_closing_tags: bool=True, | ||
preferred_quotation: str='\'', |
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.
use "'"
instead of '\''
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.
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')``. |
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's with enforcing the other way around?
bears/pug/PugLintBear.py
Outdated
def create_arguments(filename, file, config_file, puglint_config: str=''): | ||
""" | ||
:param puglint_config: | ||
The location of the ``.pug-lintrc`` 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.
Maybe
The location of a custom ``.pug-lintrc`` config file.
So it doesn't sound that this parameter is mandatory?
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.
Sounds good
"requireClassLiteralsBeforeIdLiterals":false, | ||
"validateDivTags":true, | ||
"disallowTagInterpolation":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.
Ah, eof damnit.
763e01b
to
d41309b
Compare
bears/pug/PugLintBear.py
Outdated
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, |
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's with these using enforce
as prefix?
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.
Okay, I'll use it for them too
consistency
2017-07-18 21:42 GMT+01:00 Mischa Krüger <notifications@github.com>:
… ***@***.**** commented on this pull request.
------------------------------
In bears/pug/PugLintBear.py
<#1936 (comment)>:
> + prohibit_id_literals_before_attributes: bool=True,
+ prohibit_id_literals: bool=True,
+ prohibit_legacy_mixin_call: bool=True,
+ prohibit_multiple_line_breaks: bool=None,
+ prohibit_spaces_inside_attribute_brackets: bool=True,
+ prohibit_string_interpolation: bool=True,
+ prohibit_tag_interpolation: bool=True,
+ prohibit_specific_attributes: typed_list(str)=None,
+ prohibit_specific_tags: typed_list(str)=None,
+ enforce_class_literals_before_attributes: bool=False,
+ enforce_class_literals_before_id_literals: bool=False,
+ enforce_id_literals_before_attributes: bool=False,
+ 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,
what's with these using enforce as prefix?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1936 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJ9xonk8d1-xuPtemc60Sp9mANVg2R7Rks5sPRjOgaJpZM4OZ1AM>
.
|
we use more `enforce_` than `require_`
…:
consistency
2017-07-18 21:42 GMT+01:00 Mischa Krüger ***@***.***>:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In bears/pug/PugLintBear.py
> <#1936 (comment)>:
>
> > + prohibit_id_literals_before_attributes: bool=True,
> + prohibit_id_literals: bool=True,
> + prohibit_legacy_mixin_call: bool=True,
> + prohibit_multiple_line_breaks: bool=None,
> + prohibit_spaces_inside_attribute_brackets: bool=True,
> + prohibit_string_interpolation: bool=True,
> + prohibit_tag_interpolation: bool=True,
> + prohibit_specific_attributes: typed_list(str)=None,
> + prohibit_specific_tags: typed_list(str)=None,
> + enforce_class_literals_before_attributes: bool=False,
> + enforce_class_literals_before_id_literals: bool=False,
> + enforce_id_literals_before_attributes: bool=False,
> + 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,
>
> what's with these using enforce as prefix?
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#1936#
pullrequestreview-50737361>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AJ9xonk8d1-
xuPtemc60Sp9mANVg2R7Rks5sPRjOgaJpZM4OZ1AM>
> .
>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1936 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJ9xopVPMwsQ7-VvyOHN9HlcVpOCqrbLks5sPR2kgaJpZM4OZ1AM>
.
|
``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')`` |
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 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?
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.
Fixed
One weird thing that I noticed was that the config (which is later converted to json) only takes the values |
bears/pug/PugLintBear.py
Outdated
options = { | ||
'disallowBlockExpansion': | ||
prohibit_block_expansion if prohibit_block_expansion | ||
else None, |
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 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
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.
or write a little function like map_bool()
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 had initially done a settings_map
where I mapped False
to None
@Makman2 Updated. |
|
ack 4cfe907 |
@Makman2 ping! |
@AsnelChristian bam! |
reack 1d31827 |
@rultor merge |
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
them.
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:
cobot mark wip <URL>
to get it outof the review queue.
The more you review, the more your score will grow at coala.io and we will
review your PRs faster!