conformance test for editorconfig
editorconfig-ctest checks all files in the current working directory on conformance of the editorconfig. It is designed to be used in test suites and integrated into CI workflows. It exits with 0 if all files are conform, and with 1 if one or more files don’t conform.
This tool is inspired by editorconfig-checker and eclint, but written in a single Python file. This has several advantages when it comes to distributing this tool, which is the main reason why I started this project. editorconfig-ctest only depends on the editorconfig-python-core, and uses Meson for installation and testing integration (optional).
To ensure that everything is working as expected and no regressions will be made, I’m working on a fully featured test suite, meaning that every feature will be tested in both a normal test, and a test that is designed to fail if possible.
Currently the following editorconfig properties are supported:
end_of_line
trim_trailing_whitespace
insert_final_newline
tab_width
(used for max_line_length
and indent_size
)max_line_length
Planned but not fully supported yet:
charset
, currently only utf-8
worksindent_style
, partially supported, tab
can theoretically fail or give false positives (fix requires block_comment
), it should work in most cases thoughindent_size
block_comment
, block_comment_start
and block_comment_end
quote_type
Currently implemeted:
Planned but not implemented yet:
Make sure to install the editorconfig-python-core. To install it on your system, you can do so using Meson:
meson builddir
meson install -C builddir
Note that it is also possible to use editorconfig-ctest by just running the file, an installation is not necessary.
SYNOPSIS
editorconfig-ctest [-d DIR] [-f FILE] [--exit-zero] [--verbose]
OPTIONS
-h, --help
show this help message and exit
-d DIR, --dir DIR
test directory
-f FILE, --file FILE
test file
--exit-zero
always exit with status code zero
--verbose
show verbose output
--version
show program's version number and exit
BEHAVIOUR
If no directory or file is specified the current working directory will be testd. Multiple folder and file calls are allowed, but there is no check if a file has already been tested or not. If a file is specified, it will be tested, even if it is inside an ignore file.
editorconfig-ctest is currently only developed and maintained by myself. The project is licensed under the BSD-2-Clause, the same license as the editorconfig-python-core. Feel free to help by packaging it for distros or providing PRs.