suzuki-shunsuke / tfcmt

Fork of mercari/tfnotify. tfcmt enhances tfnotify in many ways, including Terraform >= v0.15 support and advanced formatting options
https://suzuki-shunsuke.github.io/tfcmt/
Other
411 stars 45 forks source link

Support using `<details>` tag for Warnings #1330

Closed guitarrapc closed 13 hours ago

guitarrapc commented 3 months ago

Feature Overview

Support using <details> tag if warnings exists, which is like what Change Result (Click Me) do.

Why is the feature needed?

When there are many warnings, comments can become too long for the Warning section. Each warning requires 9 lines, so if there are 10 warnings, that totals 90 lines.

As you know, the best practice is to fix all warnings. However, some AWSProvider v5 resources may have potential issues that could leave warnings until v6.

Example Code

No response

note

No response

suzuki-shunsuke commented 2 months ago

You may be aware, but you can use a details tag by setting comment templates in a configuration file.

https://suzuki-shunsuke.github.io/tfcmt/config

But I think it's useful if we can use a details tag easily by option (environment variable, command line, configuration).

e.g.

terraform:
  plan:
    disable_label: false
    wrap_warning_with_details: true
    max_warning_lines: 10 # If the number of lines of warning exceeds this setting, the warning is wrapped with a details tag

I don't come up with good names instead of max_warning_lines.

guitarrapc commented 2 months ago

Thank you for the advice. I am aware of the config except for warnings :) I agree with you that using the config offers flexible configuration, however, modifying the config comes with an extra knowledge cost to keep it up to date with tfcmt versioning.

But I think it's useful if we can use a details tag easily by option (environment variable, command line, configuration).

I think it would be good to keep the default config but allow changing the comment style if needed. Key looks good to me.

suzuki-shunsuke commented 14 hours ago

The new option -skip-warning has been added at v4.14.0. https://github.com/suzuki-shunsuke/tfcmt/releases/tag/v4.14.0

This option is different from the request of this issue but maybe it is helpful if you want to suppress warning.

guitarrapc commented 14 hours ago

Thank you, I've use it and works as expected!

guitarrapc commented 14 hours ago

Looks like we can close the issue. Should I close it?

suzuki-shunsuke commented 13 hours ago

Thank you. Let me close this issue.