From 6cd5e771d4ec27ca49d5444d851d81e87081757b Mon Sep 17 00:00:00 2001 From: evgeniygerasimov Date: Tue, 11 Mar 2025 07:47:42 +0300 Subject: [PATCH 1/2] add custom linters to pipeline --- .github/workflows/pylint.yml | 24 ++++++++++++++++++++++++ metrics/getset.py | 5 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pylint.yml diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 00000000..d73cf704 --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: Copyright (c) 2021-2025 Yegor Bugayenko +# SPDX-License-Identifier: MIT +--- +# yamllint disable rule:line-length,shellcheck +name: custom-pylint +"on": + push: + branches: + - master + pull_request: + branches: + - master +jobs: + custom-lint: + timeout-minutes: 15 + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11 + - run: | + pip install pylint + pylint --load-plugins=custom_checkers -d all -e C0411 . diff --git a/metrics/getset.py b/metrics/getset.py index a45b1d4c..8501170c 100755 --- a/metrics/getset.py +++ b/metrics/getset.py @@ -5,6 +5,7 @@ # This metric counts the number of getter and setter methods in a class. import sys +from typing import Final from javalang import tree, parse sys.setrecursionlimit(10000) @@ -29,8 +30,8 @@ def analyze_method(method: tree.MethodDeclaration) -> str | None: if __name__ == '__main__': - java = sys.argv[1] - metrics = sys.argv[2] + java: Final[str] = sys.argv[1] + metrics: Final[str] = sys.argv[2] getter_count = 0 setter_count = 0 From dad4af7185fa1bec2d68faef98c1fbcaa4059e17 Mon Sep 17 00:00:00 2001 From: evgeniygerasimov Date: Tue, 11 Mar 2025 11:19:56 +0300 Subject: [PATCH 2/2] fix naming --- .github/workflows/pylint.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index d73cf704..37596421 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -1,8 +1,6 @@ # SPDX-FileCopyrightText: Copyright (c) 2021-2025 Yegor Bugayenko # SPDX-License-Identifier: MIT ---- -# yamllint disable rule:line-length,shellcheck -name: custom-pylint +name: pylint "on": push: branches: @@ -11,7 +9,7 @@ name: custom-pylint branches: - master jobs: - custom-lint: + pylint: timeout-minutes: 15 runs-on: ubuntu-24.04 steps: