Remove all ANSI escape codes in export command output
What does this MR do?
This MR makes it so that analyzer strips all ANSI codes before extracting
dependency export paths in the extract
function. It does so by using a
regex taken from github.com/chalk/ansi-regex to match on all the escape codes. This is referenced in the code and the
license is also attached to the variable (MIT License).
Why this approach was taken
I first tried to parse and remove the duplicate argument --console=rich
but there
were too many edge cases to consider. Additionally, it was possible that a configuration
file declared this value, which made the problem even more complex. The smallest change
was therefore to remove all ANSI codes with the regex from the chalk/ansi-regex
project.
Lastly, this covers other package managers that also have this hard to discover bug. For
example, it's possible that pipenv
or composer
might have the same problem.
What are the relevant issue numbers?
Fixes gitlab-org/gitlab#430154 (closed)
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated for GitLab EE, if necessary -
Documentation created/updated for this project, if necessary -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Job definition updated, if necessary -
Conforms to the code review guidelines -
Conforms to the Go guidelines -
Security reports checked/validated by reviewer