如何阻止Ruff将函数参数格式化为多行及解决配置冲突警告
关于Ruff格式化的两个问题
1. 阻止Ruff拆分函数参数换行
我定义了如下函数:
def get_foo(a: object, b: tuple, c: int,) -> dict: .....
执行命令 ruff format myfile.py 后,函数被修改为多行参数格式:
def get_foo( a: object, b: tuple, c: int, ) -> dict: ....
如何阻止这种自动拆分的行为?
2. 解决配置冲突警告
按照相关方案设置后,执行 ruff format test.py 时收到以下警告:
$ ruff format test.py warning: The isort option `isort.split-on-trailing-comma` is incompatible with the formatter `format.skip-magic-trailing-comma=true` option. To avoid unexpected behavior, we recommend either setting `isort.split-on-trailing-comma=false` or `format.skip-magic-trailing-comma=false`. 1 file reformatted
我找不到 isort.split-on-trailing-comma 这个配置项来将其设为false,该如何解决这个冲突?
内容的提问来源于stack exchange,提问作者Sun Bear
相关产品推荐
相关产品推荐

