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/.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/ 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..d8f18e75 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,39 @@ +extends: default + +ignore: | + .github/workflows/cla.yaml + +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 + + quoted-strings: + quote-type: double + required: only-when-needed 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) diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..1301af4d --- /dev/null +++ b/ruff.toml @@ -0,0 +1,10 @@ +line-length = 88 + +[lint] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "UP", # pyupgrade +]