From 0a8a829048ef1f48156f02c323b81564e963aadc Mon Sep 17 00:00:00 2001 From: virashu Date: Thu, 25 Jul 2024 18:15:45 +0300 Subject: [PATCH] Update workflows --- .github/workflows/linting.yml | 75 +++++++++++++++++++++++++++++++++++ .github/workflows/pylint.yml | 30 -------------- .github/workflows/pyright.yml | 22 ---------- pyproject.toml | 8 ++++ 4 files changed, 83 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/linting.yml delete mode 100644 .github/workflows/pylint.yml delete mode 100644 .github/workflows/pyright.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..7399b9c --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,75 @@ +name: Linting + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + pip install -r requirements.txt + + black: + steps: + - name: Install black + run: | + pip install black + + - name: Format the code with black + run: | + black $(git ls-files '*.py') + + pyright: + steps: + - name: Install pyright + run: | + pip install basedpyright + + - name: Analyze the code with pyright + run: | + basedpyright $(git ls-files '*.py') --outputjson | jq '.summary.errorCount' > pyright_errors.txt + + pylint: + steps: + - name: Install pylint + run: | + pip install pylint + - name: Analyze the code with pylint + run: | + pylint -f json2 $(git ls-files '*.py') | jq '.statistics.score' > pylint_score.txt + + # - name: Archive artifacts + # uses: actions/upload-artifact@v4 + # with: + # name: Upload pylint.json + # path: | + # pylint.json + finally: + steps: + - name: Combine results + run: | + echo "{ \"pyright_errors\": $(cat pyright_errors.txt), \"pylint_score\": $(cat pylint_score.txt) }" > lint.json + + - name: Release nightly + uses: softprops/action-gh-release@v1 + with: + prerelease: true + name: nightly + tag_name: nightly + files: lint.json + fail_on_unmatched_files: true diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml deleted file mode 100644 index cf04d2a..0000000 --- a/.github/workflows/pylint.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Pylint - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pylint - pip install -r requirements.txt - - name: Analyzing the code with pylint - run: | - pylint -f json2 $(git ls-files '*.py') | jq '.statistics.score' > pylint.json - - name: Archive artifacts - uses: actions/upload-artifact@v4 - with: - name: Upload pylint.json - path: | - pylint.json diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml deleted file mode 100644 index 64f0a88..0000000 --- a/.github/workflows/pyright.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Pyright - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.12"] - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Run pyright - uses: jakebailey/pyright-action@v2.3.1 diff --git a/pyproject.toml b/pyproject.toml index 6ca18f6..8edf16d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,3 +23,11 @@ build-backend = "poetry.core.masonry.api" [tool.pylint] disable = ["missing-module-docstring", "missing-class-docstring", "missing-function-docstring"] + +[tool.pyright] +typeCheckingMode = "strict" +analyzeUnannotatedFunctions = true +reportImplicitOverride = true +reportDeprecated = true +reportAny = false +