-
Notifications
You must be signed in to change notification settings - Fork 243
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
Strip ANSI escape sequences when ansi2html is missing #315
Conversation
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 have mixed feelings regarding this because it goes a dangerous path (auto-processing input, not even mentioning why is stipping ANSI.)
Maybe we should log that we remove ANSI as ansi2html is not present.
Adding E203 as general exception is not acceptable. Inline exclude would be ok if not avoidable other way and if added as general exception, it must be preceded with a comment line explaining the reasoning for doing it. The only good reason I remember was incompatibility with black.
Also please rephrase it as "Strip ANSI when ansi2html is missing", it would be easier to understand why this needs to happen.
tox.ini
Outdated
@@ -22,6 +22,7 @@ deps = pre-commit | |||
commands = pre-commit run --all-files --show-diff-on-failure | |||
|
|||
[flake8] | |||
ignore = E203 |
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 see not reason for this, also no explanation. If is a bug in flake8, why not using an inline exclude instead of diabling an entire rule?
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.
Afaik, the rule is broken full stop, not in particular cases. It's also not PEP8 compliant.
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.
Perfect, in that case just a comment similar to the one I proposed. Reasoning behind is that I want to discourage someone from adding arbitrary excludes in the future. Documenting reason would also avoid questions or the need to use blame to find why.
Why do you figure? To me this is an obvious bug, no? I think emitting a warning in this case would just add noise.
Apparently E203 is broken and not PEP8 compliant, so I don't see any reason to not disable it completely. Especially since Reasoning from black Even
You mean rephrase the PR? |
Yeah. Usually I would have rephrased the PR myself but I do not have this privilege. As these end-up as release notes, I do not want to force user to raise a brow when reading it. Regarding printing a warning, is was only a suggestion, not a request. It is very common for new users of pytest-html to miss having ansi2html, as is not an implicit requirement. Printing something, could make them fix the issue instead of wondering around. |
No problem, I'll rephrase.
Not sure what you mean, but there's no automation surrounding the release notes (yet). It's all manually written.
Oh, I see. 🤔 Do you mean that the default usage of the plugin should be to use it in conjunction with If that's the case, we could emit a more general warning saying that it's recommended to use it together with the plugin. @ssbarnea |
a04e63a
to
3a4efa1
Compare
tox.ini
Outdated
@@ -22,6 +22,7 @@ deps = pre-commit | |||
commands = pre-commit run --all-files --show-diff-on-failure | |||
|
|||
[flake8] | |||
ignore = E203 |
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.
Perfect, in that case just a comment similar to the one I proposed. Reasoning behind is that I want to discourage someone from adding arbitrary excludes in the future. Documenting reason would also avoid questions or the need to use blame to find why.
# rationale here: | ||
# https://github.com/psf/black/blob/master/docs/the_black_code_style.md#slices | ||
extend-ignore = E203 |
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.
ping @ssbarnea
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 already approved but apparently I do not get enough rights for the vote to matter (is gray, not green).
How about making |
Has something changed re. licensing? |
Oh forgot about that issue, thanks for reminding me. |
A quick search turns up https://bitbucket.org/dhrrgn/ansiconv, but I'm can't vouch if it is maintained. |
Hasn't been touched since 2014. Do you see an issue with my solution? It's straight from |
Not in particular other than using a private function, otherwise LGTM! |
TO be honest, I had an years old with to rewrite ansi2html with a MIT/BSD-like license that does not impose reusability limitations but never had time. The amount of code it has is very low. Still, I always have other more pressing issues to sort, maybe if we join efforts we can make it a reality? I even bootstrapped it at https://github.com/pycontribs/a2h -- pypi package namespace too. With your help we can probably sort it quickly. There is a long list of python libraries that share the same issue around ansi2html, is not only pytest-html that would benefit from it. |
I'm happy to help. But you would have to take lead. @ssbarnea Also, this plugin needs a rewrite as well. Especially moving away from the py.xml dependency. |
I sent invites to both of you. I will take case of pushing the code and setting up CI/CD pipelines for it. If I am lucky I may have something ready before Monday. |
Sadly the plan to work on a2h over the weekend had to be postponed as I faced other more pressing fixing, like creating a maintenance fork for a ruamel.yaml library. Still, I will try to do something during next week. |
Fixes: #314