diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 383be9c2..9f124c52 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -6,11 +6,25 @@ name: pre-commit on: pull_request: + push: + branches: [main] jobs: pre-commit: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 + defaults: + run: + shell: bash -el {0} steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - - uses: pre-commit/action@v3.0.0 + - uses: conda-incubator/setup-miniconda@v2 + with: + python-version: '3.11' + activate-environment: "coverage" + channel-priority: "disabled" + environment-file: environments/pre-commit.yml + - uses: actions/cache@v3 + with: + path: ~/.cache/pre-commit + key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + - run: pre-commit run --show-diff-on-failure --color=always --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa804cfb..b56ed13e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,3 +58,17 @@ repos: rev: 6.0.0 hooks: - id: flake8 +- repo: local + hooks: + - id: pylint + name: pylint + entry: pylint + files: ^dpbench/benchmarks + language: system + types: [python] + require_serial: true + args: + [ + "-rn", # Only display messages + "-sn", # Don't display the score + ] diff --git a/environments/conda-linux-sycl.yml b/environments/conda-linux-sycl.yml index 9d044b67..5c6c5c6f 100644 --- a/environments/conda-linux-sycl.yml +++ b/environments/conda-linux-sycl.yml @@ -37,3 +37,4 @@ dependencies: - libgcc-ng - libstdcxx-ng - libgomp + - pylint diff --git a/environments/conda-win-sycl.yml b/environments/conda-win-sycl.yml index df5460fa..adfeedef 100644 --- a/environments/conda-win-sycl.yml +++ b/environments/conda-win-sycl.yml @@ -38,3 +38,4 @@ dependencies: # https://github.com/scikit-build/scikit-build/issues/981 - setuptools>=42,<64 - pybind11 + - pylint diff --git a/environments/conda.yml b/environments/conda.yml index 52be1fce..edc15d49 100644 --- a/environments/conda.yml +++ b/environments/conda.yml @@ -25,3 +25,4 @@ dependencies: - dpnp - numba-dpex - numba-mlir + - pylint diff --git a/environments/pre-commit.yml b/environments/pre-commit.yml new file mode 100644 index 00000000..afd96e22 --- /dev/null +++ b/environments/pre-commit.yml @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: 2022 - 2023 Intel Corporation +# +# SPDX-License-Identifier: Apache-2.0 + +name: dev +channels: + - dppy/label/dev + - intel + - conda-forge + - nodefaults +dependencies: + - pylint + - pre-commit diff --git a/pyproject.toml b/pyproject.toml index cfc33785..787418a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,3 +72,9 @@ VCS = "git" style = "pep440" versionfile_source = "dpbench/_version.py" parentdir_prefix = "" + +[tool.pylint] +disable = [ + "fixme", + "duplicate-code" +]