コードから明らかな内容をコメントに書かない
ルール
Do not add comments describing what is already clear from the code.
(コードから明らかな内容を説明するコメントを追加しない)
解説
コードを見れば分かる内容を繰り返すコメントは害のほうが大きいため禁止しています。
サンプルコード
# 良い例
resource "aws_s3_bucket_lifecycle_configuration" "logs" {
bucket = aws_s3_bucket.logs.id
rule {
id = "delete_old_logs"
status = "Enabled"
# 監査要件により90日間保持
expiration {
days = 90
}
}
}
# 悪い例(参考)
# resource "aws_s3_bucket" "logs" { # <- S3バケットを作成
# bucket = "${var.environment}-${var.project}-logs" # <- バケット名を設定
# }
コードから明らかな内容をコメントに書かない https://www.tricrow.com/infrastructure/development-guidline/coding_standards.style.comments_no_obvious.html

