diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..1a76151 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,35 @@ +name: Ruff Code Quality Check + +on: [ push, pull_request ] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + ruff: + name: Ruff Check + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + cache: 'pip' + + - name: Install Ruff + run: | + pip install ruff + + - name: Run Ruff check + run: | + ruff check . --output-format=github + + - name: Check code formatting + run: | + ruff format --check . --diff diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cac796c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "your-project" +version = "0.1.0" +requires-python = ">=3.8" + +[tool.ruff] +target-version = "py311" +line-length = 100 +cache-dir = ".ruff_cache" +select = ["E", "W", "F", "I", "N", "UP", "B", "C4", "SIM", "ARG"] +ignore = ["E501"] + +[tool.ruff.per-file-ignores] +"__init__.py" = ["F401"] +"tests/**/*.py" = ["S101", "SLF001"] +"**/migrations/**/*.py" = ["ALL"] + +[tool.ruff.format] +indent-style = "space" +quote-style = "double" + +[tool.pytest.ini_options] +testpaths = ["tests"] +addopts = ["-v", "--tb=short"] +python_files = ["test_*.py"] diff --git a/src/euclid.py b/src/euclid.py index 6e2e340..ef06357 100644 --- a/src/euclid.py +++ b/src/euclid.py @@ -2,10 +2,12 @@ def evkl(a, b): if a == 0: return b, 0, 1 else: - nod, x, y= evkl(b%a, a) - return nod, y-(b//a)*x, x + nod, x, y = evkl(b % a, a) + return nod, y - (b // a) * x, x + + a = int(input()) b = int(input()) nod, x, y = evkl(a, b) -print(f'НОД({a}, {b}) = {nod}') -print(f'линейная комбинация: {a}*{x} + {b}*{y} = {nod}') +print(f"НОД({a}, {b}) = {nod}") +print(f"линейная комбинация: {a}*{x} + {b}*{y} = {nod}")