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

HTMLLintBear: Add settings for individual features #1304

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

Conversation

pratyushprakash
Copy link
Contributor

Settings have been added for enabling/disabling indidual
features of the html_linter.

Closes #1247

@gitmate-bot
Copy link
Collaborator

Thanks for your contribution!

Reviewing pull requests take really a lot of time and we're all volunteers. Please make sure you go through the following check list and complete them all before pinging someone for a review.

As you learn things over your Pull Request please help others on the chat and on PRs to get their stuff right as well!

invalid_files=(),
settings={'optional_tag': 'off'},
tempfile_kwargs={'suffix': '.html'})

Copy link
Collaborator

Choose a reason for hiding this comment

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

W391 blank line at end of file'

PycodestyleBear (W391), severity NORMAL, section autopep8.

invalid_files=(),
settings={'optional_tag': 'off'},
tempfile_kwargs={'suffix': '.html'})

Copy link
Collaborator

Choose a reason for hiding this comment

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

The code does not comply to PEP8.

PEP8Bear, severity NORMAL, section autopep8.

The issue can be fixed by applying the following patch:

--- a/tests/hypertext/HTMLLintBearTest.py
+++ b/tests/hypertext/HTMLLintBearTest.py
@@ -34,4 +34,3 @@
     invalid_files=(),
     settings={'optional_tag': 'off'},
     tempfile_kwargs={'suffix': '.html'})
-

HTMLLintBearDisableCheckerTest = verify_local_bear(
HTMLLintBear,
valid_files=(test_file,),
invalid_files=(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is no invalid_file given?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The invalid_files are tested in a seperate test.

Copy link
Member

Choose a reason for hiding this comment

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

For all tests we should have at least an valid and an invalid file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests before don't follow that. The invalid_files is already covered in the HTMLLintBearTest and HTMLLintBearIgnoreQuotationTest. I feel since HTMLLintBearDisableCheckerTest is supposed to check whether disabling a certain setting takes effect, it would make no sense to include an invalid_file.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pratyushprakash How does this test check whether disabling a certain setting takes effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@namanyadav12 could you please view HTMLLintBearTest.py in its entirety and not just the changes I made

Copy link
Member

@Mixih Mixih Jan 16, 2017

Choose a reason for hiding this comment

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

Imo testing on this bear is a bit screwy and needs to be improved. This would be separate issue. Ideally we test most of these options, but not possible right now. However since we are trying to improve tests, it would be nice if you verified that the bear was outputting the correct error.

@pratyushprakash
Copy link
Contributor Author

@namanyadav12 What exactly do you want changed ?

HTMLLintBear,
valid_files=(test_file,),
invalid_files=(),
settings={'optional_tag': 'off'},
Copy link
Member

Choose a reason for hiding this comment

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

can you add a test with an invalid tag ?
html-lint handles it so we need just to check we are good with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well apparently html-lint does not check for invalid tags.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@pratyushprakash pratyushprakash Jan 16, 2017

Choose a reason for hiding this comment

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

That peice of code is actually informing the user that they provided invalid disable arguments.

Copy link
Member

Choose a reason for hiding this comment

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

yeah, sorry by tag earlier I was referring to disable argument. damn. >_<

@@ -28,9 +28,95 @@ class HTMLLintBear:

@staticmethod
def create_arguments(filename, file, config_file,
doctype: str='Enable',
entities: str='Enable',
trailing_whitespace: str='Enable',
Copy link
Member

Choose a reason for hiding this comment

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

most of the settings start with either allow or enable or force... you should consider using that convention, and particularly for this setting we use allow_trailing_whitespaces [use git grep to check ]

Copy link
Member

Choose a reason for hiding this comment

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

And the settings are of type bool if they are true/false type flags.

Settings have been added for enabling/disabling indidual
features of the `html_linter`.

Closes coala#1247
@@ -28,9 +28,101 @@ class HTMLLintBear:

@staticmethod
def create_arguments(filename, file, config_file,
enable_doctype: bool=True,
enable_entities: bool=True,
enable_trailing_whitespace: bool=True,
Copy link
Member

Choose a reason for hiding this comment

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

use allow_trailing_whitespace for consistency

enable_doctype: bool=True,
enable_entities: bool=True,
enable_trailing_whitespace: bool=True,
enable_tabs: bool=True,
Copy link
Member

Choose a reason for hiding this comment

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

either use_tabs: bool=True or use_spaces: bool=False

@@ -28,9 +28,101 @@ class HTMLLintBear:

@staticmethod
def create_arguments(filename, file, config_file,
enable_doctype: bool=True,
Copy link
Member

Choose a reason for hiding this comment

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

what about check_doctype ? 😅

htmllint_ignore: typed_list(str)=()):
"""
:param htmllint_ignore: List of checkers to ignore.
:param enable_doctype:
Enable or disable doctype checker.
Copy link
Member

Choose a reason for hiding this comment

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

maybe you should add an example here, it is not quite clear what this setting does

:param enable_doctype:
Enable or disable doctype checker.
:param enable_entities:
Enable or disable unicode entity checker.
Copy link
Member

Choose a reason for hiding this comment

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

here too...

:param enable_extra_whitespace:
Enable or disable checker for extra whitespace.
:param htmllint_ignore:
List of checkers to ignore.
Copy link
Member

Choose a reason for hiding this comment

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

i feel like, you should instead tell what the setting do instead of telling what is enabled or disabled

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

8 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!

9 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!

Enable or disable unicode entity checker.
:param enable_trailing_whitespace:
Enable or disable checker for trailing whitespace.
:param enable_tabs:
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 be use_spaces to be consistent with other bears. I've raised that as a separate issue #1741 , which you are welcome to mark as solved in this PR , but it is kind of urgent.

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

9 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!

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.

8 participants