# Code Quality ## Formatting and linting ### C/C++ - **Formatter:** clang-format (config in `.clang-format`) - **Static analysis:** clang-tidy (config in `.clang-tidy`) ### Python - **Formatter:** black with 100-character line length - **Linter:** pylint (config in `.pylintrc`) ## Pre-commit hooks The repository uses [pre-commit](https://pre-commit.com/) to run formatters and linters automatically on staged files: ```bash pip install pre-commit pre-commit install ``` Configured hooks (`.pre-commit-config.yaml`): - `trailing-whitespace` — remove trailing whitespace - `end-of-file-fixer` — ensure files end with a newline - `check-yaml` — validate YAML syntax - `check-added-large-files` — prevent accidental large file commits - `mixed-line-ending` — normalize line endings - `black` — Python formatting (100 char lines) - `clang-format` — C/C++ formatting ## Scope Pre-commit hooks are configured to run on specific directories: - `src/Base/`, `src/Gui/`, `src/Main/`, `src/Tools/` - `src/Mod/Assembly/`, `src/Mod/BIM/`, `src/Mod/CAM/`, `src/Mod/Draft/`, `src/Mod/Fem/`, and other stock modules - `tests/src/` Excluded: generated files, vendored libraries (`QSint/`, `Quarter/`, `3Dconnexion/navlib`), and binary formats.