A Pre-commit hook for 'one sentence per line' documentation practices.
Project description
onesentence
A Pre-commit hook for checking 'one sentence per line' documentation practices.
One sentence per line is a practice where developers use only one line per sentence.
This can make it easier to review or provide comments on in version control systems like git.
That said, it can sometimes be difficult to remember or "debug" this style preference.
We provide this linting tool to assist with finding and fixing areas of content where the style preference is one sentence per line.
Installation
Install onesentence from PyPI or from source.
Also reference the pre-commit hook instructions for use through pre-commit.
# install from pypi
pip install onesentence
# install directly from source
pip install git+https://github.com/CU-DBMI/onesentence.git
Usage
The onesentence tool provides a command-line interface for checking and fixing files to ensure they follow the "one sentence per line" rule.
Commands
onesentence check <file_path> [<file_path> ...]
This command checks whether each given file adheres to the "one sentence per line" rule. One or more files may be passed (for example, the filenames pre-commit hands to a hook). It returns a non-zero exit code if any file has a violation.
onesentence fix <file_path> [<file_path> ...] [--output <path>]
This command corrects each given file by splitting lines with multiple sentences onto separate lines.
By default every file is corrected in place, so processing many files never lets one file overwrite another.
Pass --output <path> to write a single corrected file to a separate destination; this is only valid with exactly one input file.
It returns a non-zero exit code if any file required changes.
Pre-commit hook
Install this pre-commit hook into your project with a block like the following:
repos:
- repo: https://github.com/CU-DBMI/onesentence
rev: v0.1.1
hooks:
# run checks
- id: check
# run checks and fixes where possible
- id: fix
Using onesentence with a Markdown formatter
If you also run a Markdown formatter such as
mdformat, configure it to
preserve existing line breaks so it does not undo the one-sentence-per-line
splitting.
For mdformat this means using --wrap=keep (the default), and notably not
--wrap=no or a fixed wrap width, either of which would rejoin sentences onto a
single line.
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.22
hooks:
- id: mdformat
args: ["--wrap=keep"]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file onesentence-0.1.3.tar.gz.
File metadata
- Download URL: onesentence-0.1.3.tar.gz
- Upload date:
- Size: 52.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
870c25069c40aa58a9d2397a7906ae6b2dcd6e2e07c5d1513e2e9bb44e45e549
|
|
| MD5 |
de0b0c38b7d871cd76d5ef8639452e0d
|
|
| BLAKE2b-256 |
dbd8364beaceb35ebe6f8002a9e35605ed0aef84786b04cf0d42d2f4b7359dff
|
Provenance
The following attestation bundles were made for onesentence-0.1.3.tar.gz:
Publisher:
publish-pypi.yml on CU-DBMI/onesentence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onesentence-0.1.3.tar.gz -
Subject digest:
870c25069c40aa58a9d2397a7906ae6b2dcd6e2e07c5d1513e2e9bb44e45e549 - Sigstore transparency entry: 1891485958
- Sigstore integration time:
-
Permalink:
CU-DBMI/onesentence@d58aed3a52a65219e2a2194b48e542678aed7f75 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/CU-DBMI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d58aed3a52a65219e2a2194b48e542678aed7f75 -
Trigger Event:
release
-
Statement type:
File details
Details for the file onesentence-0.1.3-py3-none-any.whl.
File metadata
- Download URL: onesentence-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3cc3130067676149f11f4f2d9ea8816acc1952bcfe5bde93d1b6b869c56be64
|
|
| MD5 |
e91e72e46e7cd1f84f19f06abd7680e8
|
|
| BLAKE2b-256 |
680fd681cd49f36942429818ab4c6f078b79613e7a9e6b9b75813a6fed786244
|
Provenance
The following attestation bundles were made for onesentence-0.1.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on CU-DBMI/onesentence
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
onesentence-0.1.3-py3-none-any.whl -
Subject digest:
a3cc3130067676149f11f4f2d9ea8816acc1952bcfe5bde93d1b6b869c56be64 - Sigstore transparency entry: 1891486115
- Sigstore integration time:
-
Permalink:
CU-DBMI/onesentence@d58aed3a52a65219e2a2194b48e542678aed7f75 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/CU-DBMI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d58aed3a52a65219e2a2194b48e542678aed7f75 -
Trigger Event:
release
-
Statement type: