Project: MongoDB (App Definition and Development / Database)
File: linting.md

The `buildscripts/clang_format.py` wrapper script runs the `clang-format` linter. You can see the usage message for the wrapper by running `buildscripts/clang_format.py --help`. Ex: `buildscripts/clang_format.py lint` | Linter | Configuration File(s) | Help Command | Documentation | | -- | | | -- | | `clang-format` | `.clang-format` | `clang-format --help` | | The `buildscripts/clang_tidy.py` shell script runs the `clang-tidy` linter. In order to run `clang-tidy` you must have a compilation database (`compile_commands.json` file). Ex: `python3 buildscripts/clang_tidy.py` | Linter | Configuration File(s) | Help Command | Documentation | | | | - | -- | | `clang-tidy` | `.clang-tidy` | `clang-tidy --help` | | The `buildscripts/errorcodes.py` script runs a custom error code linter, which verifies that all assertion codes are distinct. You can see the usage by running the following command: `buildscripts/errorcodes.py --help`. Ex: `buildscripts/errorcodes.py` The `buildscripts/quickmongolint.py` script runs a simple MongoDB C++ linter. You can see the usage by running the following command: `buildscripts/quickmongolint.py --help`. You can take a look at `buildscripts/linter/mongolint.py` to better understand the rules for this linter. Ex: `buildscripts/quickmongolint.py lint` The `buildscripts/eslint.py` wrapper script runs the `eslint` javascript linter. You can see the usage message for the wrapper by running `buildscripts/eslint.py --help`. Ex: `buildscripts/eslint.py lint` | Linter | Configuration File(s) | Help Command | Documentation | | -- | - | | | | `eslint` | `.eslintrc.yml` `.eslintignore` | `eslint --help` | | The `buildscripts/yamllinters.sh` shell script runs the yaml linters. The supported yaml linters are: `yamllint` & `evergreen-lint`. `evergreen-lint` is a custom MongoDB linter used specifically for `evergreen` yaml files. Ex: `bash buildscripts/yamllinters.sh` | Linter | Configuration File(s) | Help Command | Documentation | | - | - | | - | | `yamllint` | `etc/yamllint_config.yml` | `yamllint --help` | | | `evergreen-lint` | `etc/evergreenlint.yml` | `python -m evergreenlint --help` | | The `buildscripts/pylinters.py` wrapper script runs the Python linters. You can see the usage message for the wrapper by running the following command: `buildscripts/pylinters.py --help`. Ex: `buildscripts/pylinters.py lint` | Linter | Configuration File(s) | Help Command | Documentation | | | | - | | | `ruff` | `pyproject.toml` | `ruff --help` | | `buildscripts/pylinters.py` lints over the SCons code automatically. You can use SCons to run most of the linters listed above via their corresponding Python wrapper script. SCons also provides the ability to run multiple linters in a single command. At this time, SCons does not support `clang-tidy` or `buildscripts/yamllinters.sh` Here are some examples: | SCons Target | Linter(s) | Example | | - | -- | -- | | `lint` | `clang-format` `errorcodes.py` `quickmongolint.py` `eslint` `pylint` `mypy` `pydocstyle` `yapf` | `buildscripts/scons.py lint` | | `lint-fast` | `clang-format` `errorcodes.py` `eslint` `pylint` `mypy` `pydocstyle` `yapf` | `buildscripts/scons.py lint-fast` | | `lint-clang-format` | `clang-format` | `buildscripts/scons.py lint-clang-format` | | `lint-errorcodes` | `errorcodes.py` | `buildscripts/scons.py lint-errorcodes` | | `lint-lint.py` | `quickmongolint.py` | `buildscripts/scons.py lint-lint.py` | | `lint-eslint` | `eslint` | `buildscripts/scons.py lint-eslint` | | `lint-pylinters` | `pylint` `mypy` `pydocstyle` `yapf` | `buildscripts/scons.py lint-pylinters` | | `lint-sconslinters` | `yapf` | `buildscripts/scons.py lint-sconslinters` |