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 matching signatures.'
s-weigand marked this conversation as resolved.
Show resolved Hide resolved
entry: pydoclint
language: python
types: [python]
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,22 @@ 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: 0.0.7
jsh9 marked this conversation as resolved.
Show resolved Hide resolved
hooks:
- id: pydoclint
jsh9 marked this conversation as resolved.
Show resolved Hide resolved
```

You will need to install `pre-commit` and run `pre-commit install`.

### 2.5. Native vs _flake8_
s-weigand marked this conversation as resolved.
Show resolved Hide resolved

Should I use _pydoclint_ as a native command line tool or a _flake8_ plugin?
Here's comparison:
Expand All @@ -70,12 +85,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 +104,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