小黄瓜语言格式

reformat-gherkin的Python项目详细描述


重新格式化小黄瓜

Build StatusBuild StatusCoverage Status

MaintainabilityCodacy Badge

License: MITPyPICode style: black

目录

关于

此工具是用于小黄瓜文件的格式化程序。无论项目和作者如何,它都确保了外观的一致性。

reformat-gherkin可以用作命令行工具,也可以用作pre-commit挂钩。

开始

这些说明将为您在本地计算机上启动和运行项目的副本,以便进行开发和测试。

先决条件

安装

  1. 克隆此存储库

    git clone https://github.com/ducminh-phan/reformat-gherkin.git
    
  2. 安装依赖项

    cd reformat-gherkin
    poetry install
    

用法

Usage: reformat-gherkin [OPTIONS] [SRC]...

  Reformat the given Gherkin files and all files in the given directories
  recursively.

Options:
  --check                       Don't write the files back, just return the
                                status. Return code 0 means nothing would
                                change. Return code 1 means some files would
                                be reformatted. Return code 123 means there
                                was an internal error.
  -a, --alignment [left|right]  Specify the alignment of step keywords (Given,
                                When, Then,...). If specified, all statements
                                after step keywords are left-aligned, spaces
                                are inserted before/after the keywords to
                                right/left align them. By default, step
                                keywords are left-aligned, and there is a
                                single space between the step keyword and the
                                statement.
  -n, --newline [LF|CRLF]       Specify the line separators when formatting
                                files inplace. If not specified, line
                                separators are preserved.
  --fast / --safe               If --fast given, skip the sanity checks of
                                file contents. [default: --safe]
  --config FILE                 Read configuration from FILE.
  --version                     Show the version and exit.
  --help                        Show this message and exit.

配置文件

该工具能够从.reformat-gherkin.yaml文件中读取其命令行选项的特定于项目的默认值。

默认情况下,reformat-gherkin从命令行上传递的所有文件和目录的公共基目录开始查找配置文件。如果不存在,则在父目录中查找。当它找到文件、或.git目录、或.hg目录或文件系统的根目录(以先到者为准)时,将停止查找。

配置文件示例

check:Falsealignment:left

预提交挂钩

安装了pre-commit之后,将其添加到存储库中的.pre-commit-config.yaml

repos:
  - repo: https://github.com/ducminh-phan/reformat-gherkin
    rev: stable
    hooks:
      - id: reformat-gherkin

然后运行pre-commit install就可以开始了。

致谢

这个项目的灵感来自black。有些函数取自black的源代码。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用split函数分割字符串,但没有得到期望的结果   未找到包含derby数据库嵌入架构的sql Java桌面应用程序错误   java elasticsearch vs solr用于定制全文搜索系统   java Android:创建没有startOffset的动画延迟?   java如何查看其他应用程序接收的数据?   java如何在Linux中使用D和classpath选项运行jar文件   java和域设计最佳实践   具有相同内存位置的java数组,将显示为输出   连接到java中的elasticsearch?   Java Playframework重定向到带有Json负载的外部url   java无法在Android平台上使用InputStream为蓝牙socket创建ObjectInputStream   使用POI将Excel日期转换为Java日期,年份未正确显示   oracle从数据库层还是Java层调用webservice?