Defaults

If you don’t configure your own style, those are some of the defaults that will be applied.

All TOML configs below are taken from the default style file.

Absent files

Content of styles/absent-files.toml:

[nitpick.files.absent]
"requirements.txt" = "Install poetry, run 'poetry init' to create pyproject.toml, and move dependencies to it"
".isort.cfg" = "Move values to setup.cfg, section [isort]"
"Pipfile" = "Use pyproject.toml instead"
"Pipfile.lock" = "Use pyproject.toml instead"
".venv" = ""
".pyup.yml" = "Configure .travis.yml with safety instead: https://github.com/pyupio/safety#using-safety-with-a-ci-service"

black

Content of styles/black.toml:

["pyproject.toml".tool.black]
line-length = 120

[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://github.com/python/black
    rev: 20.8b1
    hooks:
      - id: black
        args: [--safe, --quiet]
  - repo: https://github.com/asottile/blacken-docs
    rev: v1.8.0
    hooks:
      - id: blacken-docs
        additional_dependencies: [black==20.8b1]
"""
# TODO The toml library has issues loading arrays with multiline strings:
#  https://github.com/uiri/toml/issues/123
#  https://github.com/uiri/toml/issues/230
#  If they are fixed one day, remove this 'yaml' key and use only a 'repos' list with a single element:
#[".pre-commit-config.yaml"]
#repos = ["""
#<YAML goes here>
#"""]

flake8

Content of styles/flake8.toml:

["setup.cfg".flake8]
# http://www.pydocstyle.org/en/2.1.1/error_codes.html
# Ignoring W503: https://github.com/python/black#line-breaks--binary-operators
# Ignoring "D202 No blank lines allowed after function docstring": black inserts a blank line.
ignore = "D107,D202,D203,D401,E203,E402,E501,W503"
max-line-length = 120
inline-quotes = "double"
exclude = ".tox,build"

# Nitpick recommends those plugins as part of the style, but doesn't install them automatically as before.
# This way, the developer has the choice of overriding this style, instead of having lots of plugins installed
# without being asked.
[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://gitlab.com/pycqa/flake8
    rev: 3.8.4
    hooks:
      - id: flake8
        additional_dependencies: [flake8-blind-except, flake8-bugbear, flake8-comprehensions,
          flake8-debugger, flake8-docstrings, flake8-isort, flake8-polyfill,
          flake8-pytest, flake8-quotes, yesqa]
"""
# TODO suggest nitpick for external repos

IPython

Content of styles/ipython.toml:

["pyproject.toml".tool.poetry.dev-dependencies]
ipython = "*"
ipdb = "*"

isort

Content of styles/isort.toml:

["setup.cfg".isort]
line_length = 120
skip = ".tox,build"
known_first_party = "tests"

# The configuration below is needed for compatibility with black.
# https://github.com/python/black#how-black-wraps-lines
# https://github.com/PyCQA/isort#multi-line-output-modes
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
combine_as_imports = true

[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://github.com/asottile/seed-isort-config
    rev: v2.2.0
    hooks:
      - id: seed-isort-config
  - repo: https://github.com/pre-commit/mirrors-isort
    rev: v5.6.4
    hooks:
      - id: isort
"""

mypy

Content of styles/mypy.toml:

# https://mypy.readthedocs.io/en/latest/config_file.html
["setup.cfg".mypy]
ignore_missing_imports = true

# Do not follow imports (except for ones found in typeshed)
follow_imports = "skip"

# Treat Optional per PEP 484
strict_optional = true

# Ensure all execution paths are returning
warn_no_return = true

# Lint-style cleanliness for typing
warn_redundant_casts = true
warn_unused_ignores = true

[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v0.790
    hooks:
      - id: mypy
"""

package.json

Content of styles/package-json.toml:

["package.json"]
contains_keys = ["name", "version", "repository.type", "repository.url", "release.plugins"]

["package.json".contains_json]
commitlint = """
  {
    "extends": [
      "@commitlint/config-conventional"
    ]
  }
"""

Poetry

Content of styles/poetry.toml:

[nitpick.files.present]
"pyproject.toml" = "Install poetry and run 'poetry init' to create it"

Bash

Content of styles/pre-commit/bash.toml:

[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://github.com/openstack/bashate
    rev: 2.0.0
    hooks:
      - id: bashate
"""

commitlint

Content of styles/pre-commit/commitlint.toml:

[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
    rev: v3.0.0
    hooks:
      - id: commitlint
        stages: [commit-msg]
        additional_dependencies: ['@commitlint/config-conventional']
"""

pre-commit (hooks)

Content of styles/pre-commit/general.toml:

[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.3.0
    hooks:
      - id: debug-statements
      - id: end-of-file-fixer
      - id: trailing-whitespace
  - repo: https://github.com/asottile/pyupgrade
    rev: v2.7.3
    hooks:
      - id: pyupgrade
"""

pre-commit (main)

Content of styles/pre-commit/main.toml:

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

[nitpick.files.present]
".pre-commit-config.yaml" = "Create the file with the contents below, then run 'pre-commit install'"

pre-commit (Python hooks)

Content of styles/pre-commit/python.toml:

[[".pre-commit-config.yaml".repos]]
yaml = """
  - repo: https://github.com/pre-commit/pygrep-hooks
    rev: v1.7.0
    hooks:
      - id: python-check-blanket-noqa
      - id: python-check-mock-methods
      - id: python-no-eval
      - id: python-no-log-warn
      - id: rst-backticks
"""

Pylint

Content of styles/pylint.toml:

["pyproject.toml".tool.poetry.dev-dependencies]
pylint = "*"

Python 3.5

Content of styles/python35.toml:

["pyproject.toml".tool.poetry.dependencies]
python = "^3.5"

Python 3.6

Content of styles/python36.toml:

["pyproject.toml".tool.poetry.dependencies]
python = "^3.6"

Python 3.7

Content of styles/python37.toml:

["pyproject.toml".tool.poetry.dependencies]
python = "^3.7"

Python 3.8

Content of styles/python38.toml:

["pyproject.toml".tool.poetry.dependencies]
python = "^3.8"