A minimalistic bibtex linter
Project description
bibL
bibL is a minimalistic linter (style checker) for BibTeX files. bibL does not come with its own BibTeX parser, but leverages the pybtex parser.
Installation
pip install bibl
Usage
Run bibl on your BibTeX files with the following command
bibl lint bibliography1.bib bibliography2.bib ...
or as a python module with
python -m bibl lint bibliography1.bib bibliography2.bib ...
bibl will check these files for a variety of style issues and deviations from the BibTeX spec (http://www.bibtex.org/Format/, https://en.wikipedia.org/wiki/BibTeX). Each possible type of issue is formulated as a rule. Each rule is identified by a unique code. Some examples of rules are
Rule ID | Rule description |
---|---|
D00 |
Entry not in alphabetical order by ke |
T00 |
Non-ascii character |
E00 |
Keys of published works should have format AuthorYEARa |
E06 |
Incorrect doi format |
T01 |
Non-standard whitespace at beginning of line (indents should be 4 spaces) |
M01ArticleYear |
Missing required field year for entry type article |
... | ... |
This link provides a list of all available rules
The first character of a rule id refers to a rules category, e.g. E
for issues with entry values, T
for textual
issues with the .bib
file, etc.
You can specify which rules to check by using --select
or --ignore
. Wildcards are allowed. --select
will only
enable the specified rules, disabling all other rules, while --ignore
will disable all rules except the ones specified.
--select
and --ignore
may not be specified simultaneously.
bibl --select "D*,E06,T01" lint bibliography.lint
will only check all rules starting with D, rule E06 and rule T01
bibl --ignore "D*,E06,T01" lint bibliography.lint
will check all rules except all rules starting with D, rule E06 and rule T01
Configuration
Aside from --select
and --ignore
, other configuration options can be provided via the cli, like --max-line-length
to specify the line length for which an issue should be reported if exceeded. See below for a full list.
Configuration can also be specified in a yaml format configuration file, provided by the --config
option.
If no configuration file is provided and a .bibl.yml
file is present in the current working directory, this file will
be used as a configuration file.
Command line option configuration will override configuration provided by a file.
See the default configuration .bibl.yml for all values that can be overwritten in a configuration file.
Some rules, like the various M01*
, M02*
and U01*
rules, are procedurally generated based on the type_spec
setting.
This setting specifies which entry and field types should be present and can be modified to more easily ignore generated
rules for specific entry types or fields, or to add custom fields or entry types for which warnings should be given
while linting.
CLI
Usage: bibl [OPTIONS] COMMAND [ARGS]...
Options:
-c, --config TEXT Custom configuration file path.
--select TEXT Comma separated list of enabled rules, all other
rules will be disabled.
--ignore TEXT Comma separated list of disabled rules, all other
rules will be enabled.
--indent-spaces INTEGER Number of trailing whitespaces for indented line,
used by TO1.
--max-line-length INTEGER Max line length before wrap recommended, used by
T03.
--abbreviation-dot Abbreviate middle names with dot.
--help Show this message and exit.
Commands:
lint Lint a BibTeX bibliography file.
list-all Show all available rules.
list-enabled Show all rules enabled by the configuration.
version Show the package version.
Usage: bibl lint [OPTIONS] [BIBLIOGRAPHY]...
Lint a BibTeX bibliography file.
Options:
--help Show this message and exit.
Usage: bibl list-all [OPTIONS]
Show all available rules.
Options:
-m Format rules as markdown table.
--help Show this message and exit.
Usage: bibl list-enabled [OPTIONS]
Show all rules enabled by the configuration.
Options:
-m Format rules as markdown table.
--help Show this message and exit.
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 bibL-1.0.3.tar.gz
.
File metadata
- Download URL: bibL-1.0.3.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a53d21cc5a15cb7d7fd115a41e038432a83503885e20f159418cf5c702599add |
|
MD5 | 998446e65dba72b1367927a9c7090c18 |
|
BLAKE2b-256 | 1e361660d90897f7945ed76bf1d2f0ba0fa699ce247532c8e2dd0893a574a92a |
File details
Details for the file bibL-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: bibL-1.0.3-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3243416d1cb9d027054b25808675cd26a0f1eb7a4736e12b7028c2ce2b5a785c |
|
MD5 | fb94b3146a8b734c66f01b72d138c2d9 |
|
BLAKE2b-256 | 0699ff0b8a5c6d5131c454c89b3e0d39754cedbcbeaba4aba7f0852ab1895b10 |