diff --git a/docs/how_to_config.md b/docs/how_to_config.md index e3f330b..3a8c7e8 100644 --- a/docs/how_to_config.md +++ b/docs/how_to_config.md @@ -56,23 +56,91 @@ bit more "Pythonic" and easier to read.) This is a template for `.pre-commit-config.yaml`: + + + +
As a native toolAs a flake8 plugin
+ ```yaml - repo: https://github.com/jsh9/pydoclint rev: hooks: - id: pydoclint args: - - [--style=google, --check-return-types=False] + - --style=google + - --check-return-types=False ``` + + +```yaml +- repo: https://github.com/pycqa/flake8 + rev: + hooks: + - id: flake8 + additional_dependencies: + - pydoclint== + args: + - --style=google + - --check-return-types=False +``` + +
+ If you've already specified all the configuration options in a config file, here is how to cite them in `.pre-commit-config.yaml`: + + + +
As a native toolAs a flake8 plugin
+ ```yaml - repo: https://github.com/jsh9/pydoclint rev: hooks: - id: pydoclint args: - - "--config=pyproject.toml" + - --config=pyproject.toml +``` + + + +```yaml +- repo: https://github.com/pycqa/flake8 + rev: + hooks: + - id: flake8 + additional_dependencies: + - Flake8-pyproject>=1.2.0 + - pydoclint== + args: + - --toml-config=pyproject.toml + - --style=google + - --check-return-types=False ``` + +
+ +Here is an example accompanying `pyproject.toml` config file: + + + + +
As a native toolAs a flake8 plugin
+ +```toml +[tool.pydoclint] +check-return-types = false +style = "google" +``` + + + +```toml +[tool.flake8] +check-return-types = false +style = "google" +``` + +
diff --git a/docs/how_to_ignore.md b/docs/how_to_ignore.md index 91b4451..ca6fcd4 100644 --- a/docs/how_to_ignore.md +++ b/docs/how_to_ignore.md @@ -1,4 +1,12 @@ -# How to ignore certain violations in _flake8_ mode +# How to ignore certain violations + +## As a native tool + +Currently, pydoclint does not support ignoring certain violations as a native +tool. Please use it as a _flake8_ plugin to achieve that, or feel free to +contribute this feature. + +## As a _flake8_ plugin In _flake8_ mode (meaning that you use _pydoclint_ as a flake8 plugin), if you'd like to ignore a specific violation code (such as `DOC201` and `DOC301`) @@ -26,3 +34,17 @@ def my_function( # noqa: DOC2 All the usage is consistent with how you would use _flake8_. Please read the official _flake8_ documentation for full details: https://flake8.pycqa.org/en/latest/user/violations.html. + +### Usage with [Ruff](https://github.com/astral-sh/ruff) + +With `ruff>=0.1.3`, allowlist `DOC` codes using the +[`external` setting](https://docs.astral.sh/ruff/settings/#external): + +Put the following in your `pyproject.toml` file: + +```toml +[tool.ruff] +external = [ + "DOC", # pydoclint +] +```