From bc4c0c2dad9c2770ebceae4e409b1fa217b5ebd6 Mon Sep 17 00:00:00 2001 From: Denis Chernykh Date: Thu, 26 Feb 2026 20:53:32 +0500 Subject: [PATCH 1/6] ci: add pre-commit linting hooks and GitHub Actions workflow --- .editorconfig | 13 +++++++------ .github/workflows/lint.yml | 25 +++++++++++++++++++++++++ .pre-commit-config.yaml | 32 ++++++++++++++++++++++++++++++++ .yamllint.yml | 32 ++++++++++++++++++++++++++++++++ ruff.toml | 13 +++++++++++++ 5 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .pre-commit-config.yaml create mode 100644 .yamllint.yml create mode 100644 ruff.toml diff --git a/.editorconfig b/.editorconfig index 007f685b..b74997ea 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,13 +1,14 @@ root = true -[{*,.*}] +[*] charset = utf-8 indent_style = space +end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true [*.sh] -end_of_line = lf +indent_size = 4 [{*.bat,*.cmd}] end_of_line = crlf @@ -18,7 +19,6 @@ end_of_line = lf [*.md] # Trailing whitespace is important in Markdown (they distinguish a new line from a new paragraph) -eclint_indent_style = unset trim_trailing_whitespace = false [{go.mod,go.sum,*.go,.gitmodules}] @@ -29,7 +29,8 @@ indent_style = tab indent_size = 4 [*.py] -profile = black - -[*.sh] indent_size = 4 + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..a941f94e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint +run-name: 'Lint: ${{ github.event_name }} on ${{ github.ref_name }}' + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + with: + persist-credentials: false + + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..d4c81e62 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: mixed-line-ending + args: [--fix=lf] + - id: check-yaml + args: [--unsafe] # allows GitLab CI custom tags + - id: check-merge-conflict + - id: check-added-large-files + args: [--maxkb=500] + + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + args: [-c, .yamllint.yml] + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + args: [-s, bash] # sourced scripts have no shebang + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.9.6 + hooks: + - id: ruff # linter with auto-fix + args: [--fix] + - id: ruff-format # formatter (replaces black) diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 00000000..f32e3a89 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,32 @@ +extends: default + +rules: + new-lines: + type: unix + + # CI script lines are inherently long - warn only, don't fail + line-length: + max: 200 + level: warning + + # GitLab CI files do not use document-start marker (---) + document-start: disable + + # Disable truthy key check to allow keys like "on:" in CI files + truthy: + check-keys: false + + # Allow both indented (GitHub Actions) and unindented (Kubernetes) sequences + indentation: + spaces: 2 + indent-sequences: consistent + + # Allow single space before inline comments + comments: + min-spaces-from-content: 1 + + braces: + max-spaces-inside: 1 + + brackets: + max-spaces-inside: 1 diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..c521ed20 --- /dev/null +++ b/ruff.toml @@ -0,0 +1,13 @@ +line-length = 88 + +[format] +quote-style = "single" + +[lint] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "UP", # pyupgrade +] From 8824e1b0a6aa08fe31596c8f3399b202bbdbd476 Mon Sep 17 00:00:00 2001 From: Denis Chernykh Date: Fri, 6 Mar 2026 16:34:05 +0500 Subject: [PATCH 2/6] ci: replace single quotes by default (double) in pre-commit --- ruff.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/ruff.toml b/ruff.toml index c521ed20..1301af4d 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,8 +1,5 @@ line-length = 88 -[format] -quote-style = "single" - [lint] select = [ "E", # pycodestyle errors From 5acc8be4e8a131abd36cff6edda4c5c6ee2d7327 Mon Sep 17 00:00:00 2001 From: Denis Chernykh Date: Fri, 6 Mar 2026 16:54:20 +0500 Subject: [PATCH 3/6] style: enforce double quotes in YAML via yamllint --- .yamllint.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.yamllint.yml b/.yamllint.yml index f32e3a89..99324bec 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -30,3 +30,7 @@ rules: brackets: max-spaces-inside: 1 + + quoted-strings: + quote-type: double + required: only-when-needed From a1c84072d1e9bf9306a61f3c047e77c62e37a746 Mon Sep 17 00:00:00 2001 From: Denis Chernykh Date: Fri, 6 Mar 2026 18:55:20 +0500 Subject: [PATCH 4/6] style: ignore cla.yaml in yamllint (third-party workflow template) --- .yamllint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.yamllint.yml b/.yamllint.yml index 99324bec..d8f18e75 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -1,5 +1,8 @@ extends: default +ignore: | + .github/workflows/cla.yaml + rules: new-lines: type: unix From 62247baae89ce9730a193d2f8905f8e0d77b045b Mon Sep 17 00:00:00 2001 From: Denis Chernykh Date: Tue, 10 Mar 2026 16:44:38 +0500 Subject: [PATCH 5/6] chore: add cache dirs, IDE and AI tool directories to .gitignore --- .gitignore | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..6f581099 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# IDEs +.vscode/ +.idea/ + +# AI tools +.claude/ +.cursor/ +.continue/ +.codeium/ +.codex-pre-commit-cache/ + +# Build & tool caches +.pre-commit-cache/ +.ruff_cache/ +.venv/ From f2e5529531d28bb8d2c3d1a419dc9c668511b8c7 Mon Sep 17 00:00:00 2001 From: Denis Chernykh Date: Sun, 15 Mar 2026 10:15:27 +0500 Subject: [PATCH 6/6] docs: add pre-commit setup instructions to README --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5148d883..30bece24 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # qubership-test-pipelines -This repository automates the end-to-end testing qubership services in a Kubernetes cluster using Kind. +This repository automates the end-to-end testing qubership services in a Kubernetes cluster using Kind. It implements a complete CI/CD lifecycle from infrastructure provisioning to post-deployment verification. ## Repository Structure @@ -29,6 +29,25 @@ qubership-test-pipelines/ │ └── [config-name].yml └── workflow-config/ # Workflow configurations ``` +## Development + +### Pre-commit hooks + +This repository uses [pre-commit](https://pre-commit.com/) to enforce code quality. + +#### Installation + +```bash +pip install pre-commit +pre-commit install +``` + +#### Run against all files + +```bash +pre-commit run --all-files +``` + ## Workflows list Added workflow for the following services: - [Qubership Consul](https://github.com/Netcracker/qubership-consul)