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

HTML report has spurious characters from console colors #184

Closed
devdanzin opened this issue Jul 5, 2023 · 0 comments · Fixed by #185
Closed

HTML report has spurious characters from console colors #184

devdanzin opened this issue Jul 5, 2023 · 0 comments · Fixed by #185

Comments

@devdanzin
Copy link
Collaborator

HTML report generated with wily report --format HTML has spurious characters around the colored delta:
spurious_characters

It comes from an incomplete text replacement in src/wily/commands/report.py:

element = element.replace("[32m", "<span class='green-color'>")

Given that element above was constructed as below, there's a \u001b character that doesn't get replaced:

f"\u001b[{meta['decrease_color']}m{delta:n}\u001b[0m"

To Reproduce

  1. checkout wily's repo
  2. wily build
  3. wily report -n 135 --format HTML src\wily\commands\report.py loc
  4. See spurious \u001b characters around delta in e.g. rev a96280e.

Expected behavior
Deltas should still be colored, but without spurious characters around them, as below:
no_spurious_characters

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 1.24.2

I have a trivial fix, will submit PR.

tonybaloney added a commit that referenced this issue Jul 10, 2023
HTML report: replace ESCAPE character (fix #184)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant