78% magic-food

Code Review | Magic Food

WordPress plugin Magic Food scored78%from 54 tests.

About plugin

  • Plugin page: magic-food
  • Plugin version: 5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.6
  • WordPress version: 6.3.1
  • First release: Nov 20, 2016
  • Latest release: Feb 20, 2021
  • Number of updates: 43
  • Update frequency: every 36.0 days
  • Top authors: oleksandr87 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

90+ active /3,812 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼0.52ms] Passed 4 tests

An overview of server-side resources used by Magic Food
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.74 ▲0.0151.55 ▲5.70
Dashboard /wp-admin3.57 ▲0.0159.28 ▲6.36
Posts /wp-admin/edit.php3.68 ▲0.0057.23 ▲1.97
Add New Post /wp-admin/post-new.php6.15 ▲0.0087.11 ▼11.49
Media Library /wp-admin/upload.php3.49 ▲0.0042.54 ▲1.72

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 36 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Magic Food
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,900 ▲15413.54 ▼0.8112.07 ▲10.4154.09 ▲13.52
Dashboard /wp-admin2,195 ▲185.62 ▲0.0188.74 ▼4.0638.44 ▼15.93
Posts /wp-admin/edit.php2,100 ▼32.02 ▼0.0239.30 ▼3.5635.71 ▼2.43
Add New Post /wp-admin/post-new.php1,536 ▲1023.33 ▲5.86644.86 ▼22.3850.35 ▼2.19
Media Library /wp-admin/upload.php1,394 ▼94.16 ▼0.06103.35 ▼5.8844.90 ▼1.44

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
Please fix the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/magic-food/libs/export/exportToJSON.php
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/magic-food/magicfood_welcome.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/magic-food/magicfood_pc.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/magic-food/magicfood_game.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/magic-food/index.php:42

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention:
  • Screenshots: Screenshot #1 (Screenshot 1) image required
Please take inspiration from this readme.txt

magic-food/index.php 92% from 13 tests

The main PHP file in "Magic Food" ver. 5.1 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("magic-food.php" instead of "index.php")

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
There were no executable files found in this plugin3,340 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP83657203,008
Markdown51240283
JSON20029
XML10020

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity67.50
▷ Minimum class complexity1.00
▷ Maximum class complexity134.00
Average method complexity4.69
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods36
▷ Static methods925.00%
▷ Public methods3391.67%
▷ Protected methods25.56%
▷ Private methods12.78%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants00.00%
▷ Class constants9100.00%
▷ Public constants9100.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
17 PNG files occupy 0.43MB with 0.22MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/b7.png31.09KB13.88KB▼ 55.36%
images/b6.png28.76KB14.18KB▼ 50.71%
images/b4.png27.91KB13.44KB▼ 51.83%
images/b5.png32.03KB14.37KB▼ 55.15%
images/a2.png2.66KB1.57KB▼ 40.89%