Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@ on:
# branches to consider in the event; optional, defaults to all
branches:
- main
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]

permissions:
# write permission is required to create a github release
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# TFLint Ruleset Template
[![Build Status](https://github.com/terraform-linters/tflint-ruleset-template/workflows/build/badge.svg?branch=main)](https://github.com/terraform-linters/tflint-ruleset-template/actions)

This is a template repository for building a custom ruleset. You can create a plugin repository from "Use this template". See also [Writing Plugins](https://github.com/terraform-linters/tflint/blob/master/docs/developer-guide/plugins.md).
# TFLint Ruleset trailing-comma

## Requirements

- TFLint v0.42+
- Go v1.22
- Go v1.22 or newer

## Installation

TODO: This template repository does not contain release binaries, so this installation will not work. Please rewrite for your repository. See the "Building the plugin" section to get this template ruleset working.

You can install the plugin with `tflint --init`. Declare a config in `.tflint.hcl` as follows:

```hcl
plugin "template" {
plugin "trailing-comma" {
enabled = true

version = "0.1.0"
Expand Down
3 changes: 2 additions & 1 deletion rules/terraform_lists_trailing_comma.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ func (r *TerraformListsTrailingCommaRule) Check(runner tflint.Runner) error {
file := files[filename]

list, ok := e.(*hclsyntax.TupleConsExpr)
if !ok {
if !ok || len(list.Exprs) <= 0 {
return nil
}

listRange := list.Range()
lastItem := list.Exprs[len(list.Exprs)-1]
lastItemRange := lastItem.Range()
Expand Down
Loading