10% beer-ratings

Code Review | Beer Ratings

WordPress plugin Beer Ratings scored10%from 54 tests.

About plugin

  • Plugin page: beer-ratings
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.4
  • WordPress version: 6.3.1
  • First release: Jul 15, 2012
  • Latest release: Jul 20, 2012
  • Number of updates: 13
  • Update frequency: every 0.4 days
  • Top authors: jamesewelch (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,822 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Deprecated in wp-content/plugins/beer-ratings/includes/BeerRatings.php+20
    Methods with the same name as their class will not be constructors in a future version of PHP; BeerRatings has a deprecated constructor

Server metrics [RAM: ▼1.84MB] [CPU: ▼53.04ms] Passed 4 tests

This is a short check of server-side resources used by Beer Ratings
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.14 ▼1.324.36 ▼41.87
Dashboard /wp-admin2.16 ▼1.145.27 ▼44.36
Posts /wp-admin/edit.php2.16 ▼1.197.09 ▼40.65
Add New Post /wp-admin/post-new.php2.16 ▼3.726.08 ▼85.29
Media Library /wp-admin/upload.php2.16 ▼1.066.12 ▼29.92
Beer Ratings /wp-admin/options-general.php?page=beerratings-settings2.165.77

Server storage [IO: ▲0.30MB] [DB: ▲0.01MB] Passed 3 tests

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 33 new files
Database: no new tables, 41 new options
New WordPress options
beerratings_ratebeer_copyrightlink
beerratings_brewerlist_header
beerratings_beerlist_item
beerratings_placelist_footer
widget_recent-posts
beerratings_beerlist_top50_footer
beerratings_beerlist_bystyle_item
beerratings_placelist_header
beerratings_beerreviewlist_header
beerratings_cachetime
...

Browser metrics Passed 4 tests

An overview of browser requirements for Beer Ratings
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,814 ▲6813.31 ▼1.074.77 ▲2.8839.20 ▼0.99
Dashboard /wp-admin2,217 ▲295.81 ▲0.94106.46 ▼4.5941.48 ▼5.41
Posts /wp-admin/edit.php2,105 ▲192.02 ▲0.0342.47 ▲5.2335.68 ▲0.31
Add New Post /wp-admin/post-new.php1,527 ▼617.56 ▼5.69682.37 ▲5.6450.68 ▼9.28
Media Library /wp-admin/upload.php1,405 ▲174.22 ▼0.04100.74 ▼12.9445.41 ▼3.23
Beer Ratings /wp-admin/options-general.php?page=beerratings-settings9812.0524.1532.19

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/beer-ratings/includes/BeerRatings.php+20
    Methods with the same name as their class will not be constructors in a future version of PHP; BeerRatings has a deprecated constructor
  • The uninstall procedure has failed, leaving 11 options in the database
    • beerratings_beerlist_bestbyseason_item
    • beerratings_beerlist_bestbycountry_header
    • beerratings_beerlist_bestbyseason_header
    • beerratings_beerlist_bestbycountry_footer
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • beerratings_beerlist_bestbycountry_item
    • widget_recent-comments
    • db_upgraded
    • ...

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-content/plugins/beer-ratings/includes/BeerRatings.php+20
    Methods with the same name as their class will not be constructors in a future version of PHP; BeerRatings has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-content/plugins/beer-ratings/includes/BeerRatings_CacheManager.php+19
    Methods with the same name as their class will not be constructors in a future version of PHP; BeerRatings_CacheManager has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-content/plugins/beer-ratings/includes/RateBeer/RateBeer.php+19
    Methods with the same name as their class will not be constructors in a future version of PHP; RateBeer has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method BeerRatings::admin_menu() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method BeerRatings::admin_enqueue_scripts() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method BeerRatings::admin_notice() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method BeerRatings_Settings::plugin_options() should not be called statically
    • > GET request to /wp-admin/options-general.php?page=beerratings-settings
    • > Deprecated in wp-content/plugins/beer-ratings/includes/BeerRatings_Settings.php+64
    Non-static method BeerRatings_Settings::settings_tabs() should not be called statically

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 8× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/beer-ratings/assets/html/index.php
    • > /wp-content/plugins/beer-ratings/includes/index.php
    • > /wp-content/plugins/beer-ratings/assets/images/index.php
    • > /wp-content/plugins/beer-ratings/assets/index.php
    • > /wp-content/plugins/beer-ratings/cache/index.php
    • > /wp-content/plugins/beer-ratings/assets/js/index.php
    • > /wp-content/plugins/beer-ratings/assets/css/index.php
    • > /wp-content/plugins/beer-ratings/includes/RateBeer/index.php
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'RateBeer' not found in wp-content/plugins/beer-ratings/includes/RateBeer/RateBeer_Beer_Review.php:19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/beer-ratings/index.php:46
    • > PHP Fatal error
      Uncaught Error: Class 'RateBeer' not found in wp-content/plugins/beer-ratings/includes/RateBeer/RateBeer_Brewer.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'RateBeer' not found in wp-content/plugins/beer-ratings/includes/RateBeer/RateBeer_Place.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'RateBeer' not found in wp-content/plugins/beer-ratings/includes/RateBeer/RateBeer_Beer.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need your attention:
  • Screenshots: Add images for these screenshots: #1 (Example listing of 2 beers), #2 (Example listing of Best Beer by Style), #3 (Example listing of all beers by specific brewer), #4 (Settings tab of options page), #5 (Format/Layouts tab of options page showing header, footer, item)
The official readme.txt is a good inspiration

beer-ratings/index.php 92% from 13 tests

This is the main PHP file of "Beer Ratings" version 1.0.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("beer-ratings.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Good job! No executable or dangerous file extensions detected4,792 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP125556193,170
HTML229351,546
CSS19069
JavaScript1417

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity46.00
▷ Minimum class complexity2.00
▷ Maximum class complexity185.00
Average method complexity6.70
▷ Minimum method complexity1.00
▷ Maximum method complexity80.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes10
▷ Abstract classes00.00%
▷ Concrete classes10100.00%
▷ Final classes00.00%
Methods79
▷ Static methods00.00%
▷ Public methods79100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
9 PNG files occupy 0.08MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png7.79KB5.64KB▼ 27.64%
assets/images/arrows-dark.png0.48KB0.24KB▼ 51.11%
screenshot-5.png24.85KB12.50KB▼ 49.68%
screenshot-1.png13.93KB11.40KB▼ 18.18%
assets/images/ratebeer-api-tiny.png0.48KB0.43KB▼ 10.82%