我跑步时
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