diff --git a/.gitattributes b/.gitattributes index 1e79ae3..c2a80d3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -36,3 +36,9 @@ # It is the industry-standard location, and the About tab will read the release # history from it once docs/changelog.txt is retired. # /CHANGELOG.md export-ignore + +# Qodana development configuration +/.qodana export-ignore +/qodana.yaml export-ignore +/docs/QODANA.md export-ignore +/.github/workflows/qodana.yml export-ignore diff --git a/.github/workflows/qodana.yml b/.github/workflows/qodana.yml new file mode 100644 index 0000000..29d86fa --- /dev/null +++ b/.github/workflows/qodana.yml @@ -0,0 +1,44 @@ +# Optional Qodana analysis; shared PHP tooling remains configured separately. +name: Qodana + +on: + workflow_dispatch: + pull_request: + push: + branches: [master, main, 'releases/*'] + +permissions: {} + +concurrency: + group: qodana-${{ github.ref }} + cancel-in-progress: true + +jobs: + qodana: + runs-on: ubuntu-22.04 + timeout-minutes: 30 + permissions: + contents: read + checks: write + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }} + steps: + - name: Explain skipped scan + if: env.QODANA_TOKEN == '' + run: echo "::notice::QODANA_TOKEN is not available; configure this repository's Qodana project token to enable analysis." + + - name: Checkout + if: env.QODANA_TOKEN != '' + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + persist-credentials: false + + - name: Qodana scan + if: env.QODANA_TOKEN != '' + uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2 + with: + upload-result: true + post-pr-comment: false + push-fixes: none diff --git a/.gitignore b/.gitignore index 43abb23..9f5ef84 100644 --- a/.gitignore +++ b/.gitignore @@ -86,4 +86,7 @@ psalm.xml # cache/*.php # --- Baseline / overlay installer conflict artifacts --- -*.overlay-new \ No newline at end of file +*.overlay-new + +# Local Qodana results and caches +/.qodana/ diff --git a/README.md b/README.md index 262cfdf..6d6dd55 100644 --- a/README.md +++ b/README.md @@ -145,3 +145,10 @@ GNU General Public License 2.0 or later. See the license information in `xoops_v ## Credits Based on the earlier XOOPS DebugBar integration by Richard Griffith and trabis, with subsequent XOOPS 2.7 compatibility, diagnostics, analytics, logging, and security work maintained by the XOOPS community. + +## Qodana inspections + +The optional Qodana workflow runs alongside existing quality checks. Add this +repository's `QODANA_TOKEN` secret to enable it; runs without the token print a +skip notice. See [Qodana setup and scope](docs/QODANA.md). No module-local +development vendor directory is required. diff --git a/docs/QODANA.md b/docs/QODANA.md new file mode 100644 index 0000000..cd340de --- /dev/null +++ b/docs/QODANA.md @@ -0,0 +1,47 @@ +# Qodana inspections + +Qodana adds PhpStorm-based PHP, JavaScript and TypeScript inspections alongside +the existing tests and static analysis. The module uses Qodana PHP 2026.2 and the +`qodana.recommended` profile. `qodana.yaml` sets the module's supported PHP level. + +## Enable analysis + +1. Create a Qodana Cloud project for this repository, or connect it through the + Qodana GitHub App. Qodana PHP requires an appropriate Qodana license. +2. Save that project's token as the repository Actions secret `QODANA_TOKEN`. + Use a separate project/token for each module; do not reuse the core project's + token for every repository or commit tokens to configuration files. +3. Run **Actions > Qodana > Run workflow** after the workflow reaches the default + branch. It also runs for pushes to `master`, `main` and `releases/*`, and PRs. +4. Review the Qodana Cloud report and the `qodana-report` workflow artifact. + +When the secret is unavailable, including ordinary fork and Dependabot PRs, +the workflow prints a skip notice. Do not use `pull_request_target` to expose +tokens to untrusted code. PR comments and automatic code fixes are disabled. + +## Scope and dependencies + +The scan excludes vendor packages, generated output, uploads and private +`docs/00` notes. It does not create a Composer manifest or install module-local +development tools. Keep normal tests and quality tools in the shared +`xoops_lib/vendor` installation. + +A standalone module checkout may lack XOOPS core classes and external libraries. +Review unresolved-symbol findings in that context; do not disable all such +inspections or generate a blanket baseline. For full dependency analysis, use a +checkout containing the appropriate core/library sources, or add a reviewed +`bootstrap` command for the module's unique runtime dependencies. The baseline +deliberately does not install every module's Composer development requirements. + +## Maintenance + +Keep the Qodana action and image on matching release lines. GitHub Actions +Dependabot entries, where configured, track the pinned action. Review linter +image updates separately. Change `php.version` when the module's supported PHP +level changes. Generated `.qodana/` files are ignored and excluded from releases. + +No new issue-count threshold or baseline is imposed by this configuration. +Agree on a gate after reviewing the first report; existing tests remain required. + +See JetBrains' [GitHub integration](https://www.jetbrains.com/help/qodana/github.html) +and [PHP configuration](https://www.jetbrains.com/help/qodana/php.html). diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 0000000..e64963a --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,22 @@ +version: "1.0" + +image: jetbrains/qodana-php:2026.2 + +profile: + name: qodana.recommended + +php: + version: "8.2" + +# Analyse module code without installing another development vendor tree. +exclude: + - name: All + paths: + - vendor + - node_modules + - .build + - .qodana + - coverage + - docs/00 + - templates_c + - uploads