1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Python】Github Actions でpylintで exit codeでエラー

Last updated at Posted at 2024-11-09

exit code でエラーが出る

Github Actions で workflowを下記のように書いて、pylint を実行してみます。.pylintというファイルは使っています。

    - name: Analysing the code with pylint
      run: |
        sudo apt-get -y install graphviz
        poetry run pylint $(git ls-files '*.py')

下記のようなエラーが出て、Github Actionsが faillure になってしまいました。

-----------------------------------
Your code has been rated at 7.66/10

Error: Process completed with exit code 28.

対応1

実はpylint にexit-zero というオプションがあり、コマンドラインや.pylintrc で設定することができます。

.pylintrc
[MAIN]
# Always return a 0 (non-error) status code, even if lint errors are found.
# This is primarily useful in continuous integration scripts.
exit-zero=yes

下記で十分でした。

my_workflow.yaml
    - name: Analysing the code with pylint
      run: |
        sudo apt-get -y install graphviz
        poetry run pylint $(git ls-files '*.py')  --exit-zero

対応2(過去のもの)

検索て同じ問題で悩んでいる方がいらっしゃいましたが、私は下記で通すことにしました。

my_workflow.yaml
    - name: Analysing the code with pylint
      run: |
        sudo apt-get -y install graphviz
        poetry run pylint $(git ls-files '*.py')  || true

まとめ

とりあえずGithub Actions で Status failure から Status success になれて良かったです。
(2024/11/9)

追記

  • exit-zero を追記(2024/11/10)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?