项目作者: stephanlachnit

项目描述 :
conformance test for editorconfig
高级语言: Python
项目地址: git://github.com/stephanlachnit/editorconfig-ctest.git
创建时间: 2020-05-05T20:03:13Z
项目社区:https://github.com/stephanlachnit/editorconfig-ctest

开源协议:BSD 2-Clause "Simplified" License

下载


editorconfig-ctest

conformance test for editorconfig

Build Status
Language grade: Python

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.

Properties

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 works
  • indent_style, partially supported, tab can theoretically fail or give false positives (fix requires block_comment), it should work in most cases though
  • indent_size
  • block_comment, block_comment_start and block_comment_end
  • quote_type

Features

Currently implemeted:

  • Ignores files in an ingore file using regex syntax
  • Automatically ignores non-readable files
  • Man page and cmdline interface

Planned but not implemented yet:

  • Ignore files in .gitignores
  • .gitignore like ignore files
  • Github App

Installation

Make sure to install the editorconfig-python-core. To install it on your system, you can do so using Meson:

  1. meson builddir
  2. meson install -C builddir

Note that it is also possible to use editorconfig-ctest by just running the file, an installation is not necessary.

Usage

  1. SYNOPSIS
  2. editorconfig-ctest [-d DIR] [-f FILE] [--exit-zero] [--verbose]
  3. OPTIONS
  4. -h, --help
  5. show this help message and exit
  6. -d DIR, --dir DIR
  7. test directory
  8. -f FILE, --file FILE
  9. test file
  10. --exit-zero
  11. always exit with status code zero
  12. --verbose
  13. show verbose output
  14. --version
  15. show program's version number and exit
  16. BEHAVIOUR
  17. 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.

Development

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.