78% units

Code Review | Units

WordPress plugin Units scored78%from 54 tests.

About plugin

  • Plugin page: units
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.3
  • WordPress version: 6.3.1
  • First release: Feb 24, 2015
  • Latest release: Aug 21, 2015
  • Number of updates: 17
  • Update frequency: every 10.5 days
  • Top authors: kylephillips (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,492 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.15MB] [CPU: ▼6.35ms] Passed 4 tests

A check of server-side resources used by Units
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.61 ▲0.1539.51 ▲3.67
Dashboard /wp-admin3.51 ▲0.1644.35 ▼15.84
Posts /wp-admin/edit.php3.56 ▲0.2048.05 ▲1.38
Add New Post /wp-admin/post-new.php6.04 ▲0.1689.31 ▼14.60
Media Library /wp-admin/upload.php3.37 ▲0.1438.21 ▲4.34
Units /wp-admin/options-general.php?page=unit-switcher3.3529.98

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 79 new files
Database: no new tables, 10 new options
New WordPress options
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
unitswitcher_cache
can_compress_scripts
unitswitcher_save
db_upgraded
unitswitcher_dependencies
unitswitcher_units

Browser metrics Passed 4 tests

A check of browser resources used by Units
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,920 ▲17413.91 ▼0.3512.46 ▲10.5439.57 ▼0.56
Dashboard /wp-admin2,203 ▲265.55 ▼0.1082.85 ▼2.6339.72 ▼9.30
Posts /wp-admin/edit.php2,114 ▲142.02 ▲0.0141.98 ▲0.8436.26 ▲1.08
Add New Post /wp-admin/post-new.php1,536 ▲722.93 ▼0.65592.44 ▼7.6350.28 ▼8.49
Media Library /wp-admin/upload.php1,414 ▲144.21 ▼0.05100.68 ▼7.1943.65 ▼3.33
Units /wp-admin/options-general.php?page=unit-switcher9451.7024.8229.43

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
The following items require your attention
  • The uninstall procedure has failed, leaving 10 options in the database
    • unitswitcher_save
    • unitswitcher_units
    • can_compress_scripts
    • unitswitcher_cache
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • unitswitcher_dependencies
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=unit-switcher
    • > Warning in wp-content/plugins/units/app/Helpers.php+47
    file_get_contents(wp-content/plugins/units/assets/js/src/dropdown.js): failed to open stream: No such file or directory

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 32× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/units/vendor/composer/installers/src/Composer/Installers/CroogoInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\Test\\TestCase' not found in wp-content/plugins/units/vendor/composer/installers/tests/Composer/Installers/Test/InstallerTest.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/units/vendor/composer/installers/src/Composer/Installers/TYPO3FlowInstaller.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/units/vendor/composer/installers/src/Composer/Installers/KohanaInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/units/vendor/composer/installers/src/Composer/Installers/WordPressInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installer\\LibraryInstaller' not found in wp-content/plugins/units/vendor/composer/installers/src/Composer/Installers/Installer.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/units/app/Views/settings/settings-units.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/units/app/Views/settings/settings.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/units/vendor/composer/installers/src/Composer/Installers/MakoInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/units/vendor/composer/installers/src/Composer/Installers/FuelInstaller.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
3 plugin tags: measurements, localization, units

units/units.php 92% from 13 tests

Analyzing the main PHP file in "Units" version 1.0.2
Please take the time to fix the following:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected2,418 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
PHP593626491,855
JavaScript54272218
JSON300139
Markdown1320130
CSS31045
XML12023
YAML1308

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity3.77
▷ Minimum class complexity1.00
▷ Maximum class complexity37.00
Average method complexity2.02
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces10
Interfaces0
Traits0
Classes47
▷ Abstract classes24.26%
▷ Concrete classes4595.74%
▷ Final classes00.00%
Methods129
▷ Static methods96.98%
▷ Public methods9875.97%
▷ Protected methods96.98%
▷ Private methods2217.05%
Functions8
▷ Named functions675.00%
▷ Anonymous functions225.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/caret.png1.06KB0.16KB▼ 85.12%
assets/images/caret-up.png0.98KB0.17KB▼ 83.08%