From d05388ed22867561ee119760c4102f1d88af1e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Susana=20V=C3=A1zquez?= <3016283+svazquezco@users.noreply.github.com> Date: Fri, 2 Jan 2026 13:41:53 +0100 Subject: [PATCH 1/2] feat: add instructions and coderabbit yaml --- .coderabbit.yaml | 187 +++++++++++++++++++++++++++++++++++++++ .github/.instructions.md | 39 ++++++++ 2 files changed, 226 insertions(+) create mode 100644 .coderabbit.yaml create mode 100644 .github/.instructions.md diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000..bec3180 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,187 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +language: "en" +tone_instructions: '' +early_access: true +enable_free_tier: true +inheritance: true +reviews: + profile: "chill" + request_changes_workflow: false + high_level_summary: true + high_level_summary_instructions: '' + high_level_summary_placeholder: '@coderabbitai summary' + high_level_summary_in_walkthrough: false + auto_title_placeholder: '@coderabbitai' + auto_title_instructions: '' + review_status: true + commit_status: true + fail_commit_status: false + collapse_walkthrough: true + changed_files_summary: true + sequence_diagrams: false + estimate_code_review_effort: true + assess_linked_issues: true + related_issues: true + related_prs: true + suggested_labels: false + labeling_instructions: [] + auto_apply_labels: false + suggested_reviewers: false + auto_assign_reviewers: false + in_progress_fortune: false + poem: false + enable_prompt_for_ai_agents: true + path_filters: + - "!.gitignore" + path_instructions: [] + abort_on_close: true + disable_cache: false + auto_review: + enabled: true + auto_incremental_review: true + ignore_title_keywords: [] + labels: [] + drafts: false + base_branches: + - release/* + ignore_usernames: [] + finishing_touches: + docstrings: + enabled: false + unit_tests: + enabled: false + pre_merge_checks: + docstrings: + mode: 'off' + threshold: 80 + title: + mode: warning + requirements: 'Title should include jira ticket number with prefix MPT-' + description: + mode: error + issue_assessment: + mode: off + custom_checks: [] + tools: + ast-grep: + rule_dirs: [] + util_dirs: [] + essential_rules: true + packages: [] + shellcheck: + enabled: false + ruff: + enabled: true + markdownlint: + enabled: true + github-checks: + enabled: true + timeout_ms: 90000 + languagetool: + enabled: true + enabled_rules: [] + disabled_rules: [] + enabled_categories: [] + disabled_categories: [] + enabled_only: false + level: default + biome: + enabled: true + hadolint: + enabled: true + swiftlint: + enabled: false + phpstan: + enabled: false + level: default + phpmd: + enabled: false + phpcs: + enabled: false + golangci-lint: + enabled: false + yamllint: + enabled: true + gitleaks: + enabled: true + checkov: + enabled: false + detekt: + enabled: false + eslint: + enabled: false + flake8: + enabled: true + fortitudeLint: + enabled: false + rubocop: + enabled: false + buf: + enabled: false + regal: + enabled: false + actionlint: + enabled: true + pmd: + enabled: true + clang: + enabled: false + cppcheck: + enabled: false + semgrep: + enabled: true + circleci: + enabled: false + clippy: + enabled: false + sqlfluff: + enabled: true + prismaLint: + enabled: true + pylint: + enabled: true + oxc: + enabled: false + shopifyThemeCheck: + enabled: false + luacheck: + enabled: false + brakeman: + enabled: false + dotenvLint: + enabled: false + htmlhint: + enabled: false + checkmake: + enabled: true + osvScanner: + enabled: true +chat: + art: false + auto_reply: true + integrations: + jira: + usage: auto + linear: + usage: disabled +knowledge_base: + opt_out: false + web_search: + enabled: true + code_guidelines: + enabled: true + filePatterns: + - '.github/.instructions.md' + learnings: + scope: auto + issues: + scope: auto + jira: + usage: auto + project_keys: + - MPT + pull_requests: + scope: auto + mcp: + usage: auto + disabled_servers: [] diff --git a/.github/.instructions.md b/.github/.instructions.md new file mode 100644 index 0000000..79087ad --- /dev/null +++ b/.github/.instructions.md @@ -0,0 +1,39 @@ +--- +description: 'Python coding conventions and guidelines' +applyTo: '**/*.py' +--- + +# Python Coding Conventions + +## General Instructions +- All configuration **must be provided via environment variables**. +- Do not hardcode configuration values. +- Write maintainable, readable, and predictable code. +- In `pyproject.toml`: + - Use `*` for **minor versions only** + ✅ `django==4.2.*` + ❌ `django==^4.2.2` + +- Use consistent naming conventions and follow language-specific best practices. + +## Python Instructions +- Use type annotations (PEP 484). +- All public functions, methods, and classes **must include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html)**. +- **Do not add inline comments**; rely on clear code and docstrings instead. +- Function and variable names must be explicit and intention-revealing. +- `pyproject.toml` is the source of truth for ruff and flake8 rules. Generated code must not violate those rules. +- Follow PEP 8 unless explicitly overridden by ruff. +- Prefer simple, explicit code over clever or compact implementations. + +## Testing +- Use pytest only. +- Tests must be written as **functions**, not classes. +- Test files and functions must use the `test_` prefix. +- Follow ***AAA(Arrange - Act - Assert)*** strictly. See the [flake8-aaa documentation](https://flake8-aaa.readthedocs.io/en/stable/index.html). +- Do **not** use `if` statements or branching logic inside tests. +- Prefer fixtures over mocks whenever possible. +- Avoid duplicating test logic; extract shared setup into fixtures. +- Use `mocker` only when mocking is unavoidable. +- Never use `unittest.mock` directly. +- Always use `spec` or `autospec` when mocking. +- Use `@pytest.mark.parametrize` tests when testing permutations of the same behavior. From 8aac4e7fa4550954a8ad4ed1a3f93864571849e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Susana=20V=C3=A1zquez?= <3016283+svazquezco@users.noreply.github.com> Date: Fri, 2 Jan 2026 13:41:53 +0100 Subject: [PATCH 2/2] feat: add instructions and coderabbit yaml --- .coderabbit.yaml | 77 +++++++++++++++---- ...nstructions.md => copilot-instructions.md} | 8 +- .github/workflows/danger.yml | 22 ------ 3 files changed, 68 insertions(+), 39 deletions(-) rename .github/{.instructions.md => copilot-instructions.md} (76%) delete mode 100644 .github/workflows/danger.yml diff --git a/.coderabbit.yaml b/.coderabbit.yaml index bec3180..1b1e184 100644 --- a/.coderabbit.yaml +++ b/.coderabbit.yaml @@ -1,14 +1,19 @@ # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json language: "en" -tone_instructions: '' +tone_instructions: "" early_access: true enable_free_tier: true inheritance: true reviews: profile: "chill" - request_changes_workflow: false + request_changes_workflow: true high_level_summary: true - high_level_summary_instructions: '' + high_level_summary_instructions: | + Extract the Jira issue key from the PR title (format: MPT-XXXX). + Start the summary with: "Closes MPT-XXXX" where MPT-XXXX is replaced with the actual issue key found in the title. + Add a link: [MPT-XXXX](https://softwareone.atlassian.net/browse/MPT-XXXX) + + Then generate concise release notes as a bullet-point list. high_level_summary_placeholder: '@coderabbitai summary' high_level_summary_in_walkthrough: false auto_title_placeholder: '@coderabbitai' @@ -21,7 +26,7 @@ reviews: sequence_diagrams: false estimate_code_review_effort: true assess_linked_issues: true - related_issues: true + related_issues: false related_prs: true suggested_labels: false labeling_instructions: [] @@ -33,7 +38,13 @@ reviews: enable_prompt_for_ai_agents: true path_filters: - "!.gitignore" - path_instructions: [] + path_instructions: + - path: "**/*.py" + instructions: | + Do not suggest formatting changes or mention code formatting using Black. Instead use Ruff or Flake8 + - path: "**/*" + instructions: | + When reviewing subsequent commits, always check if previous review comments have been addressed and acknowledge resolved issues. abort_on_close: true disable_cache: false auto_review: @@ -52,16 +63,53 @@ reviews: enabled: false pre_merge_checks: docstrings: - mode: 'off' - threshold: 80 + mode: off title: - mode: warning - requirements: 'Title should include jira ticket number with prefix MPT-' + mode: off description: - mode: error - issue_assessment: mode: off - custom_checks: [] + issue_assessment: + mode: warning + custom_checks: + - name: "Jira Issue Key in Title" + mode: "error" + instructions: | + Check if the PR title contains exactly one Jira issue key in the format MPT-XXXX. + + If found: + - Post: ✅ Found Jira issue key in the title: [MPT-XXXX](https://softwareone.atlassian.net/browse/MPT-XXXX) + - Replace MPT-XXXX with the actual issue key found + - Mark the check as PASSED + + If not found: + - Post: ⚠️ PR title must include exactly one Jira issue key in the format MPT-XXXX. + - Mark the check as FAILED + - name: "Test Coverage Required" + mode: "warning" + instructions: | + Check if the PR modifies any code files but does not include changes in the tests/ folder. + + If code files are modified but no test files are changed: + - Count the number of code files modified + - Post: This PR modifies code (X file(s)) but does not include any changes in the tests/ folder. Please consider adding or updating tests to cover your changes. + - Replace X with the actual number of files + - Mark the check as FAILED + + If test files are included or no code files are modified: + - Mark the check as PASSED + - name: "Single Commit Required" + mode: "warning" + instructions: | + Check if the PR contains more than one commit. + + If the PR has more than one commit: + - Count the number of commits + - Post: ⚠️ This PR contains X commits. Please squash them into a single commit to keep the git history clean and easy to follow. Multiple commits are acceptable only in the following cases: One commit is a technical refactoring, and another introduces business logic changes. You are doing a complex multi-step refactoring (although in this case we still recommend splitting it into separate PRs). + - Replace X with the actual number of commits + - Mark the check as FAILED + + If the PR has exactly one commit: + - Mark the check as PASSED tools: ast-grep: rule_dirs: [] @@ -170,14 +218,13 @@ knowledge_base: enabled: true code_guidelines: enabled: true - filePatterns: - - '.github/.instructions.md' + filePatterns: [] # Uses defaults including .github/copilot-instructions.md learnings: scope: auto issues: scope: auto jira: - usage: auto + usage: enabled project_keys: - MPT pull_requests: diff --git a/.github/.instructions.md b/.github/copilot-instructions.md similarity index 76% rename from .github/.instructions.md rename to .github/copilot-instructions.md index 79087ad..665cbcc 100644 --- a/.github/.instructions.md +++ b/.github/copilot-instructions.md @@ -17,11 +17,15 @@ applyTo: '**/*.py' - Use consistent naming conventions and follow language-specific best practices. ## Python Instructions -- Use type annotations (PEP 484). +- Use type annotations (PEP 484) - except in the `tests/` folder. - All public functions, methods, and classes **must include [Google-style docstrings](https://google.github.io/styleguide/pyguide.html)**. - **Do not add inline comments**; rely on clear code and docstrings instead. - Function and variable names must be explicit and intention-revealing. -- `pyproject.toml` is the source of truth for ruff and flake8 rules. Generated code must not violate those rules. +- `pyproject.toml` is the source of truth for code quality rules. Generated code must not violate any configured rules. +- **ruff** is the primary linter for general Python style and best practices. +- **flake8** is used exclusively to run: + - `wemake-python-styleguide` - Enforces strict Python coding standards ([docs](https://wemake-python-styleguide.readthedocs.io/en/latest/)) + - `flake8-aaa` - Validates the AAA pattern in tests - Follow PEP 8 unless explicitly overridden by ruff. - Prefer simple, explicit code over clever or compact implementations. diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml deleted file mode 100644 index 021aa34..0000000 --- a/.github/workflows/danger.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Danger - -on: - pull_request: - types: [opened, synchronize, reopened, edited] - -permissions: - contents: read - pull-requests: write - -jobs: - danger: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - uses: softwareone-platform/one-danger@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }}