Skip to content

comment-syntax

Terraform (HCL)stylefix: safedefault: off

Reports a // comment where # is the convention. The fix writes #.

Both forms are valid in the language, but the style that the Terraform documentation and the formatter use is #. Comments in one style are easy to search for and look the same in every module.

Reported
// old style
# fine
x = 1 // trailing
/* block */
After the fix
# old style
# fine
x = 1 # trailing
/* block */
hcl:
lint:
rules:
comment-syntax: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line comment-syntax in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
tflint terraform_comment_syntax full