diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 442973b..56d6885 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,3 +20,8 @@ repos: hooks: - id: end-of-file-fixer - id: trailing-whitespace + + - repo: https://github.com/pre-commit/pre-commit + rev: v3.2.2 + hooks: + - id: validate_manifest diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..c772a7a --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,6 @@ +- id: pydoclint + name: pydoclint + description: 'A Python docstring linter that checks arguments, returns, yields, and raises sections' + entry: pydoclint + language: python + types: [python] diff --git a/CHANGELOG.md b/CHANGELOG.md index fdea712..eb7349f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Added - A command line option `--version` to show the current version of pydoclint + - Enabled pydoclint to be used as a pre-commit hook ## [0.0.7] - 2023-06-01 diff --git a/README.md b/README.md index afdc32e..dbc11ba 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,23 @@ flake8 --select=DOC If you don't include `--select=DOC` in your command, _flake8_ will also run other built-in _flake8_ linters on your code. -### 2.3. Native vs _flake8_ +### 2.3. As a pre-commit hook + +`pydoclint` is configured for [pre-commit](https://pre-commit.com/) and can be +set up as a hook with the following `.pre-commit-config.yaml` configuration: + +```yaml +- repo: https://github.com/jsh9/pydoclint + rev: + hooks: + - id: pydoclint + args: + - "--config=pyproject.toml" +``` + +You will need to install `pre-commit` and run `pre-commit install`. + +### 2.4. Native vs _flake8_ Should I use _pydoclint_ as a native command line tool or a _flake8_ plugin? Here's comparison: @@ -70,12 +86,12 @@ Here's comparison: \*) This feature may be added in the near future -### 2.4. Configuration +### 2.5. Configuration Here is how to configure _pydoclint_. For detailed explanations of all options, see [Section 4](#4-configuration-options) below. -#### 2.4.1. Setting options inline +#### 2.5.1. Setting options inline - Native: @@ -89,7 +105,7 @@ see [Section 4](#4-configuration-options) below. flake8 --check-arg-order=False ``` -#### 2.4.2. Setting options in a configuration file +#### 2.5.2. Setting options in a configuration file - Native: