-
Notifications
You must be signed in to change notification settings - Fork 581
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: XMLBear: Support for style specifications #1187
base: master
Are you sure you want to change the base?
Conversation
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! |
xml_schema: path='', | ||
xml_dtd: path_or_url=''): | ||
xml_dtd: path_or_url='', | ||
xml_style: 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.
instead of str
it should be a restricted list of values checked with a function like path_or_url
.
And default should be None
, not ''
""" | ||
args = (filename,) | ||
if xml_schema: | ||
args += ('-schema', xml_schema) | ||
if xml_dtd: | ||
args += ('-dtdvalid', xml_dtd) | ||
styles = ('c14n', 'c14n11', 'exc-c14n', 'oldxml10') |
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.
CONSTANT list, should be a module or class attribute
XMLBear, | ||
valid_files=(valid_xml_file,), | ||
invalid_files=(invalid_xml_chars,), | ||
settings={'xml_style': 'oldxml10'}, |
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.
This style is not being tested. This test class is identical to XMLBearCorrectedTest
, etc.
You need to find an XML style issue, and ensure that the linter bear reports the error that xmllint
emits and that its severity is correct.
settings={'xml_style': 'oldxml10'}, | ||
tempfile_kwargs={'suffix': '.xml'}) | ||
|
||
XMLBearInvalidStyleTest = verify_local_bear( |
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.
XMLBearInvalidStyleTest -> XMLBearUnrecognisedStyleNameTest
args += ('--' + xml_style,) | ||
self._diff_severity = RESULT_SEVERITY.MAJOR | ||
elif xml_style != '': | ||
self.warn('Invalid xml_style argument ' + xml_style + |
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.
this should be an error -- the user has mistyped the style. coala should not allow invalid configuration.
XMLBear, | ||
valid_files=(valid_xml_file,), | ||
invalid_files=(invalid_xml_chars,), | ||
settings={'xml_style': 'wrong args'}, |
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.
need to confirm that this error is the cause of the failure.
otherwise, some other error could occur and this test look like it has been effective.
9fe080e
to
749fa9e
Compare
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
749fa9e
to
2e47414
Compare
""" | ||
style = str(xml_style) | ||
if style not in XMLBear._styles: | ||
logging.error('Unrecognised style ' + style + '. Valid xml' |
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 think this should be a warning and you should mention that you just ignore the argument because you're not erroring out, you're just ignoring that part right?
""" | ||
:param xml_schema: ``W3C XML Schema`` file used for validation. | ||
:param xml_dtd: ``Document type Definition (DTD)`` file or | ||
url used for validation. | ||
:param xml_style: ``XML Style Specification`` Relevant args are | ||
c14n, c14n11, exc-c14n and oldxml10. |
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 include a URL where I can find out more about those cryptic things? Can we maybe ake them less cryptic?
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.
you need to include that info here so the user can find out more about the specs, not me
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.
oh, ok !! I misunderstood you earlier
""" | ||
args = (filename,) | ||
if xml_schema: | ||
args += ('-schema', xml_schema) | ||
if xml_dtd: | ||
args += ('-dtdvalid', xml_dtd) | ||
if xml_style: | ||
args += (xml_style,) | ||
self._diff_severity = RESULT_SEVERITY.MAJOR |
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 is this major? Also if you do this, all the other errors in the diff will have a major severity as well, right? That sounds 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.
2e47414
to
54f9232
Compare
@sils you can find out more about the formats at |
Also @sils, self._diff_severity = RESULT_SEVERITY.MAJOR is to make sure that If the user has chosen a style in the configuration, the style messages from the bear are treated as "MAJOR" severity errors. |
Please include the links that you gave in the comment, as sils pointet out here |
54f9232 needs work |
A format can be specified in the arguments or in the configuration. The valid args are c14n, c14n11, exc-c14n and oldxml10. If a style is specified, style issues have a MAJOR severity. Closes coala#1098
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
7 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
@@ -68,7 +91,7 @@ def process_output(self, output, filename, file): | |||
output_regex=self._output_regex), | |||
self.process_output_corrected( | |||
stdout, filename, file, | |||
diff_severity=RESULT_SEVERITY.INFO, | |||
diff_severity=self._diff_severity, |
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.
Isnt this a thread unsafe operation?
Is that a problem? cc: @Makman2
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.
in praxis it's not (due to python executing everything in several processes), though this is a local variable and shall be used as such. So replace self._diff_severity
with just diff_severity
👍
We've all invested a lot of time into this PR. |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
15 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
A format can be specified in the arguments or in the configuration.
The valid args are c14n, c14n11, exc-c14n and oldxml10.
If a style is specified, then the style messages from the bear have MAJOR severity.
Closes #1098