From 0f0091239596f9c790b34855c97074939abee5b0 Mon Sep 17 00:00:00 2001 From: jmnote Date: Sun, 6 Sep 2026 14:44:51 +0900 Subject: [PATCH] Add dev tooling: composer, phpcs, Makefile, CI, .gitignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - composer.json: mediawiki-codesniffer, minus-x, php-parallel-lint as require-dev, wired up via `composer test` - .phpcs.xml: MediaWiki coding-standard ruleset (excluding hack/, tests/, and the FunctionComment doc-required-for-public/private sniffs) - Makefile: `make checks` (test + phpcs) mirrors what CI runs; `make test` currently runs tests/QuotesTest.php. The mathjax/screenshots targets land later, alongside the hack/ scripts they call. - .github/workflows/pull-request.yml replaces contributors.yml: runs `composer install` + `make checks` on every PR - .gitignore (vendor/, node_modules/, composer.lock, hack/demo/temp/) and .vscode/ editor settings; drops .editorconfig, superseded by phpcs - Drops README's auto-generated Contributors table along with contributors.yml, the workflow that kept it updated — left in place it would just be a stale, frozen snapshot from here on Co-Authored-By: Claude Sonnet 5 --- .editorconfig | 12 --- .github/workflows/contributors.yml | 21 ----- .github/workflows/pull-request.yml | 19 ++++ .gitignore | 4 + .phpcs.xml | 13 +++ .vscode/extensions.json | 5 ++ .vscode/settings.json | 7 ++ Makefile | 9 ++ README.md | 140 ----------------------------- composer.json | 27 ++++++ 10 files changed, 84 insertions(+), 173 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .github/workflows/contributors.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 .gitignore create mode 100644 .phpcs.xml create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json create mode 100644 Makefile create mode 100644 composer.json diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index c59c447b..00000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -indent_style = tab -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml deleted file mode 100644 index ebf5eea1..00000000 --- a/.github/workflows/contributors.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: main - -on: - workflow_dispatch: - -permissions: - contents: write - pull-requests: write - -jobs: - contributors: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: akhilmhdh/contributors-readme-action@v2.3.11 - with: - image_size: 48 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..974dad5c --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,19 @@ +name: pull-request + +on: + pull_request: + +jobs: + php: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + + - run: composer install --no-progress + + - run: make checks diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..fc8aa5c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +vendor/ +composer.lock +hack/demo/temp/ diff --git a/.phpcs.xml b/.phpcs.xml new file mode 100644 index 00000000..4491da7e --- /dev/null +++ b/.phpcs.xml @@ -0,0 +1,13 @@ + + + + + + + . + \.stubs/ + hack/ + tests/ + + + diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..3eee8217 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "wongjn.php-sniffer" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..5737ef9a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "[php]": { + "editor.defaultFormatter": "wongjn.php-sniffer", + "editor.formatOnSave": true, + }, + "phpSniffer.executablesFolder": "vendor/bin/" +} diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..a3af8f52 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +.PHONY: checks test phpcs + +checks: test phpcs ## Everything CI runs before merging (needs `composer install`, PHP >= 8.2) + +test: ## Run the pure-PHP test suites + php tests/QuotesTest.php + +phpcs: ## parallel-lint + minus-x + phpcs against the MediaWiki coding standard + composer test diff --git a/README.md b/README.md index ca5f3642..a5381188 100644 --- a/README.md +++ b/README.md @@ -101,143 +101,3 @@ $wgHooks['SimpleMathJaxAttributes'][] }; ``` -## Contributors - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - jmnote -
- jmnote -
-
- - jamesmontalvo3 -
- James Montalvo -
-
- - hexmode -
- Mark A. Hershberger -
-
- - dummy-index -
- dummy-index -
-
- - lakejason0 -
- lakejason0 -
-
- - badshah400 -
- Atri Bhattacharya -
-
- - Nikerabbit -
- Niklas Laxström -
-
- - cubercsl -
- cubercsl -
-
- - liberaldev -
- Liberal Dev -
-
- - Adnn -
- Adnn -
-
- - dexgs -
- Dexter Gaon-Shatford -
-
- - pastakhov -
- Pavel Astakhov -
-
- - v-gar -
- Viktor Garske -
-
- - rickselby -
- Rick Selby -
-
- - guyru -
- guyru -
-
- - poiega -
- poiega -
-
- - vedmaka -
- Vedmaka -
-
- - yardenac -
- Yardena Cohen -
-
- diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..a02e8c67 --- /dev/null +++ b/composer.json @@ -0,0 +1,27 @@ +{ + "require-dev": { + "mediawiki/mediawiki-codesniffer": "52.0.0", + "mediawiki/mediawiki-phan-config": "0.20.0", + "mediawiki/minus-x": "2.0.1", + "php-parallel-lint/php-console-highlighter": "1.0.0", + "php-parallel-lint/php-parallel-lint": "1.4.0" + }, + "scripts": { + "fix": [ + "minus-x fix .", + "phpcbf" + ], + "test": [ + "parallel-lint . --exclude vendor --exclude node_modules", + "minus-x check .", + "@phpcs" + ], + "phan": "phan -d . --long-progress-bar", + "phpcs": "phpcs -sp" + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +}