Tools for style checking and linting
Project description
Monostyle
With Monostyle you can lint and style check your documentation covering all parts of a style guide.
Its tools are applied on new or changed content which makes it fast and it allows a wider range of tools, because they can have false positives. For example exceptions to style guide rules that can't be filtered out. Supported for version control are SVN and Git (experimental).
Monostyle is not a ready-made tool because its tools and data require customization. For example you might not want to use Chicago style title case or you might have different technical terms that are acceptable. It includes its own RST parser and a port of the Reflow line wrapper. Its utilities can also be used for text editing with scripts. Monostyle is customized for the Blender manual.
Please refer to Tools for a listing.
Setup
Requirements: When using SVN the command line client tools need to be installed.
For spell checking a dictionary (aka lexicon) has to build. On first run you have to confirm to start this (or also if the dictionary file is not found).
The dictionary has to be updated from time to time or after a new topic has been added
to include new words (of cause the whole project has to be spell-checked at this point).
To do this run the update_lexicon
script:
python -m monostyle.update_lexicon
Running Monostyle
Monostyle has four modes:
- -i, --internal
- To check your own changes (the default).
- -e, --external
- To check changes made to the repository by others. Run this before you update your working copy with Git or SVN.
- -p, --patch
- To check changes in a patch-file. The directory from where Monostyle is run has to be same as where the patch-file was created.
- -f, --file
- To check a file or directory. Files can have a line selection at the end split with a colon and the span separated by a dash. For example `test.rst:10-25`. If the start or end are omitted the start and end of the file are used accordingly.
Options:
- -r, --root
- The root is the absolute path to the top directory of your project. If not set the directory where Monostyle is run from is used.
- --cached, --staged
- Set the diff cached option (Git only).
- --unversioned, --untracked
- Include unversioned/untracked files.
- -s, --resolve
- Resolve link titles and substitutions (recommended only for file mode because it can take a few minutes and won't include newly created ones).
Post processing:
- -u, --update
- Update the working copy.
- -a, --autofix
- Apply autofixes. This also does an update if the changes are external.
- -o, --open
- Open the reported files in a text editor. Optionally only if the report has a severity higher than specified. Please check if your editor of choice is available (else please make a I/PR to add it).
For more info on command line arguments use the --help
command.
Individual tools can be selected by executing the modules.
By default the tools will then loop over the whole project.
Running Monostyle does not replace building the project with Sphinx. Markup errors can lead to false negatives, so Monostyle has to be run again or the affected section has to be checked manually.
Advanced
You can set a commit/revision for internal, external and update (SVN only). With Git these are passed unaltered to diff. However, with SVN these can be colon separated or dash separated for the "change" syntax. When a side is omitted e.g. ":ARG" it will default to BASE (your working copy) on the left and on the right to HEAD (the latest revision in the repository). For external revisions the "change" syntax is used for single arguments "ARG".
Example Output
test.rst:
---------
1:20 ⚠️ 'static' repeated words 0 words in between
Linter is a static static code analysis tool `source <https://en.wikipedia.org/wiki/Lint_(software)
2:9 ℹ️ 'flag' CS technical term
en.wikipedia.org/wiki/Lint_(software)> `__¶used to flag programming errors, bugs, stylistic errors,
1:100 🛑 ' `__' space before body end of hyperlink
ce <https://en.wikipedia.org/wiki/Lint_(software)> `__¶used to flag programming errors, bugs, styli
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file monostyle-0.4.1.tar.gz
.
File metadata
- Download URL: monostyle-0.4.1.tar.gz
- Upload date:
- Size: 147.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a32834e8eda4142d111ab04aa82671760dd9f76348bd2351aebd73ef5c6d3f3 |
|
MD5 | deabac01902eb805a9700aa6f2d05a39 |
|
BLAKE2b-256 | dda2a3608eb89f77addc562ba367a1f5617997a58a91ff04cea02c8c597d66ea |
Provenance
File details
Details for the file monostyle-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: monostyle-0.4.1-py3-none-any.whl
- Upload date:
- Size: 158.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f0eb613dce2e2aaf8a7a9ac5927aa11f47ce058140ab485c07a5c01b25f505 |
|
MD5 | e1d88210983ee675dc6280075d4d51da |
|
BLAKE2b-256 | bb198a15130298f41742c51444302a01a344dff9be13b1ba7610a408958816cd |