Skip to content

Commit 9259d0e

Browse files
authored
Stop using backticks for emphasis (#1934)
1 parent 69526ee commit 9259d0e

27 files changed

+219
-207
lines changed

cmd/cli.go

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,30 +109,27 @@ func (cli *CLI) Run(args []string) int {
109109

110110
func unknownOptionHandler(option string, arg flags.SplitArgument, args []string) ([]string, error) {
111111
if option == "debug" {
112-
return []string{}, errors.New("`debug` option was removed in v0.8.0. Please set `TFLINT_LOG` environment variables instead")
113-
}
114-
if option == "fast" {
115-
return []string{}, errors.New("`fast` option was removed in v0.9.0. The `aws_instance_invalid_ami` rule is already fast enough")
112+
return []string{}, errors.New("--debug option was removed in v0.8.0. Please set TFLINT_LOG environment variables instead")
116113
}
117114
if option == "error-with-issues" {
118-
return []string{}, errors.New("`error-with-issues` option was removed in v0.9.0. The behavior is now default")
115+
return []string{}, errors.New("--error-with-issues option was removed in v0.9.0. The behavior is now default")
119116
}
120117
if option == "quiet" || option == "q" {
121-
return []string{}, errors.New("`quiet` option was removed in v0.11.0. The behavior is now default")
118+
return []string{}, errors.New("--quiet option was removed in v0.11.0. The behavior is now default")
122119
}
123120
if option == "ignore-rule" {
124-
return []string{}, errors.New("`ignore-rule` option was removed in v0.12.0. Please use `--disable-rule` instead")
121+
return []string{}, errors.New("--ignore-rule option was removed in v0.12.0. Please use --disable-rule instead")
125122
}
126123
if option == "deep" {
127-
return []string{}, errors.New("`deep` option was removed in v0.23.0. Deep checking is now a feature of the AWS plugin, so please configure the plugin instead")
124+
return []string{}, errors.New("--deep option was removed in v0.23.0. Deep checking is now a feature of the AWS plugin, so please configure the plugin instead")
128125
}
129126
if option == "aws-access-key" || option == "aws-secret-key" || option == "aws-profile" || option == "aws-creds-file" || option == "aws-region" {
130-
return []string{}, fmt.Errorf("`%s` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead", option)
127+
return []string{}, fmt.Errorf("--%s option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead", option)
131128
}
132129
if option == "loglevel" {
133-
return []string{}, errors.New("`loglevel` option was removed in v0.40.0. Please set `TFLINT_LOG` environment variables instead")
130+
return []string{}, errors.New("--loglevel option was removed in v0.40.0. Please set TFLINT_LOG environment variables instead")
134131
}
135-
return []string{}, fmt.Errorf("`%s` is unknown option. Please run `tflint --help`", option)
132+
return []string{}, fmt.Errorf(`--%s is unknown option. Please run "tflint --help"`, option)
136133
}
137134

138135
func findWorkingDirs(opts Options) ([]string, error) {

cmd/init.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,27 @@ func (cli *CLI) init(opts Options) int {
4545

4646
_, err := plugin.FindPluginPath(installCfg)
4747
if os.IsNotExist(err) {
48-
fmt.Fprintf(cli.outStream, "Installing `%s` plugin...\n", pluginCfg.Name)
48+
fmt.Fprintf(cli.outStream, `Installing "%s" plugin...\n`, pluginCfg.Name)
4949

5050
sigchecker := plugin.NewSignatureChecker(installCfg)
5151
if !sigchecker.HasSigningKey() {
52-
_, _ = color.New(color.FgYellow).Fprintln(cli.outStream, "No signing key configured. Set `signing_key` to verify that the release is signed by the plugin developer")
52+
_, _ = color.New(color.FgYellow).Fprintln(cli.outStream, `No signing key configured. Set "signing_key" to verify that the release is signed by the plugin developer`)
5353
}
5454

5555
_, err = installCfg.Install()
5656
if err != nil {
5757
return fmt.Errorf("Failed to install a plugin; %w", err)
5858
}
5959

60-
fmt.Fprintf(cli.outStream, "Installed `%s` (source: %s, version: %s)\n", pluginCfg.Name, pluginCfg.Source, pluginCfg.Version)
60+
fmt.Fprintf(cli.outStream, `Installed "%s" (source: %s, version: %s)\n`, pluginCfg.Name, pluginCfg.Source, pluginCfg.Version)
6161
continue
6262
}
6363

6464
if err != nil {
6565
return fmt.Errorf("Failed to find a plugin; %w", err)
6666
}
6767

68-
fmt.Fprintf(cli.outStream, "Plugin `%s` is already installed\n", pluginCfg.Name)
68+
fmt.Fprintf(cli.outStream, `Plugin "%s" is already installed\n`, pluginCfg.Name)
6969
}
7070

7171
if opts.Recursive && !found {

cmd/inspect.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,31 +279,31 @@ func launchPlugins(config *tflint.Config, fix bool) (*plugin.Plugin, error) {
279279
// VersionConstraints endpoint is available in tflint-plugin-sdk v0.14+.
280280
return rulesetPlugin, fmt.Errorf(`Plugin "%s" SDK version is incompatible. Compatible versions: %s`, name, plugin.SDKVersionConstraints)
281281
} else {
282-
return rulesetPlugin, fmt.Errorf("Failed to get TFLint version constraints to `%s` plugin; %w", name, err)
282+
return rulesetPlugin, fmt.Errorf(`Failed to get TFLint version constraints to "%s" plugin; %w`, name, err)
283283
}
284284
}
285285
if !constraints.Check(tflint.Version) {
286286
return rulesetPlugin, fmt.Errorf("Failed to satisfy version constraints; tflint-ruleset-%s requires %s, but TFLint version is %s", name, constraints, tflint.Version)
287287
}
288288

289289
if err := ruleset.ApplyGlobalConfig(pluginConf); err != nil {
290-
return rulesetPlugin, fmt.Errorf("Failed to apply global config to `%s` plugin; %w", name, err)
290+
return rulesetPlugin, fmt.Errorf(`Failed to apply global config to "%s" plugin; %w`, name, err)
291291
}
292292
configSchema, err := ruleset.ConfigSchema()
293293
if err != nil {
294-
return rulesetPlugin, fmt.Errorf("Failed to fetch config schema from `%s` plugin; %w", name, err)
294+
return rulesetPlugin, fmt.Errorf(`Failed to fetch config schema from "%s" plugin; %w`, name, err)
295295
}
296296
content := &hclext.BodyContent{}
297297
if plugin, exists := config.Plugins[name]; exists {
298298
var diags hcl.Diagnostics
299299
content, diags = plugin.Content(configSchema)
300300
if diags.HasErrors() {
301-
return rulesetPlugin, fmt.Errorf("Failed to parse `%s` plugin config; %w", name, diags)
301+
return rulesetPlugin, fmt.Errorf(`Failed to parse "%s" plugin config; %w`, name, diags)
302302
}
303303
}
304304
err = ruleset.ApplyConfig(content, config.Sources())
305305
if err != nil {
306-
return rulesetPlugin, fmt.Errorf("Failed to apply config to `%s` plugin; %w", name, err)
306+
return rulesetPlugin, fmt.Errorf(`Failed to apply config to "%s" plugin; %w`, name, err)
307307
}
308308

309309
rulesets = append(rulesets, ruleset)

cmd/option.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ type Options struct {
3939
func (opts *Options) toConfig() *tflint.Config {
4040
ignoreModules := map[string]bool{}
4141
for _, module := range opts.IgnoreModules {
42-
// For the backward compatibility, allow specifying like `source1,source2` style
42+
// For the backward compatibility, allow specifying like "source1,source2" style
4343
for _, m := range strings.Split(module, ",") {
4444
ignoreModules[m] = true
4545
}
4646
}
4747

4848
varfiles := []string{}
4949
for _, vf := range opts.Varfiles {
50-
// For the backward compatibility, allow specifying like `varfile1,varfile2` style
50+
// For the backward compatibility, allow specifying like "varfile1,varfile2" style
5151
varfiles = append(varfiles, strings.Split(vf, ",")...)
5252
}
5353
if opts.Variables == nil {

cmd/option_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func Test_toConfig(t *testing.T) {
112112
},
113113
},
114114
{
115-
Name: "multiple `--ignore-module`",
115+
Name: "multiple --ignore-module",
116116
Command: "./tflint --ignore-module module1 --ignore-module module2",
117117
Expected: &tflint.Config{
118118
CallModuleType: terraform.CallLocalModule,
@@ -140,7 +140,7 @@ func Test_toConfig(t *testing.T) {
140140
},
141141
},
142142
{
143-
Name: "multiple `--var-file`",
143+
Name: "multiple --var-file",
144144
Command: "./tflint --var-file example1.tfvars --var-file example2.tfvars",
145145
Expected: &tflint.Config{
146146
CallModuleType: terraform.CallLocalModule,

docs/user-guide/plugins.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ After declaring the `version` and `source`, `tflint --init` can automatically in
2323

2424
```console
2525
$ tflint --init
26-
Installing `foo` plugin...
27-
Installed `foo` (source: github.com/org/tflint-ruleset-foo, version: 0.1.0)
26+
Installing "foo" plugin...
27+
Installed "foo" (source: github.com/org/tflint-ruleset-foo, version: 0.1.0)
2828
$ tflint -v
2929
TFLint version 0.28.1
3030
+ ruleset.foo (0.1.0)

integrationtest/cli/cli_test.go

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -85,95 +85,88 @@ func TestIntegration(t *testing.T) {
8585
stderr: "Failed to load configurations;",
8686
},
8787
{
88-
name: "removed `debug` options",
88+
name: "removed --debug options",
8989
command: "./tflint --debug",
9090
dir: "no_issues",
9191
status: cmd.ExitCodeError,
92-
stderr: "`debug` option was removed in v0.8.0. Please set `TFLINT_LOG` environment variables instead",
92+
stderr: "--debug option was removed in v0.8.0. Please set TFLINT_LOG environment variables instead",
9393
},
9494
{
95-
name: "removed `fast` option",
96-
command: "./tflint --fast",
97-
dir: "no_issues",
98-
status: cmd.ExitCodeError,
99-
stderr: "`fast` option was removed in v0.9.0. The `aws_instance_invalid_ami` rule is already fast enough",
100-
},
101-
{
102-
name: "removed `--error-with-issues` option",
95+
name: "removed --error-with-issues option",
10396
command: "./tflint --error-with-issues",
10497
dir: "no_issues",
10598
status: cmd.ExitCodeError,
106-
stderr: "`error-with-issues` option was removed in v0.9.0. The behavior is now default",
99+
stderr: "--error-with-issues option was removed in v0.9.0. The behavior is now default",
107100
},
108101
{
109-
name: "removed `--quiet` option",
102+
name: "removed --quiet option",
110103
command: "./tflint --quiet",
111104
dir: "no_issues",
112105
status: cmd.ExitCodeError,
113-
stderr: "`quiet` option was removed in v0.11.0. The behavior is now default",
106+
stderr: "--quiet option was removed in v0.11.0. The behavior is now default",
114107
},
115108
{
116-
name: "removed `--ignore-rule` option",
109+
name: "removed --ignore-rule option",
117110
command: "./tflint --ignore-rule aws_instance_example_type",
118111
dir: "no_issues",
119112
status: cmd.ExitCodeError,
120-
stderr: "`ignore-rule` option was removed in v0.12.0. Please use `--disable-rule` instead",
113+
stderr: "--ignore-rule option was removed in v0.12.0. Please use --disable-rule instead",
121114
},
122115
{
123-
name: "removed `--deep` option",
116+
name: "removed --deep option",
124117
command: "./tflint --deep",
125118
dir: "no_issues",
126119
status: cmd.ExitCodeError,
127-
stderr: "`deep` option was removed in v0.23.0. Deep checking is now a feature of the AWS plugin, so please configure the plugin instead",
120+
stderr: "--deep option was removed in v0.23.0. Deep checking is now a feature of the AWS plugin, so please configure the plugin instead",
128121
},
129122
{
130-
name: "removed `--aws-access-key` option",
123+
name: "removed --aws-access-key option",
131124
command: "./tflint --aws-access-key AWS_ACCESS_KEY_ID",
132125
dir: "no_issues",
133126
status: cmd.ExitCodeError,
134-
stderr: "`aws-access-key` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
127+
stderr: "--aws-access-key option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
135128
},
136129
{
137-
name: "removed `--aws-secret-key` option",
130+
name: "removed --aws-secret-key option",
138131
command: "./tflint --aws-secret-key AWS_SECRET_ACCESS_KEY",
139132
dir: "no_issues",
140133
status: cmd.ExitCodeError,
141-
stderr: "`aws-secret-key` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
134+
stderr: "--aws-secret-key option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
142135
},
143136
{
144-
name: "removed `--aws-profile` option",
137+
name: "removed --aws-profile option",
145138
command: "./tflint --aws-profile AWS_PROFILE",
146139
dir: "no_issues",
147140
status: cmd.ExitCodeError,
148-
stderr: "`aws-profile` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
141+
stderr: "--aws-profile option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
149142
},
150143
{
151-
name: "removed `--aws-creds-file` option",
144+
name: "removed --aws-creds-file option",
152145
command: "./tflint --aws-creds-file FILE",
153146
dir: "no_issues",
154147
status: cmd.ExitCodeError,
155-
stderr: "`aws-creds-file` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
148+
stderr: "--aws-creds-file option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
156149
},
157150
{
158-
name: "removed `--aws-region` option",
151+
name: "removed --aws-region option",
159152
command: "./tflint --aws-region us-east-1",
160153
dir: "no_issues",
161154
status: cmd.ExitCodeError,
162-
stderr: "`aws-region` option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
155+
stderr: "--aws-region option was removed in v0.23.0. AWS rules are provided by the AWS plugin, so please configure the plugin instead",
163156
},
164157
{
165-
name: "removed `--loglevel` option",
158+
name: "removed --loglevel option",
166159
command: "./tflint --loglevel debug",
167160
dir: "no_issues",
168161
status: cmd.ExitCodeError,
169-
stderr: "`loglevel` option was removed in v0.40.0. Please set `TFLINT_LOG` environment variables instead",
162+
stderr: "--loglevel option was removed in v0.40.0. Please set TFLINT_LOG environment variables instead",
170163
},
171164
{
172165
name: "invalid options",
173166
command: "./tflint --unknown",
174167
dir: "no_issues",
175168
status: cmd.ExitCodeError,
176-
stderr: "`unknown` is unknown option. Please run `tflint --help`",
169+
stderr: `--unknown is unknown option. Please run "tflint --help"`,
177170
},
178171
{
179172
name: "invalid format",
@@ -197,35 +190,35 @@ func TestIntegration(t *testing.T) {
197190
stdout: fmt.Sprintf("%s (aws_instance_example_type)", color.New(color.Bold).Sprint("instance type is t2.micro")),
198191
},
199192
{
200-
name: "`--force` option with issues",
193+
name: "--force option with issues",
201194
command: "./tflint --force",
202195
dir: "issues_found",
203196
status: cmd.ExitCodeOK,
204197
stdout: fmt.Sprintf("%s (aws_instance_example_type)", color.New(color.Bold).Sprint("instance type is t2.micro")),
205198
},
206199
{
207-
name: "`--minimum-failure-severity` option with warning issues and minimum-failure-severity notice",
200+
name: "--minimum-failure-severity option with warning issues and minimum-failure-severity notice",
208201
command: "./tflint --minimum-failure-severity=notice",
209202
dir: "warnings_found",
210203
status: cmd.ExitCodeIssuesFound,
211204
stdout: fmt.Sprintf("%s (aws_s3_bucket_with_config_example)", color.New(color.Bold).Sprint("bucket name is test, config=bucket")),
212205
},
213206
{
214-
name: "`--minimum-failure-severity` option with warning issues and minimum-failure-severity warning",
207+
name: "--minimum-failure-severity option with warning issues and minimum-failure-severity warning",
215208
command: "./tflint --minimum-failure-severity=warning",
216209
dir: "warnings_found",
217210
status: cmd.ExitCodeIssuesFound,
218211
stdout: fmt.Sprintf("%s (aws_s3_bucket_with_config_example)", color.New(color.Bold).Sprint("bucket name is test, config=bucket")),
219212
},
220213
{
221-
name: "`--minimum-failure-severity` option with warning issues and minimum-failure-severity error",
214+
name: "--minimum-failure-severity option with warning issues and minimum-failure-severity error",
222215
command: "./tflint --minimum-failure-severity=error",
223216
dir: "warnings_found",
224217
status: cmd.ExitCodeOK,
225218
stdout: fmt.Sprintf("%s (aws_s3_bucket_with_config_example)", color.New(color.Bold).Sprint("bucket name is test, config=bucket")),
226219
},
227220
{
228-
name: "`--no-color` option",
221+
name: "--no-color option",
229222
command: "./tflint --no-color",
230223
dir: "issues_found",
231224
status: cmd.ExitCodeIssuesFound,

integrationtest/init/init_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ func TestIntegration(t *testing.T) {
4141
}
4242

4343
cli.Run([]string{"./tflint"})
44-
if !strings.Contains(errStream.String(), "Plugin `aws` not found. Did you run `tflint --init`?") {
44+
if !strings.Contains(errStream.String(), `Plugin "aws" not found. Did you run "tflint --init"?`) {
4545
t.Fatalf("Expected to contain an initialization error, but did not: stdout=%s, stderr=%s", outStream, errStream)
4646
}
4747

4848
cli.Run([]string{"./tflint", "--init"})
49-
if !strings.Contains(outStream.String(), "Installing `aws` plugin...") {
49+
if !strings.Contains(outStream.String(), `Installing "aws" plugin...`) {
5050
t.Fatalf("Expected to contain an installation log, but did not: stdout=%s, stderr=%s", outStream, errStream)
5151
}
52-
if !strings.Contains(outStream.String(), "Installed `aws` (source: github.com/terraform-linters/tflint-ruleset-aws, version: 0.21.1)") {
52+
if !strings.Contains(outStream.String(), `Installed "aws" (source: github.com/terraform-linters/tflint-ruleset-aws, version: 0.21.1)`) {
5353
t.Fatalf("Expected to contain an installed log, but did not: stdout=%s, stderr=%s", outStream, errStream)
5454
}
5555

5656
cli.Run([]string{"./tflint", "--init"})
57-
if !strings.Contains(outStream.String(), "Plugin `aws` is already installed") {
57+
if !strings.Contains(outStream.String(), `Plugin "aws" is already installed`) {
5858
t.Fatalf("Expected to contain an already installed log, but did not: stdout=%s, stderr=%s", outStream, errStream)
5959
}
6060

@@ -74,7 +74,7 @@ func TestIntegration(t *testing.T) {
7474
}
7575

7676
cli.Run([]string{"./tflint", "--chdir", "basic", "--init"})
77-
if !strings.Contains(outStream.String(), "Plugin `aws` is already installed") {
77+
if !strings.Contains(outStream.String(), `Plugin "aws" is already installed`) {
7878
t.Fatalf("Expected to contain an already installed log, but did not: stdout=%s, stderr=%s", outStream, errStream)
7979
}
8080

@@ -103,7 +103,7 @@ func TestIntegration(t *testing.T) {
103103
if !strings.Contains(outStream.String(), "working directory: basic") {
104104
t.Fatalf("Expected to contain working dir log, but did not: stdout=%s, stderr=%s", outStream, errStream)
105105
}
106-
if !strings.Contains(outStream.String(), "Plugin `aws` is already installed") {
106+
if !strings.Contains(outStream.String(), `Plugin "aws" is already installed`) {
107107
t.Fatalf("Expected to contain an already installed log, but did not: stdout=%s, stderr=%s", outStream, errStream)
108108
}
109109

integrationtest/inspection/enable-required-config-rule-by-cli/result.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"issues": [],
33
"errors": [
44
{
5-
"message": "Failed to check ruleset; failed to check \"aws_s3_bucket_with_config_example\" rule: This rule cannot be enabled with the `--enable-rule` option because it lacks the required configuration",
5+
"message": "Failed to check ruleset; failed to check \"aws_s3_bucket_with_config_example\" rule: This rule cannot be enabled with the --enable-rule option because it lacks the required configuration",
66
"severity": "error"
77
}
88
]

0 commit comments

Comments
 (0)