Skip to content

Sort imports alphabetically in Main.php hook handler - #15

Merged
Zippybonzo merged 3 commits into
mainfrom
claude/ci-checks-failing-g4p2tn
Jul 15, 2026
Merged

Sort imports alphabetically in Main.php hook handler#15
Zippybonzo merged 3 commits into
mainfrom
claude/ci-checks-failing-g4p2tn

Conversation

@Zippybonzo

@Zippybonzo Zippybonzo commented Jul 15, 2026

Copy link
Copy Markdown
Member

This change reorganizes the import statements in the Main hook handler file to follow alphabetical ordering conventions.

Summary
Reordered the use statements in includes/HookHandlers/Main.php to maintain consistent alphabetical ordering of imported classes.

Key changes

  • Moved MediaWiki\Output\OutputPage import after MediaWiki\MediaWikiServices to maintain alphabetical order by namespace and class name

Details
The imports are now sorted alphabetically:

  • MediaWiki\Html\Html
  • MediaWiki\Http\HttpRequestFactory
  • MediaWiki\Linker\Linker
  • MediaWiki\MainConfigNames
  • MediaWiki\MediaWikiServices
  • MediaWiki\Output\OutputPage (moved)
  • MediaWiki\Permissions\Hook\TitleReadWhitelistHook
  • MediaWiki\Shell\Shell
  • MediaWiki\SpecialPage\SpecialPage

This improves code maintainability and follows PSR-12 coding standards for import organization.

https://claude.ai/code/session_01NNc3hYc9gyZHhSmg7Azg3o

Summary by CodeRabbit

  • Refactor
    • Reorganized internal import ordering without changing functionality.
  • Configuration
    • Updated how extension resource files are mapped and loaded, including adjustments to the referenced client script path and a related dependency entry to improve consistency in resource delivery.

Move OutputPage use statement into alphabetical order, fixing the
CI composer test (phpcs) failure.
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 249ce132-fd49-47b6-9e0b-dc22ba6793de

📥 Commits

Reviewing files that changed from the base of the PR and between 74817a2 and ed772b5.

📒 Files selected for processing (1)
  • extension.json

📝 Walkthrough

Walkthrough

The pull request adds resource file path mapping, updates the simple blog page fix resource module path and dependency name in extension.json, and reorders imports in includes/HookHandlers/Main.php.

Changes

Extension resource configuration and imports

Layer / File(s) Summary
Update resource module paths
extension.json
Adds local-to-remote resource path mapping and updates the simple blog page fix script path and dependency name.
Reorder Main imports
includes/HookHandlers/Main.php
Places MainConfigNames and MediaWikiServices before OutputPage in the import list.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches one real part of the PR, but it misses the main extension.json resource registration fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/ci-checks-failing-g4p2tn

Comment @coderabbitai help to get the list of available commands.

claude added 2 commits July 15, 2026 23:31
Two bugs surfaced by the REL1_45 CI leg's ResourcesTest structure tests:

- The declared dependency 'ext.OOJSPlus.data' does not exist; the real
  OOJSPlus module name is 'ext.oOJSPlus.data' (lowercase o prefix).
- The scripts path resolved against MediaWiki core's root instead of
  the extension directory. Declare ResourceFileModulePaths explicitly,
  matching the convention used by CreateWiki's extension.json, so the
  module resolves correctly regardless of implicit path defaulting.
The Miraheze CI test matrix that runs ResourcesTest doesn't include the
OOJSPlus extension, so any hard 'dependencies' entry naming one of its
modules fails testValidDependencies regardless of spelling. Since the
JS shim only needs OOJSPlus.data by the time SimpleBlogPage's panel
runs, drop the extension.json dependency and instead wait for the
module with mw.loader.using() inside the script itself, which resolves
correctly on wikis that actually have OOJSPlus installed and no-ops
elsewhere.
@Zippybonzo
Zippybonzo merged commit f309690 into main Jul 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants