andreoliwa/nitpick

View on GitHub
docs/ideas/yaml/lists.toml

Summary

Maintainability
Test Coverage
# List behaviours that are still not implemented in YAML (maybe they can be used in other formats too)

# 1. List behaviour: Exact list (dict or scalar) __exact
# The whole list will be replaced exactly by what's defined in the style
# Use the "__exact" suffix on the list name
[[".pre-commit-config.yaml".repos]]
repo = "https://github.com/alessandrojcm/commitlint-pre-commit-hook"
[[".pre-commit-config.yaml".repos.hooks]]
additional_dependencies__exact = ["@commitlint/config-conventional"]
id = "commitlint"
stages = ["commit-msg"]

# 2. List behaviour: Define the fields that should be part of the hash
["some-file.yaml".__list_hash_fields]
# Hash all fields (default)
some_list = "*"
# Hash only specific fields
person_list = "name,age,gender"
# Hash all fields except these
another_list = "-price,size"

# 3. List behaviour: Custom function (dict or scalar)
# Search using a custom function.
# A custom function called by Nitpick that receives X, Y, Z arguments (to be defined)
# And returns the new element and its index it should be in the list:
# - 0 to len(list)
# - or -1 to append the element at the end
["another-file.yaml".__search_custom]
my_fancy_list = "path.to.module.and.function"