设置遵守旧代码基线的wemakepythonstyleguide GitHub操作

2024-06-12 10:42:54 发布

您现在位置:Python中文网/ 问答频道 /正文

问题

我想设置一个GitHub操作,在每次推送到repo时运行^{},但要尊重遗留代码^{}基线

根据wemake python styleguide网站, "flakehell is officially supported by wemake-python-styleguide and developed by the same people"

我的问题是:到目前为止我尝试过的所有GitHub操作工作流文件(.yml)规范都不起作用

设置

首先,我通过flakehell > .flakehellbaseline在本地设置一个flakehellbaseline,并将

[tool.flakehell]
baseline = ".flakehell_baseline"

在我的pyproject.toml中。把一切都推到回购协议上

Github操作工作流规范

1.)尝试

然后,我根据他们的premade Github Action创建了一个新的GitHub操作工作流文件(wemakepython.yml

name: wemakepython

on: push

jobs:
  wemake:
      runs-on: ubuntu-18.04
      steps:
        - name: wemake-python-styleguide
          uses: wemake-services/wemake-python-styleguide@0.14.0

结果:

enter image description here

动作被触发,并顺利完成但是,它没有报告任何flake8flakehell lint违规行为,尽管存在大量违规行为。我怎么知道?如果我在本地运行flakehell lintflake8 .,就会出现大量违规行为

2.)尝试

如果wemake-python-styleguidepremade GitHub操作不起作用,我将自己指定一个flakehell.ymlGitHub操作

name: flakehell

on: push

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - name: flakehell-linter
        run: |
          pip install flakehell
          flakehell lint

结果:

不幸的是,这个也不行。该操作甚至没有运行,它将退出,错误代码为1

@github-actions
github-actions
/ build

.github#L1
Process completed with exit code 1.

有什么办法解决这个问题吗?这可能是setup.cfgpyproject.toml定义的问题吗


Tags: 文件namegithub规范byonymlpyproject