【问题标题】:Unable to exclude directory with yapf无法使用 yapf 排除目录
【发布时间】:2018-10-06 12:19:02
【问题描述】:

我无法使用 yapf 自动格式化目录。

经过测试的用法:

yapf --in-place --recursive --parallel --exclude 'somedir' --exclude '*_pb2.py' .
yapf --in-place --recursive --parallel --exclude 'somedir/*' --exclude '*_pb2.py' .
yapf --in-place --recursive --parallel --exclude 'somedir/**' --exclude '*_pb2.py' .

似乎可以很好地采用文件模式,但不能很好地采用文件夹模式。

  • yapf 版本:0.21.0
  • 操作系统:Ubuntu 14.04 LTS
  • python 版本:2.7(在 virtualenv 中)

【问题讨论】:

    标签: python ubuntu-14.04 yapf


    【解决方案1】:

    你试过yapf --in-place --recursive --parallel --exclude 'somedir/**/*.py' --exclude '**/*_pb2.py' .吗?

    yapf uses fnmatch.fnmatch(path, exclude_pattern) under the hood.

    【讨论】:

      猜你喜欢
      • 2010-09-26
      • 2011-07-17
      • 2012-06-27
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 2021-02-10
      • 2013-11-19
      • 2014-01-17
      相关资源
      最近更新 更多