Skip to content

Remove all ANSI escape codes in export command output

Oscar Tovar requested to merge otovar/make-gradle-output-plain into master

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?

Edited by Oscar Tovar

Merge request reports