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

Do not output colors in terraform_fmt #354

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Conversation

senilio
Copy link
Contributor

@senilio senilio commented Mar 27, 2024

Currently the terraform_fmt formatter outputs colors, resulting in "bad" characters in conform.log.

Example:

22:03:46[ERROR] Formatter 'terraform_fmt' error: �[31m�[31m╷�[0m�[0m
�[31m│�[0m �[0m�[1m�[31mError: �[0m�[0m�[1mAttribute redefined�[0m
�[31m│�[0m �[0m
�[31m│�[0m �[0m�[0m  on <stdin> line 3, in resource "test":
�[31m│�[0m �[0m   3: 	�[4mhello�[0m = 123�[0m
�[31m│�[0m �[0m
�[31m│�[0m �[0mThe argument "hello" was already set at <stdin>:2,3-8. Each argument may be
�[31m│�[0m �[0mset only once.
�[31m╵�[0m�[0m
�[0m�[0m

Adding the -no-color argument to terraform fmt will result in a more readable output:

22:13:44[ERROR] Formatter 'terraform_fmt' error: 
Error: Attribute redefined

  on <stdin> line 3, in resource "test":
   3: 	hello = 123

The argument "hello" was already set at <stdin>:2,3-8. Each argument may be
set only once.

I know this can be added via config, but IMO this should be the default behaviour.

@github-actions github-actions bot requested a review from stevearc March 27, 2024 21:22
@stevearc
Copy link
Owner

Thanks for the fix!

@stevearc stevearc merged commit f3363ad into stevearc:master Mar 28, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants