Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
52 changes: 52 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: "en-US"
early_access: false
tone_instructions: >-
Expert PHP code reviewer. Focus on type safety, PSR-12 compliance,
PHP 8.2 compatibility, and security. This is a utility library
supporting PHP 8.2 through 8.5.

reviews:
profile: "assertive"
request_changes_workflow: true
high_level_summary: true
poem: false
review_status: true
collapse_walkthrough: false
auto_review:
enabled: true
drafts: false
path_instructions:
- path: "src/**/*.php"
instructions: >-
Review for PHP 8.2-8.5 compatibility. PHP 8.0 features (union types,
named arguments, match expressions, constructor promotion, nullsafe
operator) are allowed. PHP 8.1 features (enums, readonly properties,
intersection types, fibers, first-class callable syntax) are allowed.
PHP 8.2 features (readonly classes, DNF types, standalone true/false/null
types, constants in traits) are allowed. Avoid PHP 8.3+ features.
Check for proper PSR-12 code style.
Check for SQL injection risks — all queries must use parameterized
statements via XOOPS database handlers.
- path: "tests/**/*.php"
instructions: >-
Review test code for proper assertions, test isolation, and edge
case coverage. Tests must work across PHPUnit 9.6, 10, and 11.

chat:
auto_reply: true

tools:
phpcs:
enabled: true
phpstan:
enabled: true
gitleaks:
enabled: true
markdownlint:
enabled: true
yamllint:
enabled: true
github-checks:
enabled: true
timeout_ms: 90000
Comment on lines +39 to +52
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

In CodeRabbit schema v2, is toolsexpected underreviews.tools (not top-level)?

💡 Result:

Yes, in CodeRabbit schema v2, tools is expected under reviews.tools, not at the top level.

Citations:


Move tools under reviews section—it is currently ignored at the top level.

Per CodeRabbit schema v2, tools must be nested under reviews, not at the root level. The current top-level placement will be silently ignored.

Suggested structure fix
 reviews:
   profile: "assertive"
   request_changes_workflow: true
   high_level_summary: true
   poem: false
   review_status: true
   collapse_walkthrough: false
   auto_review:
     enabled: true
     drafts: false
+  tools:
+    phpcs:
+      enabled: true
+    phpstan:
+      enabled: true
+    gitleaks:
+      enabled: true
+    markdownlint:
+      enabled: true
+    yamllint:
+      enabled: true
+    github-checks:
+      enabled: true
+      timeout_ms: 90000
@@
-tools:
-  phpcs:
-    enabled: true
-  phpstan:
-    enabled: true
-  gitleaks:
-    enabled: true
-  markdownlint:
-    enabled: true
-  yamllint:
-    enabled: true
-  github-checks:
-    enabled: true
-    timeout_ms: 90000
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.coderabbit.yaml around lines 39 - 52, The tools block is at the top level
and will be ignored by CodeRabbit v2; move the entire tools mapping (including
phpcs, phpstan, gitleaks, markdownlint, yamllint and the github-checks entry
with timeout_ms) under a reviews key so that tools is nested as reviews.tools
(remove the top-level tools). Update the YAML structure to preserve all entries
and values but place them beneath reviews to conform to the v2 schema.

21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
root = true

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

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2

[*.json]
indent_size = 4

[Makefile]
indent_style = tab
36 changes: 36 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Auto-detect text files and normalize line endings
* text=auto eol=lf

# PHP files
*.php text eol=lf

# Documentation
*.md text eol=lf
*.txt text eol=lf

# Config files
*.json text eol=lf
*.xml text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.neon text eol=lf

# Exclude from distribution archives (composer --prefer-dist)
/.github/ export-ignore
/tests/ export-ignore
/docs export-ignore
.github/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
Comment on lines +21 to +24
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

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

.gitattributes contains duplicate/overlapping export-ignore rules for .github (/.github/ and .github/) and an inconsistent /docs rule (missing trailing slash). Cleaning these up avoids confusion and ensures git archive / Composer dist exports behave as intended.

Suggested change
/docs export-ignore
.github/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore
/docs/ export-ignore
.gitattributes export-ignore
.gitignore export-ignore

Copilot uses AI. Check for mistakes.
.editorconfig export-ignore
.scrutinizer.yml export-ignore
phpunit.xml export-ignore
phpstan.neon export-ignore
stubs/ export-ignore
qodana.yaml export-ignore
renovate.json export-ignore
.coderabbit.yaml export-ignore
sonar-project.properties export-ignore
CHANGELOG.md export-ignore
TUTORIAL.md export-ignore
CLAUDE.md export-ignore
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Bug report
description: Report a defect or regression in XOOPS Helpers.
title: "[Bug]: "
labels:
- bug
body:
- type: textarea
id: summary
attributes:
label: Summary
description: Describe the bug and the expected behavior.
validations:
required: true
- type: input
id: php_version
attributes:
label: PHP version
placeholder: "8.2.30"
validations:
required: true
- type: input
id: xoops_version
attributes:
label: XOOPS version
placeholder: "2.5.x / 2.6.x / custom"
- type: textarea
id: reproduction
attributes:
label: Reproduction
description: Include a minimal code sample or exact steps.
render: php
validations:
required: true
- type: textarea
id: logs
attributes:
label: Errors or logs
description: Paste stack traces, warnings, or screenshots if available.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Security report
url: https://github.com/xoops/xoops-helpers/security/policy
about: Report security issues privately through the repository security policy.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Feature request
description: Propose a new helper, adapter, or integration.
title: "[Feature]: "
labels:
- enhancement
body:
- type: textarea
id: problem
attributes:
label: Problem to solve
description: Describe the gap or developer pain point.
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed solution
description: Describe the API or behavior you want.
validations:
required: true
- type: textarea
id: compatibility
attributes:
label: Compatibility notes
description: Note any XOOPS, PHP, or BC concerns.
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Summary

- Explain what changed.
- Link any related issue or discussion.

## Validation

- [ ] `composer validate --strict`
- [ ] `composer test`
- [ ] `composer analyse`

## Notes

- Mention any compatibility, migration, or follow-up work.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: composer
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

permissions:
contents: read

jobs:
tests:
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3', '8.4', '8.5']
stability: [prefer-stable]
include:
- php: '8.2'
stability: prefer-lowest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl, zip
coverage: none

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress

- name: Validate composer.json
run: composer validate --strict

- name: Run tests
run: composer test

static-analysis:
name: PHPStan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl
coverage: none

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Validate composer.json
run: composer validate --strict

- name: Run PHPStan
run: composer analyse -- --no-progress
38 changes: 38 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Code Coverage

on:
push:
branches: [main, master]

permissions:
contents: read

jobs:
coverage:
name: Coverage Report
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl, zip
coverage: xdebug

- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress

- name: Generate coverage
run: vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CodeQL

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
- cron: '30 3 * * 1'
workflow_dispatch:

permissions:
actions: read
contents: read
security-events: write

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: php

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: none

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v3
19 changes: 19 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Dependency Review

on:
pull_request:
branches: [main, master]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Dependency review
uses: actions/dependency-review-action@v4
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/vendor/
/composer.lock
/.phpunit.cache/
/coverage/
/.php-cs-fixer.cache
/.phpstan-result-cache/
*.swp
*.swo
*~
.DS_Store
Thumbs.db
.idea/
.vscode/
Loading
Loading