84% custom-post-type-calculator

Code Review | Custom Post Type Calculator

WordPress plugin Custom Post Type Calculator scored84%from 54 tests.

About plugin

  • Plugin page: custom-post-type-...
  • Plugin version: 0.9
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.3
  • WordPress version: 6.3.1
  • First release: Apr 15, 2015
  • Latest release: Aug 23, 2016
  • Number of updates: 5
  • Update frequency: every 99.4 days
  • Top authors: butterflymedia (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,245 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.09MB] [CPU: ▼5.72ms] Passed 4 tests

This is a short check of server-side resources used by Custom Post Type Calculator
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1138.39 ▼1.95
Dashboard /wp-admin3.40 ▲0.0952.31 ▲4.41
Posts /wp-admin/edit.php3.45 ▲0.0948.47 ▼5.29
Add New Post /wp-admin/post-new.php5.98 ▲0.0986.92 ▼13.34
Media Library /wp-admin/upload.php3.32 ▲0.0937.03 ▼2.31
View Items /wp-admin/edit.php?post_type=items3.3636.86
Add New Item /wp-admin/post-new.php?post_type=items3.3849.67
CPTC Settings /wp-admin/edit.php?post_type=items&page=cptc_admin_page3.2933.58
Item Categories /wp-admin/edit-tags.php?taxonomy=item_category&post_type=items3.3236.81

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 11 new files
Database: no new tables, 15 new options
New WordPress options
theysaidso_admin_options
item_currency
item_show_quote
widget_recent-comments
db_upgraded
item_surface_label
item_contact_section_title
item_admin_email
item_calculate_button_label
item_measurement_label
...

Browser metrics Passed 4 tests

An overview of browser requirements for Custom Post Type Calculator
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,939 ▲17813.81 ▼0.4210.60 ▲8.8836.94 ▼5.81
Dashboard /wp-admin2,230 ▲535.57 ▼0.0683.70 ▼7.8639.29 ▼4.01
Posts /wp-admin/edit.php2,132 ▲292.00 ▲0.0639.48 ▼0.3336.98 ▼1.32
Add New Post /wp-admin/post-new.php1,555 ▲2723.05 ▼0.01662.02 ▼51.2267.78 ▲14.58
Media Library /wp-admin/upload.php1,438 ▲384.21 ▼0.0198.10 ▼2.9642.59 ▼3.05
View Items /wp-admin/edit.php?post_type=items1,1081.9830.5931.25
Add New Item /wp-admin/post-new.php?post_type=items1,7002.5852.7661.04
CPTC Settings /wp-admin/edit.php?post_type=items&page=cptc_admin_page9001.9922.5039.91
Item Categories /wp-admin/edit-tags.php?taxonomy=item_category&post_type=items1,3122.1230.9637.68

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin did not uninstall successfully, leaving 15 options in the database
    • item_show_quote
    • item_calculate_button_label
    • item_contact_button_label
    • widget_recent-posts
    • item_surface_label
    • widget_theysaidso_widget
    • item_currency
    • item_measurement_label
    • theysaidso_admin_options
    • item_result_label
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_URL - assumed 'WP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/custom-post-type-calculator/cpt-calculator.php on line 27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/custom-post-type-calculator/cpt-calculator.php:27

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
3 plugin tags: cpt, calculator, custom post type

custom-post-type-calculator/cpt-calculator.php 85% from 13 tests

The principal PHP file in "Custom Post Type Calculator" v. 0.9 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("custom-post-type-calculator.php" instead of "cpt-calculator.php")
  • Description: Please keep the plugin description shorter than 140 characters (currently 161 characters long)

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
Good job! No executable or dangerous file extensions detected1,270 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
CSS1126109811
PHP27528310
PO File25050134
JavaScript11015

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG files were detected