77% snillrik-restaurant-menu

Code Review | Snillrik Restaurant

WordPress plugin Snillrik Restaurant scored77%from 54 tests.

About plugin

  • Plugin page: snillrik-restaura...
  • Plugin version: 2.1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.2-6.2
  • WordPress version: 6.3.1
  • First release: Feb 20, 2019
  • Latest release: Apr 26, 2023
  • Number of updates: 34
  • Update frequency: every 44.9 days
  • Top authors: mattiaspkallio (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,056 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.25MB] [CPU: ▼2.20ms] Passed 4 tests

An overview of server-side resources used by Snillrik Restaurant
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.72 ▲0.2541.37 ▼0.35
Dashboard /wp-admin3.55 ▲0.2547.38 ▼4.28
Posts /wp-admin/edit.php3.66 ▲0.3153.75 ▲7.93
Add New Post /wp-admin/post-new.php6.15 ▲0.2684.61 ▼10.97
Media Library /wp-admin/upload.php3.47 ▲0.2440.12 ▲6.82
All Menus /wp-admin/edit.php?post_type=snillrik_lm_menu3.5239.37
All dishes /wp-admin/edit.php?post_type=snillrik_lm_dish3.5236.56
Add new /wp-admin/post-new.php?post_type=snillrik_lm_menu3.7054.64
Add new /wp-admin/post-new.php?post_type=snillrik_lm_dish3.6856.18
Dish Tags /wp-admin/edit-tags.php?taxonomy=dishes-tags&post_type=snillrik_lm_dish3.4735.16
Dish cat /wp-admin/edit-tags.php?taxonomy=dishes-category&post_type=snillrik_lm_dish3.4735.59

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 20 new files
Database: no new tables, 7 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-comments
widget_recent-posts
widget_snillrik_restaurant_dish_widget
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for Snillrik Restaurant
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,940 ▲19414.35 ▼0.021.70 ▲0.1041.36 ▲1.98
Dashboard /wp-admin2,328 ▲1485.66 ▲0.0384.86 ▼2.7774.50 ▲28.81
Posts /wp-admin/edit.php2,254 ▲1542.18 ▲0.1436.15 ▼0.1434.96 ▲1.48
Add New Post /wp-admin/post-new.php1,659 ▲13121.05 ▼2.25660.33 ▼27.1140.87 ▼9.95
Media Library /wp-admin/upload.php1,548 ▲1454.16 ▼0.0899.90 ▲5.1887.69 ▲45.28
All Menus /wp-admin/edit.php?post_type=snillrik_lm_menu1,2662.1331.8430.11
All dishes /wp-admin/edit.php?post_type=snillrik_lm_dish1,2712.1432.6830.45
Add new /wp-admin/post-new.php?post_type=snillrik_lm_menu3,3389.10198.84147.23
Add new /wp-admin/post-new.php?post_type=snillrik_lm_dish3,4099.30205.49118.50
Dish Tags /wp-admin/edit-tags.php?taxonomy=dishes-tags&post_type=snillrik_lm_dish1,3972.2829.7032.86
Dish cat /wp-admin/edit-tags.php?taxonomy=dishes-category&post_type=snillrik_lm_dish1,4282.2828.5930.21

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
These items require your attention
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_snillrik_restaurant_dish_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts

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
Good news, no errors were detected

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 4× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/snillrik-restaurant-menu/classes/menu.php
    • > /wp-content/plugins/snillrik-restaurant-menu/classes/settings.php
    • > /wp-content/plugins/snillrik-restaurant-menu/classes/shortcodes.php
    • > /wp-content/plugins/snillrik-restaurant-menu/classes/dish.php
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/snillrik-restaurant-menu/snillrik_restaurant.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/snillrik-restaurant-menu/classes/widgets.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed: The official readme.txt might help

snillrik-restaurant-menu/snillrik_restaurant.php 77% from 13 tests

The main file in "Snillrik Restaurant" v. 2.1.2 serves as a complement to information provided in readme.txt and as the entry point to the plugin
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("snillrik-restaurant-menu.php" instead of "snillrik_restaurant.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Requires at least: Required version must match the one declared in readme.txt ("3.0" instead of "4.5.2")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin1,750 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP613193809
SVG252484
CSS3467243
PO File16365166
JavaScript213448

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.33
Average class complexity19.40
▷ Minimum class complexity5.00
▷ Maximum class complexity51.00
Average method complexity4.60
▷ Minimum method complexity1.00
▷ Maximum method complexity22.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods26
▷ Static methods311.54%
▷ Public methods26100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions480.00%
▷ Anonymous functions120.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
3 PNG files occupy 0.13MB with 0.10MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/snillrik_medium.png46.02KB8.39KB▼ 81.77%
images/dudes.png38.74KB16.98KB▼ 56.18%
images/snillrik_small.png47.32KB4.84KB▼ 89.77%