Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
490517c
chore(quality): Enhance all quality tool configurations
MarjovanLier Nov 2, 2025
af7ba7e
chore(coderabbit): Add YAML document separator at top
MarjovanLier Nov 2, 2025
448a2ca
fix(coderabbit): Remove 6th custom check to meet schema limit
MarjovanLier Nov 2, 2025
70c03c1
chore(yamllint): Fix line length violations in CodeRabbit config
MarjovanLier Nov 2, 2025
27e50af
refactor(config): Improve wording in CodeRabbit configuration
MarjovanLier Nov 2, 2025
63280fe
feat(quality): Add type-perfect and type-coverage
MarjovanLier Nov 2, 2025
2743269
refactor(quality): Enable all type_perfect no_mixed checks
MarjovanLier Nov 2, 2025
880951d
fix(types): Add array type to callback parameter
MarjovanLier Nov 2, 2025
4742d73
fix(style): Rename property to camelCase per PHPMD
MarjovanLier Nov 2, 2025
51c6490
refactor(psalm): Remove baseline and exclude tests
MarjovanLier Nov 2, 2025
dcdb681
refactor(tests): Convert PHP annotations to attributes
MarjovanLier Nov 2, 2025
961e7f6
refactor(tests): Migrate from PHPUnit to Pest framework
MarjovanLier Nov 2, 2025
8633f42
chore(tests): Increase mutation score requirement to 90%
MarjovanLier Nov 2, 2025
974b047
feat(tests): Add Pest coverage and improve mutations
MarjovanLier Nov 2, 2025
964dc02
feat(tests): Improve mutation score with targeted tests
MarjovanLier Nov 2, 2025
7e07008
refactor(tests): Improve mutation score to 86.23%
MarjovanLier Nov 2, 2025
0ca665c
refactor: Remove redundant str_contains check in nameFix
MarjovanLier Nov 2, 2025
5e09cf3
refactor: Remove redundant str_contains check for mac prefix
MarjovanLier Nov 2, 2025
6bfc508
refactor(tests): Address CodeRabbit review findings
MarjovanLier Nov 2, 2025
2d3ee25
refactor(tests): Address additional CodeRabbit findings
MarjovanLier Nov 2, 2025
22425f2
chore(ci): Migrate from PHPUnit to Pest
MarjovanLier Nov 2, 2025
8b32c34
chore(merge): Integrate main branch changes
MarjovanLier Nov 2, 2025
5073350
chore(tests): Update mutation testing to use Pest
MarjovanLier Nov 2, 2025
72cf4ae
fix(tests): Remove malformed PHPUnit CoversMethod attributes
MarjovanLier Nov 2, 2025
f937199
fix(tests): Enable Xdebug coverage for Pest mutation testing
MarjovanLier Nov 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 242 additions & 22 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,245 @@
language: "en"
---
# yaml-language-server: $schema=https://docs.coderabbit.ai/schema/schema.v2.json

# CodeRabbit Configuration
# StringManipulation PHP 8.3+ Library
# Enforces strict quality standards: PHPStan MAX, SOLID principles, PER-CS2.0

# Language and Tone
language: en-ZA
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The language is set to 'en-ZA' (South African English) throughout the configuration, and path_instructions specifically mention using South African spelling (organisation, optimisation, analyse, behaviour). Ensure this is intentional and consistent across all documentation and code comments.

Copilot uses AI. Check for mistakes.
early_access: true
tone_instructions: "You're an expert PHP reviewer, proficient in PER Coding Style 2.0 (extending PSR-12 & PSR-1), SOLID, and FOOP. Advise on immutable data, pure functions, and functional composition while ensuring robust OOP. Provide concise, actionable feedback."
tone_instructions: >-
Expert PHP reviewer proficient in PER Coding Style 2.0, SOLID, and FOOP.
Advise on immutable data, pure functions, and functional composition.
Provide concise, actionable feedback.
# Review configuration
reviews:
request_changes_workflow: true
high_level_summary: true
poem: false
review_status: true
collapse_walkthrough: true
auto_review:
enabled: true
ignore_title_keywords:
- "WIP"
- "DO NOT MERGE"
drafts: false
base_branches:
- "develop"
- "feat/.*"
- "main"
path_instructions:
- path: "**/*.php"
instructions: |
Review PHP code for adherence to PER Coding Style 2.0 guidelines. Ensure proper namespace usage, code organisation, and separation of concerns. Verify that SOLID principles are followed and encourage FOOP techniques—such as employing immutable data, pure functions, and functional composition—to improve maintainability, testability, and performance.
# Review profile and behaviour
profile: "assertive"
request_changes_workflow: true
high_level_summary: true
high_level_summary_placeholder: "@coderabbitai summary"
poem: false
review_status: true
commit_status: true
fail_commit_status: false
collapse_walkthrough: true

# Walkthrough features
changed_files_summary: true
sequence_diagrams: true
estimate_code_review_effort: true
assess_linked_issues: true
related_issues: true
related_prs: true
suggested_labels: true
auto_apply_labels: false
suggested_reviewers: true
auto_assign_reviewers: false

# Path filters (exclude generated files, vendor, etc.)
path_filters:
- "!vendor/**"
- "!reports/**"
- "!node_modules/**"
- "!*.lock"
- "src/**"
- "tests/**"

# Path-specific instructions
path_instructions:
- path: "**/*.php"
instructions: |
Review PHP code for adherence to PER Coding Style 2.0 guidelines.
Ensure proper namespace usage, code organisation, and separation
of concerns. Verify that SOLID principles are followed and
encourage FOOP techniques—such as immutable data, pure functions,
and functional composition—to improve maintainability,
testability, and performance.
Specific checks:
- Strict typing: `declare(strict_types=1);` is required
- Explicit type declarations for all parameters and return types
- Final classes with static methods where appropriate
- Comprehensive docblocks with @param, @return, and @example tags
- No methods exceeding 100 lines (PHPMD rule)
- PHP 8.3+ features and patterns
- Proper error handling and null safety
- path: "tests/**/*.php"
instructions: |
Review test code for:
- TDD compliance (tests should be clear and comprehensive)
- PHPUnit best practices
- 100% coverage for critical paths, 90%+ for standard code
- Fast execution (unit tests <100ms, integration <5s)
- Independent, deterministic tests
- Descriptive test names and clear assertions
- Proper mocking and test isolation
Comment on lines +70 to +79

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The instructions for reviewing test files still refer to PHPUnit best practices. Since this PR migrates the project to Pest, this should be updated to Pest best practices to be consistent.

        Review test code for:
        - TDD compliance (tests should be clear and comprehensive)
        - Pest best practices
        - 100% coverage for critical paths, 90%+ for standard code
        - Fast execution (unit tests <100ms, integration <5s)
        - Independent, deterministic tests
        - Descriptive test names and clear assertions
        - Proper mocking and test isolation

# Automatic review settings
auto_review:
enabled: true
auto_incremental_review: true
ignore_title_keywords:
- "WIP"
- "DO NOT MERGE"
- "DRAFT"
drafts: false
base_branches:
- "main"
- "develop"
- "feat/.*"
- "fix/.*"
- "refactor/.*"

# Finishing touches
finishing_touches:
docstrings:
enabled: true
unit_tests:
enabled: true

# Pre-merge checks
pre_merge_checks:
docstrings:
mode: "error"
threshold: 80

title:
mode: "warning"
requirements: "Follow conventional commits format: type(scope): description. Types: feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert|security|deps|config|release"

description:
mode: "warning"

issue_assessment:
mode: "warning"

custom_checks:
- mode: "error"
name: "Strict Type Declarations"
instructions: "All PHP files in src/ must begin with `declare(strict_types=1);` after the opening PHP tag and before the namespace declaration."

- mode: "error"
name: "No Debugging Functions"
instructions: "Production code (src/ directory) must not contain debugging functions: var_dump(), var_export(), print_r(), dd(), or dump()."

- mode: "warning"
name: "Test Coverage"
instructions: "New code must have corresponding PHPUnit tests. Critical features require 100% line coverage; standard features require 90% coverage."
Comment on lines +130 to +131

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This custom check for test coverage still mentions PHPUnit tests. This should be updated to Pest tests to align with the project's new testing framework.

        instructions: "New code must have corresponding Pest tests. Critical features require 100% line coverage; standard features require 90% coverage."


- mode: "warning"
name: "Performance Complexity"
instructions: "Algorithms should avoid O(n²) or worse time complexity. Document Big O time complexity for non-trivial algorithms."

- mode: "warning"
name: "Security Best Practices"
instructions: "Validate all user input. Use parameterised statements for SQL queries. Never hardcode secrets, credentials, or API keys."

# Tools configuration
tools:
# GitHub Checks - MAX TIMEOUT (15 minutes)
github-checks:
enabled: true
timeout_ms: 900000

# PHP Tools
phpstan:
enabled: true
level: "max"

phpmd:
enabled: true

phpcs:
enabled: true

# Security and quality tools
gitleaks:
enabled: true

actionlint:
enabled: true

semgrep:
enabled: true

# Documentation and style
languagetool:
enabled: true
level: "default"
enabled_only: false

# Disable non-PHP tools to reduce noise
shellcheck:
enabled: false

ruff:
enabled: false

eslint:
enabled: false

yamllint:
enabled: true

# Chat configuration
chat:
auto_reply: true
auto_reply: true
art: true

# Knowledge base
knowledge_base:
opt_out: false

web_search:
enabled: true

code_guidelines:
enabled: true
filePatterns:
- "**/CLAUDE.md"
- "**/.cursorrules"
- ".github/copilot-instructions.md"
- "docs/coding-standards.md"

learnings:
scope: "auto"

issues:
scope: "local"

pull_requests:
scope: "local"

# Code Generation Configuration
code_generation:
# Docstring Generation
docstrings:
language: en-ZA
path_instructions:
- path: "src/**/*.php"
instructions: |
Focus on explaining business behaviour and functionality, not obvious implementation.
Use South African English spelling (organisation, optimisation, analyse, behaviour).
Include @param and @return tags with proper types.
Add @throws for exceptions.
Add @example tags demonstrating usage.
Reference related documentation with @see tags.
Follow PER Coding Style 2.0 conventions.
# Unit Test Generation
unit_tests:
path_instructions:
- path: "src/**/*.php"
instructions: |
Generate PHPUnit tests following TDD principles:
Comment on lines +237 to +238

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The instructions for unit test generation still refer to PHPUnit tests. This should be updated to Pest tests.

        instructions: |
          Generate Pest tests following TDD principles:

- Test names must describe behaviour: test_methodName_condition_expectedBehaviour
- Each test must follow the AAA pattern (Arrange-Act-Assert)
- Include unit tests for all public methods, edge cases, and error conditions
- Tests must be independent and deterministic
- Target fast execution (<100ms for unit tests)
- Use data providers with #[DataProvider] for testing multiple scenarios
- Focus on critical functionality and edge cases
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{yml,yaml,json}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: composer self-update && composer install && composer dump-autoload

- name: Run tests and collect coverage
run: vendor/bin/phpunit
run: vendor/bin/pest --coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.0.1
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ jobs:

# This step sets up Go environment for the job.
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: "1.23"

# This step installs osv-scanner for vulnerability scanning.
- name: Install osv-scanner
Expand Down Expand Up @@ -93,16 +93,16 @@ jobs:
if: steps.code-style.outcome == 'success'
run: composer test:phpmd

# This step runs tests with PHPUnit.
- name: Run tests with PHPUnit
id: phpunit
# This step runs tests with Pest.
- name: Run tests with Pest
id: pest
if: steps.phpmd.outcome == 'success'
run: composer test:phpunit
run: composer test:pest

# This step runs mutation testing with Infection.
# This step runs mutation testing with Pest.
- name: Run Mutation Testing
id: infection
if: steps.phpunit.outcome == 'success'
if: steps.pest.outcome == 'success'
run: composer test:infection

# This step runs static analysis with PHPStan.
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
- name: Create release
id: create_release
if: github.ref == 'refs/heads/main' && steps.get-commits.outcome == 'success'
uses: actions/create-release@v1
uses: softprops/action-gh-release@v2
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub Actions workflow switched from actions/create-release@v1 (deprecated) to softprops/action-gh-release@v2. This is correct, but verify that the with: parameters are compatible with the new action's API, as the interface may differ slightly.

Copilot uses AI. Check for mistakes.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
!*/

# ========================================
# CORE APPLICATION FILES
# CORE APPLICATION FILES
# ========================================
!*.php
!composer.json
Expand Down Expand Up @@ -57,7 +57,7 @@
!.codacy.yaml

# ========================================
# DOCKER & INFRASTRUCTURE
# DOCKER & INFRASTRUCTURE
# ========================================
!Dockerfile
!docker-compose.yml
Expand All @@ -81,7 +81,7 @@
!.pr_agent.toml
!sweep.yaml

# ========================================
# ========================================
# GIT CONFIGURATION
# ========================================
!.gitignore
Expand All @@ -102,6 +102,10 @@ package-lock.json
.phpunit.cache
.phpunit.result.cache
.php-cs-fixer.cache
.phpstan/

# Temporary files
commit_messages.txt
*.tmp

# Build artifacts and reports
Expand Down
1 change: 0 additions & 1 deletion .phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@
// your application should be included in this list.
'directory_list' => [
'src',
'tests',
'vendor',
],

Expand Down
Loading
Loading