Skip to content

Commit

Permalink
ci: enable PyLint for pull-requests
Browse files Browse the repository at this point in the history
Copy-paste a pylintrc stub that we can work on in the future.
  • Loading branch information
praiskup committed Apr 5, 2023
1 parent b85dc97 commit 78029de
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/python-diff-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Lint Python issues

on:
push:
pull_request:
branches: [main]

jobs:
python-lint-job:
runs-on: ubuntu-latest

permissions:
# required for all workflows
security-events: write

steps:
- name: Repository checkout
uses: actions/checkout@v3

- id: VCS_Diff_Lint
name: VCS Diff Lint
uses: fedora-copr/vcs-diff-lint-action@v1

- name: Upload artifact with detected defects in SARIF format
uses: actions/upload-artifact@v3
with:
name: VCS Diff Lint SARIF
path: ${{ steps.VCS_Diff_Lint.outputs.sarif }}
if: ${{ always() }}

- name: Upload SARIF to GitHub using github/codeql-action/upload-sarif
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.VCS_Diff_Lint.outputs.sarif }}
if: ${{ always() }}
22 changes: 22 additions & 0 deletions pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[MASTER]
# Pickle collected data for later comparisons.
persistent=no

init-hook=
import os
import sys
import subprocess
gitrootdir = subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode("utf-8").strip()
sys.path.insert(0, os.path.join(gitrootdir))

[MESSAGES CONTROL]
# Reasoning for wide warning ignore
# ---------------------------------
# import-error
# This is to work-around the issues in our diff-lint CI where we do not have
# all the build/runtime requirements installed. We can ignore this error
# because the packaging CI would actually discover the import issues anyway.
disable=import-error

[DESIGN]
min-public-methods=1

0 comments on commit 78029de

Please sign in to comment.