Skip to content

Commit

Permalink
docs: add configuration examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Jun 24, 2023
1 parent e1fecdc commit e888512
Showing 1 changed file with 94 additions and 12 deletions.
106 changes: 94 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,108 @@ Define the rules, you want via your [golangci-lint](https://golangci-lint.run) c
```yaml
linters-settings:
tagliatelle:
# Check the struck tag name case.
# Check the struct tag name case.
case:
# Use the struct field name to check the name of the struct tag.
# Default: false
use-field-name: true
# Define the association between tag name and case.
# Any struct tag name can be used.
# Support string cases:
# - `camel`
# - `pascal`
# - `kebab`
# - `snake`
# - `upperSnake`
# - `goCamel`
# - `goPascal`
# - `goKebab`
# - `goSnake`
# - `upper`
# - `lower`
# - `header`
rules:
json: camel
yaml: camel
xml: camel
whatever: snake
# The field names to ignore.
# Default: []
ignored-fields:
- Bar
- Foo
# Overrides the default/root configuration.
# Default: []
overrides:
# The fully qualified package name. (uses `/` only)
# <module_name>/<package_name>
# Require
- pkg: example.com/foo/bar
# Default: false or the same as the default/root configuration.
use-field-name: true
# Default: empty or the same as the default/root configuration.
rules:
json: snake
xml: pascal
# The field names to ignore.
# Default: {} or the same as the default/root configuration.
ignored-fields:
- Bar
- Foo
# Ignore the package (take the precedence over all other configuration.
# Default: false
ignore: true
```
#### Examples
Overrides case rules for the package `example.com/foo/bar`:

```yaml
linters-settings:
tagliatelle:
case:
rules:
json: camel
yaml: camel
xml: camel
overrides:
- pkg: example.com/foo/bar
rules:
json: snake
xml: pascal
```

Ignore fields inside the package `example.com/foo/bar`:

```yaml
linters-settings:
tagliatelle:
case:
rules:
json: camel
yaml: camel
xml: camel
overrides:
- pkg: example.com/foo/bar
ignored-fields:
- Bar
- Foo
```

Ignore the package `example.com/foo/bar`:

```yaml
linters-settings:
tagliatelle:
case:
rules:
# Any struct tag type can be used.
# Support string case: `camel`, `pascal`, `kebab`, `snake`, `upperSnake`, `goCamel`, `goPascal`, `goKebab`, `goSnake`, `upper`, `lower`, `header`.
json: camel
yaml: camel
xml: camel
overrides:
- pkg: foo/foo
use-field-name: true
rules:
json: snake
xml: pascal
ignored-fields:
- Bar
- Foo
overrides:
- pkg: example.com/foo/bar
ignore: true
```

More information here https://golangci-lint.run/usage/linters/#tagliatelle
Expand Down

0 comments on commit e888512

Please sign in to comment.