ST013: HasEditorConfig

Overview

Property Value
ID ST013
Name HasEditorConfig
Group structure
Severity NOTE

Description

Checks that an .editorconfig file exists in the package root directory.

An .editorconfig file helps maintain consistent coding styles across different editors and IDEs by defining settings such as:

  • Indentation style (spaces vs tabs)
  • Indentation size
  • Character encoding
  • Line ending style
  • Trailing whitespace handling

What it checks

The check looks for an .editorconfig file in the package root directory.

How to fix

Create an .editorconfig file in your package root:

# EditorConfig helps maintain consistent coding styles
# https://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.py]
indent_size = 4
max_line_length = 100

[*.{yml,yaml}]
indent_size = 2

[*.{json,toml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

Auto-fix

This check supports auto-fix. Run:

pycmdcheck fix --only ST013

This creates a template .editorconfig with Python defaults that you can customize.

Configuration

Skip this check

[tool.pycmdcheck]
skip = ["ST013"]

CLI

pycmdcheck --skip ST013