Python 黑色格式化程序-如何只扫描选定的目录
我想在jenkins共享库中实现black scanner。其思想是,当库看到pyproject.toml时,它将执行黑检查。该命令设置为黑色-检查。/。这将为所有项目设置一次,因此应尽可能通用,检查是否为所有文件设置 如何设置pyproject.toml,使其只能扫描选定的目录 我试图排除一切,只包括一个我想要的。但这是行不通的。我的正则表达式很弱Python 黑色格式化程序-如何只扫描选定的目录,python,jenkins-pipeline,Python,Jenkins Pipeline,我想在jenkins共享库中实现black scanner。其思想是,当库看到pyproject.toml时,它将执行黑检查。该命令设置为黑色-检查。/。这将为所有项目设置一次,因此应尽可能通用,检查是否为所有文件设置 如何设置pyproject.toml,使其只能扫描选定的目录 我试图排除一切,只包括一个我想要的。但这是行不通的。我的正则表达式很弱 [tool.black] exclude = ''' /( | * )/ ''' include = ''' /( | pytest/*
[tool.black]
exclude = '''
/(
| *
)/
'''
include = '''
/(
| pytest/**
)/
'''
我自己找到了答案。只是
[tool.black]
include = 'pytest\/.*\.pyi?$'
。。。或者对于多个目录
[tool.black]
include = 'pytest\/.*\.pyi?$|tests\/subdirectory\/.*\.pyi?$'