84% hermit

Code Review | Hermit 音乐播放器

WordPress plugin Hermit 音乐播放器 scored 84% from 54 tests.

About plugin

  • Plugin page: hermit
  • Plugin version: 3.1.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-4.9.5
  • WordPress version: 5.9.2
  • First release: Apr 18, 2014
  • Latest release: Jun 12, 2018
  • Number of updates: 96
  • Update frequency: every 15.8 days
  • Top authors: afcold (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

600+ active / 56,130 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.34MB] [CPU: ▼289.10ms] Passed 4 tests

A check of server-side resources used by Hermit 音乐播放器
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.90 ▲0.3963.45 ▲14.54
Dashboard /wp-admin3.75 ▲0.3435.84 ▲3.26
Posts /wp-admin/edit.php3.97 ▲0.3339.01 ▲2.54
Add New Post /wp-admin/post-new.php7.28 ▲0.3194.38 ▼1,166.73
Media Library /wp-admin/upload.php3.69 ▲0.3927.01 ▲4.53
帮助 /wp-admin/admin.php?page=hermit-help3.5924.37
音乐库 /wp-admin/admin.php?page=hermit3.7031.36
设置 /wp-admin/admin.php?page=hermit-setting3.6124.95

Server storage [IO: ▲0.44MB] [DB: ▲0.00MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 44 new files
Database: 2 new tables, no new options
New tables
wp_hermit_cat
wp_hermit

Browser metrics Passed 4 tests

Checking browser requirements for Hermit 音乐播放器
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,835 ▲8115.93 ▼0.136.45 ▲0.472.81 ▼0.03
Dashboard /wp-admin2,931 ▲736.11 ▼0.07117.51 ▼24.67197.53 ▲29.26
Posts /wp-admin/edit.php2,730 ▲393.13 ▼0.1164.39 ▲0.34150.06 ▲2.93
Add New Post /wp-admin/post-new.php1,658 ▼320.37 ▲4.03362.33 ▼57.29195.17 ▲23.95
Media Library /wp-admin/upload.php1,731 ▲335.50 ▲0.08124.14 ▼14.80219.77 ▲34.98
帮助 /wp-admin/admin.php?page=hermit-help1,3292.3955.08203.64
音乐库 /wp-admin/admin.php?page=hermit1,5585.0386.64170.00
设置 /wp-admin/admin.php?page=hermit-setting1,6012.4355.79203.65

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The uninstall procedure failed, leaving 2 tables in the database
    • wp_hermit_cat
    • wp_hermit

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 8× PHP files trigger server errors when accessed directly:
    • > PHP Warning
      require(HERMIT_PATH/Meting.php): failed to open stream: No such file or directory in wp-content/plugins/hermit/class.json.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/hermit/include/setting.php:11
    • > PHP Warning
      Use of undefined constant HERMIT_PATH - assumed 'HERMIT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/hermit/class.json.php on line 4
    • > PHP Fatal error
      require(): Failed opening required 'HERMIT_PATH/Meting.php' (include_path='.:/usr/share/php') in wp-content/plugins/hermit/class.json.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/hermit/include/help.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/hermit/hermit.php:12
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/hermit/include/library.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/hermit/include/template.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
2 plugin tags: flash, html5

hermit/hermit.php Passed 13 tests

The main PHP script in "Hermit 音乐播放器" version 3.1.6 is automatically included on every request by WordPress
55 characters long description:
音乐播放器 Hermit music player build for wordpress

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin5,648 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript81961513,640
PHP93721,5081,260
CSS312623727
SVG10021

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity74.00
▷ Minimum class complexity41.00
▷ Maximum class complexity121.00
Average method complexity3.30
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods94
▷ Static methods00.00%
▷ Public methods4345.74%
▷ Protected methods00.00%
▷ Private methods5154.26%
Functions3
▷ Named functions266.67%
▷ Anonymous functions133.33%
Constants5
▷ Global constants480.00%
▷ Class constants120.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
11 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/logo.png1.32KB0.73KB▼ 44.52%
assets/images/cover@3x.png4.71KB2.26KB▼ 51.88%
assets/images/logo@2x.png1.76KB1.39KB▼ 20.89%
assets/images/playing_blue.png1.13KB0.23KB▼ 79.31%
assets/images/playing_pink.png1.11KB0.23KB▼ 78.97%