90% wp-primary-category

Code Review | WordPress Primary Category

WordPress plugin WordPress Primary Category scored90%from 54 tests.

About plugin

  • Plugin page: wp-primary-category
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-4.9.8
  • WordPress version: 6.3.1
  • First release: Dec 14, 2018
  • Latest release: Dec 23, 2018
  • Number of updates: 6
  • Update frequency: every 1.5 days
  • Top authors: airesvsg (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /792 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼2.53ms] Passed 4 tests

Server-side resources used by WordPress Primary Category
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0145.81 ▲1.84
Dashboard /wp-admin3.32 ▲0.0148.28 ▼0.74
Posts /wp-admin/edit.php3.43 ▲0.0847.64 ▼0.82
Add New Post /wp-admin/post-new.php5.90 ▲0.0194.47 ▼9.74
Media Library /wp-admin/upload.php3.24 ▲0.0136.15 ▲1.18
Primary Category /wp-admin/options-general.php?page=wp-primary-category3.2536.48

Server storage [IO: ▲0.03MB] [DB: ▲0.07MB] Passed 3 tests

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

Browser metrics Passed 4 tests

An overview of browser requirements for WordPress Primary Category
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,822 ▲3613.23 ▼1.152.17 ▲0.0540.61 ▼3.67
Dashboard /wp-admin2,228 ▲224.80 ▼0.18111.82 ▲6.2243.37 ▼2.46
Posts /wp-admin/edit.php2,104 ▲42.01 ▼0.0238.33 ▲0.3738.62 ▼0.11
Add New Post /wp-admin/post-new.php1,551 ▲2023.18 ▼0.05675.82 ▲15.7658.71 ▲8.61
Media Library /wp-admin/upload.php1,404 ▲104.31 ▲0.14110.07 ▲10.2147.62 ▲2.77
Primary Category /wp-admin/options-general.php?page=wp-primary-category7982.0224.8329.89

Uninstaller [IO: ▲0.00MB] [DB: ▲0.07MB] 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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
6 plugin tags: taxonomy, primary, tax, select, cat...

wp-primary-category/plugin.php 92% from 13 tests

The main PHP script in "WordPress Primary Category" version 1.1.0 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("wp-primary-category.php" instead of "plugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin810 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP1011010493
Markdown1440211
JavaScript115081
CSS12019
XML1006

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity14.20
▷ Minimum class complexity1.00
▷ Maximum class complexity28.00
Average method complexity2.83
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods36
▷ Static methods36100.00%
▷ Public methods2980.56%
▷ Protected methods00.00%
▷ Private methods719.44%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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
No PNG files were detected