黑色在预提交中运行会产生与直接运行不同的结果

时间:2019-06-26 20:48:35

标签: python-3.x pre-commit

我跑步时

pre-commit run --file /path/to/file

black步骤将基于一组规则来格式化文件。当我运行

black /path/to/file

使用其他规则设置文件格式。

我的仓库中没有toml.flake8文件。用于配置black使用的规则的其他方法是什么,特别是在由pre-commit运行时?

这些是我的.pre-commit-config.yaml文件的内容:

---
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    sha: 'master'
    hooks:
      - id: check-added-large-files
      - id: check-byte-order-marker
      - id: check-builtin-literals
      - id: check-case-conflict
      - id: check-docstring-first
      - id: check-executables-have-shebangs
      - id: check-json
      - id: pretty-format-json
      - id: check-merge-conflict
      - id: check-xml
      - id: check-yaml
      - id: debug-statements
      - id: end-of-file-fixer
        exclude: '^.bumpversion.cfg$'
      - id: fix-encoding-pragma
      - id: flake8
      - id: mixed-line-ending
      - id: trailing-whitespace

  - repo: https://github.com/ambv/black
    sha: 'master'
    hooks:
      - id: black
        language_version: python3

0 个答案:

没有答案