# EditorConfig — https://editorconfig.org
#
# Encodes the formatting conventions this repository already follows, so an editor
# agrees with `ruff format` before the pre-commit hook or CI ever runs.
#
# The Python sections follow the official Python style guides:
#   PEP 8    — style guide for Python code      https://peps.python.org/pep-0008/
#   PEP 257  — docstring conventions            https://peps.python.org/pep-0257/
#   PEP 3120 — UTF-8 as default source encoding https://peps.python.org/pep-3120/

root = true

# --- Defaults for every file -------------------------------------------------
# 4-space indent is the repo-wide default because Python and TOML dominate the
# tree. Formats that nest differently override indent_size below.
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

# --- Python (PEP 8) ----------------------------------------------------------
# "Indentation": 4 spaces per indentation level.
# "Tabs or Spaces?": spaces are preferred, and Python 3 rejects mixed tabs and
#   spaces outright — so indent_style is never `tab` here.
# PEP 3120: source is UTF-8 by default; no encoding cookie needed.
# "Maximum Line Length": PEP 8's baseline is 79 columns but explicitly allows a
#   team to agree on a wider limit. This project uses 100 — keep this value in
#   sync with [tool.ruff] line-length in pyproject.toml.
# PEP 8 / PEP 257 also ask that docstrings and block comments wrap nearer 72
#   columns. EditorConfig has no setting for that; it stays a review convention.
# "Other Recommendations": avoid trailing whitespace; end files with a newline.
# indent_size governs Python code only. Embedded SQL, YAML, and docstring prose
# inside string literals keep their own nesting; `ruff format` is authoritative.
[*.{py,pyi}]
indent_style = space
indent_size = 4
max_line_length = 100

# --- Tree-sitter queries -----------------------------------------------------
# The S-expression queries in src/synapse/queries/<lang>/*.scm nest two spaces
# per level, per Scheme/tree-sitter convention.
[*.scm]
indent_size = 2

# --- Data and config formats -------------------------------------------------
# YAML forbids tabs outright; .github/workflows and .pre-commit-config.yaml use
# two spaces per level. JSON and the hand-maintained brand SVGs match that.
# TOML (pyproject.toml, uv.lock) uses the 4-space default — no override needed.
[*.{yml,yaml}]
indent_size = 2

[*.json]
indent_size = 2

[*.svg]
indent_size = 2

# --- Markdown ----------------------------------------------------------------
# Two trailing spaces are a Markdown hard line break, so trailing whitespace
# must survive here. Prose is not wrapped at a fixed column. Indentation is left
# unset because Markdown is width-sensitive rather than step-sensitive: bullets
# continue at 2 spaces but ordered lists continue at 3, under the "1. " marker.
[*.md]
indent_size = unset
trim_trailing_whitespace = false
max_line_length = off

# --- Generated and plain-text files ------------------------------------------
# uv.lock is generated by `uv`; no editor should ever reformat it.
[uv.lock]
indent_size = unset
trim_trailing_whitespace = unset

# Plain text with no indentation rules of its own.
[{LICENSE,.gitignore}]
indent_size = unset
max_line_length = off
