Skip to content

Commit b205e1d

Browse files
committed
Merge branch 'feature/mkdocforge-setup-dev-environment' into develop
2 parents e2e413e + 157a5aa commit b205e1d

File tree

10 files changed

+667
-229
lines changed

10 files changed

+667
-229
lines changed

.gitattributes

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,58 @@
1-
# Set default behavior to automatically normalize line endings
2-
* text=auto
3-
4-
# Explicitly declare files that should use LF
5-
*.sh text eol=lf
6-
Makefile text eol=lf
7-
*.mk text eol=lf
8-
9-
# Denote all files that are truly binary and should not be modified
10-
*.png binary
11-
*.jpg binary
12-
*.gif binary
13-
*.ico binary
14-
*.zip binary
15-
*.pdf binary
1+
# Default: Auto-detect text files and normalize line endings to LF
2+
* text=auto eol=lf
3+
4+
# Python source files: Enforce UTF‑8 encoding and enable Python-aware diffs
5+
*.py text diff=python encoding=utf-8
6+
*.pyi text diff=python encoding=utf-8
7+
*.pyw text diff=python encoding=utf-8
8+
9+
# Python project configuration files: Consistent UTF‑8 encoding
10+
*.toml text encoding=utf-8
11+
pyproject.toml text encoding=utf-8
12+
requirements*.txt text encoding=utf-8
13+
.pre-commit-config.yaml text encoding=utf-8
14+
15+
# Documentation, configuration, and data files: Uniform encoding and enhanced diffs for Markdown
16+
*.md text encoding=utf-8 diff=markdown
17+
*.rst text encoding=utf-8
18+
*.json text encoding=utf-8
19+
*.yaml text encoding=utf-8
20+
*.yml text encoding=utf-8
21+
*.ini text encoding=utf-8
22+
*.cfg text encoding=utf-8
23+
24+
# Explicitly declare files that should use LF line endings (scripts and makefiles)
25+
*.sh text eol=lf
26+
Makefile text eol=lf
27+
*.mk text eol=lf
28+
29+
# Jupyter Notebooks: Ensure UTF‑8 encoding for proper text processing
30+
*.ipynb text encoding=utf-8
31+
32+
# Cython source files: Enable proper diffing with enforced UTF‑8 encoding
33+
*.pyx text diff=python encoding=utf-8
34+
35+
# Scalable Vector Graphics: Enforce UTF‑8 encoding and enable XML-aware diffs
36+
*.svg text encoding=utf-8 diff=xml
37+
38+
# Additional text files: Enforce LF and UTF‑8 for plain text files
39+
*.txt text eol=lf working-tree-encoding=utf-8
40+
41+
# Binary and compiled files: Prevent alterations by marking as binary
42+
*.db binary
43+
*.p binary
44+
*.pkl binary
45+
*.pickle binary
46+
*.pyc binary
47+
*.pyd binary
48+
*.pyo binary
49+
*.png binary
50+
*.jpg binary
51+
*.gif binary
52+
*.ico binary
53+
*.zip binary
54+
*.pdf binary
55+
56+
# Exclude Git-specific files from exports
57+
.gitattributes export-ignore
58+
.gitignore export-ignore

.markdownlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# MkDocs-compatible markdownlint configuration
23

34
# Default state for all rules

.mdformat.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ plugin.black.line_length = 88
3232

3333
plugin.ruff.enable = true
3434
plugin.ruff.line_length = 88
35-
plugin.ruff.select = ["E", "F", "W"]
36-
plugin.ruff.ignore = ["ANN101"]
35+
plugin.ruff.select = [ "E", "F", "W" ]
36+
plugin.ruff.ignore = [ "ANN101" ]

.pre-commit-config.yaml

Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
%YAML 1.2
2+
---
3+
# Pre-commit Configuration
4+
# This file configures pre-commit hooks that run automatically before git commits
5+
# to ensure code quality, formatting, and prevent security issues.
6+
# https://pre-commit.com/
7+
default_install_hook_types:
8+
- pre-commit
9+
- commit-msg
10+
11+
repos:
12+
13+
#########################################
14+
# General Code Quality Checks
15+
#########################################
16+
- repo: https://github.com/pre-commit/pre-commit-hooks
17+
# Standard collection of pre-commit hooks for various checks
18+
rev: v5.0.0
19+
hooks:
20+
- id: trailing-whitespace
21+
name: "✂️ whitespace · Remove trailing whitespace"
22+
# Removes trailing whitespace at end of lines
23+
- id: check-ast
24+
name: "🔍 python · Check Python AST"
25+
# Validates Python syntax without executing code
26+
- id: end-of-file-fixer
27+
name: "📄 files · Fix end of files"
28+
# Ensures files end with a newline
29+
- id: check-yaml
30+
name: "📋 yaml · Validate YAML files"
31+
exclude: "mkdocs.yml"
32+
# Validates YAML syntax
33+
- id: check-toml
34+
name: "📋 toml · Validate TOML files"
35+
# Validates TOML syntax
36+
- id: check-json
37+
name: "📋 json · Validate JSON files"
38+
# Validates JSON syntax
39+
- id: check-added-large-files
40+
name: "📏 files · Check for added large files"
41+
# Prevents large files from being committed
42+
- id: detect-private-key
43+
name: "🔑 security · Detect private keys"
44+
# Prevents accidental commit of private keys
45+
- id: pretty-format-json
46+
name: "📋 json · Format JSON files"
47+
# Formats JSON files for readability
48+
- id: check-merge-conflict
49+
name: "🔀 git · Check for merge conflicts"
50+
- id: forbid-new-submodules
51+
name: "🌳 git · Prevent submodule creation"
52+
53+
- id: no-commit-to-branch
54+
name: "🌳 git · Protect main branches"
55+
args: ["--branch", "main", "--branch", "master"]
56+
# Prevents direct commits to protected branches
57+
# Detects unresolved merge conflicts
58+
- id: check-executables-have-shebangs
59+
name: "📜 files · Check executables have shebangs"
60+
# Ensures executable files have proper shebangs
61+
- id: check-shebang-scripts-are-executable
62+
name: "📜 files · Check shebang scripts are executable"
63+
# Makes sure files with shebangs are executable
64+
- id: pretty-format-json
65+
name: "📋 json · Format JSON files"
66+
args: [--autofix, --no-sort-keys] # Fix formatting but don't sort keys
67+
- id: name-tests-test
68+
name: "🧪 tests · Check test file naming"
69+
args: [--pytest-test-first] # Enforces pytest naming conventions
70+
- id: mixed-line-ending
71+
name: "📄 files · Fix mixed line endings"
72+
args: ['--fix=lf'] # Standardize on LF line endings
73+
- id: check-case-conflict
74+
name: "📁 filesystem/📝 names · Check case sensitivity"
75+
- id: check-illegal-windows-names
76+
name: "📁 filesystem/📝 names · Validate Windows filenames"
77+
- id: check-symlinks
78+
name: "📁 filesystem/🔗 symlink · Check symlink validity"
79+
- id: destroyed-symlinks
80+
name: "📁 filesystem/🔗 symlink · Detect broken symlinks"
81+
82+
#########################################
83+
# Python Formatting and Linting
84+
#########################################
85+
- repo: https://github.com/astral-sh/ruff-pre-commit
86+
# Ruff is a fast Python linter and formatter written in Rust
87+
rev: v0.11.2
88+
hooks:
89+
- id: ruff
90+
name: "🐍 python · Format with Ruff"
91+
args: [--fix, --exit-non-zero-on-fix] # Automatically fix issues when possible
92+
- id: ruff-format
93+
name: "🐍 python · Format with Ruff"
94+
# Automatically formats Python code
95+
96+
97+
#########################################
98+
# Python Code Modernization
99+
#########################################
100+
- repo: https://github.com/asottile/pyupgrade
101+
# Automatically upgrades Python syntax to newer versions
102+
rev: v3.19.1
103+
hooks:
104+
- id: pyupgrade
105+
name: "🔄 python · Upgrade Python syntax"
106+
args: ["--py311-plus"] # Use Python 3.11+ specific syntax improvements
107+
# Upgrades syntax to use newer Python features
108+
109+
- repo: https://github.com/asottile/add-trailing-comma
110+
# Adds trailing commas to function calls and definitions
111+
rev: v3.1.0
112+
hooks:
113+
- id: add-trailing-comma
114+
name: "🔤 python · Add trailing commas"
115+
# Makes future diffs cleaner and multiline constructs more consistent
116+
117+
#########################################
118+
# API Documentation Validation
119+
#########################################
120+
- repo: https://github.com/python-openapi/openapi-spec-validator
121+
rev: 0.7.1
122+
hooks:
123+
- id: openapi-spec-validator
124+
name: "📝 api · Validate OpenAPI Spec"
125+
# Ensures OpenAPI specifications are valid
126+
127+
#########################################
128+
# Python Project Configuration Validation
129+
#########################################
130+
- repo: https://github.com/abravalheri/validate-pyproject
131+
# Validates pyproject.toml file format
132+
rev: v0.24.1
133+
hooks:
134+
- id: validate-pyproject
135+
name: "🐍 python · Validate pyproject.toml"
136+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
137+
# Ensures pyproject.toml follows PEP specifications
138+
139+
#########################################
140+
# Documentation Formatting
141+
#########################################
142+
- repo: https://github.com/hukkin/mdformat
143+
# Markdown formatter for consistent documents
144+
rev: 0.7.22
145+
hooks:
146+
- id: mdformat
147+
name: "📝 markdown · Format markdown"
148+
# Formats markdown files for consistency
149+
exclude: |
150+
(?x)^(
151+
.*\{\{.*\}\}.*
152+
)$
153+
entry: mdformat
154+
language: python
155+
types: [markdown]
156+
verbose: true
157+
log_file: .logs/mdformat.log
158+
fail_fast: false
159+
files: \.(md|markdown)$
160+
args:
161+
- "--wrap=no" # Wrap lines at 80 characters (customize as needed)
162+
- "--end-of-line=lf" # Use LF line endings (Unix-style, recommended for consistency)
163+
# - "--check" # Exit with error if formatting changes are needed
164+
additional_dependencies:
165+
- mdformat-gfm==0.4.1 # GitHub Flavored Markdown support
166+
- mdformat-mkdocs[recommended]==4.1.2 # MkDocs-specific formatting
167+
- mdformat-frontmatter==2.0.8 # YAML frontmatter support
168+
- mdformat-footnote==0.1.1 # Footnote support
169+
- mdformat-tables==1.0.0 # Table formatting
170+
- mdformat-toc==0.3.0 # Table of contents formatting
171+
- mdformat-beautysh==0.1.1 # Shell code block formatting
172+
- mdformat-black==0.1.1 # Python code block formatting
173+
- mdformat-gfm-alerts==1.0.1 # GitHub-style alerts
174+
- mdformat-myst==0.2.1 # MyST Markdown support
175+
- mdformat-config==0.2.1 # Configuration file parsing
176+
- mdformat-ruff==0.1.3 # Ruff linting for Python code blocks
177+
- mdformat-web==0.2.0 # Web-related Markdown formatting
178+
- mdformat-simple-breaks==0.0.1 # Consistent line break handling
179+
- ruff
180+
181+
#########################################
182+
- repo: https://github.com/DavidAnson/markdownlint-cli2
183+
rev: v0.17.2
184+
hooks:
185+
- id: markdownlint-cli2
186+
name: "📝 markdown · Lint markdown with markdownlint"
187+
args: [--fix]
188+
exclude: ^CHANGELOG
189+
# Lints markdown files for style and consistency issues
190+
191+
#########################################
192+
# YAML File Validation
193+
#########################################
194+
- repo: https://github.com/adrienverge/yamllint.git
195+
rev: v1.37.0
196+
hooks:
197+
- id: yamllint
198+
name: "📋 yaml · Lint YAML files with yamllint"
199+
args: [--strict, -c=./.yamllint.yaml]
200+
# Validates YAML files for style and syntax issues
201+
202+
#########################################
203+
# A pre-commit hook to format and lint TOML files
204+
#########################################
205+
- repo: https://github.com/ComPWA/taplo-pre-commit
206+
rev: v0.9.3
207+
hooks:
208+
- id: taplo-format
209+
name: "📋 toml · Format TOML files with taplo"
210+
# Formats TOML files for consistency
211+
- id: taplo-lint
212+
name: "📋 toml · Lint TOML files with taplo"
213+
# Validates TOML files for errors and style issues
214+
215+
#########################################
216+
# Makefile Validation
217+
#########################################
218+
- repo: https://github.com/mrtazz/checkmake.git
219+
# Makefile linter
220+
rev: 0.2.2
221+
hooks:
222+
- id: checkmake
223+
name: "🐮 Makefile · Lint Makefile"
224+
# Validates Makefile structure and conventions
225+
# No clear documentation on how to skip certain checks.
226+
# Fixed as many as I could, but best option is to ignore the file.
227+
exclude: |
228+
(?x)^(
229+
.*\{\{.*\}\}.*|
230+
)$
231+
232+
#########################################
233+
# Scanning Hardcoded Secrets
234+
#########################################
235+
- repo: https://github.com/gitleaks/gitleaks
236+
rev: v8.24.2
237+
hooks:
238+
- id: gitleaks
239+
name: "🔒 security · Scan for hardcoded secrets"
240+
# Detects and prevents secrets from being committed
241+
242+
# Set default Python version for all hooks
243+
default_language_version:
244+
python: python3.11
245+
246+
# Define which git hooks these run on (defaults to pre-commit)
247+
default_stages: [pre-commit]

.yamllint.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
extends: default
2+
3+
rules:
4+
braces:
5+
level: warning
6+
max-spaces-inside: 1
7+
brackets:
8+
level: warning
9+
max-spaces-inside: 1
10+
colons:
11+
level: warning
12+
commas:
13+
level: warning
14+
comments: disable
15+
comments-indentation: disable
16+
document-start: disable
17+
empty-lines:
18+
level: warning
19+
hyphens:
20+
level: warning
21+
indentation:
22+
level: warning
23+
indent-sequences: consistent
24+
line-length:
25+
max: 110
26+
level: warning
27+
allow-non-breakable-inline-mappings: true
28+
truthy: disable

0 commit comments

Comments
 (0)