84% smart-grid

Code Review | Smart Grid

WordPress plugin Smart Grid scored 84% from 54 tests.

About plugin

  • Plugin page: smart-grid
  • Plugin version: 1.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.1.1
  • WordPress version: 6.3.1
  • First release: May 3, 2019
  • Latest release: Oct 27, 2019
  • Number of updates: 15
  • Update frequency: every 11.9 days
  • Top authors: smartsoftcode (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active / 758 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.18MB] [CPU: ▼0.59ms] Passed 4 tests

A check of server-side resources used by Smart Grid
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0841.99 ▼3.88
Dashboard /wp-admin3.54 ▲0.2354.81 ▲3.22
Posts /wp-admin/edit.php3.58 ▲0.2353.97 ▲4.66
Add New Post /wp-admin/post-new.php6.11 ▲0.2287.99 ▼2.29
Media Library /wp-admin/upload.php3.43 ▲0.2038.32 ▲0.58
Portfolio Categories /wp-admin/edit-tags.php?taxonomy=portfolio_category&post_type=portfolio3.4643.96
Smart Grid Settins /wp-admin/edit.php?post_type=portfolio&page=grid_settings3.4335.61
portfolio /wp-admin/edit.php?post_type=portfolio3.5042.84
Add New portfolio /wp-admin/post-new.php?post_type=portfolio3.9255.85

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 360 new files
Database: no new tables, 9 new options
New WordPress options
db_upgraded
widget_recent-comments
widget_recent-posts
wp_grid
post_grid
can_compress_scripts
theysaidso_admin_options
P_grid
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Smart Grid
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,143 ▲35415.65 ▲0.928.92 ▲6.9960.15 ▲14.55
Dashboard /wp-admin2,407 ▲2016.70 ▲1.85122.71 ▲7.9940.64 ▼3.54
Posts /wp-admin/edit.php2,313 ▲2213.60 ▲1.5755.24 ▲19.3432.88 ▼3.43
Add New Post /wp-admin/post-new.php1,569 ▲4118.63 ▼4.57632.03 ▼58.7834.72 ▼38.85
Media Library /wp-admin/upload.php1,443 ▲554.39 ▲0.1084.82 ▼27.4344.97 ▼9.58
Portfolio Categories /wp-admin/edit-tags.php?taxonomy=portfolio_category&post_type=portfolio1,4923.4145.5330.79
Smart Grid Settins /wp-admin/edit.php?post_type=portfolio&page=grid_settings1,5214.4790.0933.60
portfolio /wp-admin/edit.php?post_type=portfolio1,2773.6046.4228.78
Add New portfolio /wp-admin/post-new.php?post_type=portfolio1,8344.0063.7234.59

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
  • The uninstall procedure has failed, leaving 9 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • wp_grid
    • post_grid
    • P_grid
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
The following issues need your attention
  • 46× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/smart-grid/portfolio-grid.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/smart-grid/lib/includes/types/CMB2_Type_Textarea.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/smart-grid/lib/includes/types/CMB2_Type_Title.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_REST_Controller_Boxes' not found in wp-content/plugins/smart-grid/lib/includes/rest-api/CMB2_REST_Controller_Fields.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Multi_Base' not found in wp-content/plugins/smart-grid/lib/includes/types/CMB2_Type_Radio.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/smart-grid/lib/includes/types/CMB2_Type_Oembed.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/smart-grid/lib/includes/types/CMB2_Type_Checkbox.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/smart-grid/admin/portfolio-meta.php:32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function cmb2_dir() in wp-content/plugins/smart-grid/lib/includes/rest-api/CMB2_REST_Controller.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/smart-grid/includes/portfolio-shortcode.php:70

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 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: portfolio grid, grid view, portfolio, woocommerce grid, post grid

smart-grid/smart-grid.php 92% from 13 tests

The main file in "Smart Grid" v. 1.0.1 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:
  • Description: Keep the plugin description shorter than 140 characters (currently 155 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
No dangerous file extensions were detected47,144 lines of code in 212 files:
LanguageFilesBlank linesComment linesLines of code
PO File12014,31518,50232,323
PHP662,1676,1087,333
CSS151,1721,1594,784
JavaScript83405071,417
SVG100655
Markdown22140632

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity18.93
▷ Minimum class complexity1.00
▷ Maximum class complexity183.00
Average method complexity3.21
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes67
▷ Abstract classes811.94%
▷ Concrete classes5988.06%
▷ Final classes00.00%
Methods539
▷ Static methods8615.96%
▷ Public methods44883.12%
▷ Protected methods8816.33%
▷ Private methods30.56%
Functions33
▷ Named functions3296.97%
▷ Anonymous functions13.03%
Constants14
▷ Global constants857.14%
▷ Class constants642.86%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
14 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
lib/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
lib/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
lib/images/ui-bg_glass_75_e6e6e6_1x400.png0.11KB0.14KB0.00%
lib/images/ui-bg_flat_0_aaaaaa_40x100.png0.18KB0.08KB▼ 51.67%
lib/images/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%