Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add ability to use as stand-alone pre-commit hook #18

Merged
merged 9 commits into from
Jun 3, 2023
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
jsh9 marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -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]
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,23 @@ flake8 --select=DOC <FILE_OR_FOLDER>
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: <latest_tag>
hooks:
- id: pydoclint
jsh9 marked this conversation as resolved.
Show resolved Hide resolved
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:
Expand All @@ -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:

Expand All @@ -89,7 +105,7 @@ see [Section 4](#4-configuration-options) below.
flake8 --check-arg-order=False <FILE_OR_FOLDER_PATH>
```

#### 2.4.2. Setting options in a configuration file
#### 2.5.2. Setting options in a configuration file

- Native:

Expand Down