84% block-context

Code Review | Block Context

WordPress plugin Block Context scored84%from 54 tests.

About plugin

  • Plugin page: block-context
  • Plugin version: 0.1.0
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.7
  • WordPress version: 6.3.1
  • First release: Mar 4, 2019
  • Latest release: May 7, 2021
  • Number of updates: 4
  • Update frequency: every 199.0 days
  • Top authors: kasparsd (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,918 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.09MB] [CPU: ▼0.42ms] Passed 4 tests

A check of server-side resources used by Block Context
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.1135.60 ▼3.33
Dashboard /wp-admin3.39 ▲0.0953.35 ▲5.45
Posts /wp-admin/edit.php3.50 ▲0.1549.46 ▲0.55
Add New Post /wp-admin/post-new.php5.96 ▲0.0899.63 ▲2.38
Media Library /wp-admin/upload.php3.31 ▲0.0834.79 ▼1.28

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 22 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Block Context
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.29 ▼1.341.69 ▼0.0939.99 ▼5.37
Dashboard /wp-admin2,209 ▲215.90 ▲1.08107.17 ▼11.2235.81 ▼13.90
Posts /wp-admin/edit.php2,092 ▲31.99 ▼0.0239.66 ▲2.7536.24 ▼1.40
Add New Post /wp-admin/post-new.php1,673 ▲15921.17 ▲3.60636.51 ▼40.3551.11 ▼0.19
Media Library /wp-admin/upload.php1,391 ▲64.21 ▼0.1897.24 ▼3.3642.13 ▼3.65

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
The following issues need your attention
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'Preseto\\BlockContext\\Contexts\\Context' not found in wp-content/plugins/block-context/php/Contexts/ContextRule.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Preseto\\BlockContext\\wp_upload_dir() in wp-content/plugins/block-context/php/Plugin.php:41
    • > PHP Fatal error
      Uncaught Error: Class 'Preseto\\BlockContext\\Contexts\\Context' not found in wp-content/plugins/block-context/php/Contexts/UserLoggedIn.php:8

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 Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: blocks, formatting, visibility, gutenberg, block

block-context/block-context.php Passed 13 tests

The principal PHP file in "Block Context" v. 0.1.0 is loaded by WordPress automatically on each request
40 characters long description:
Hide Gutenberg editor blocks in context.

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
Success! There were no dangerous files found in this plugin603 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
PHP16178434601
JSON1001
JavaScript1001

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity8.18
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.41
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes11
▷ Abstract classes19.09%
▷ Concrete classes1090.91%
▷ Final classes00.00%
Methods59
▷ Static methods35.08%
▷ Public methods5898.31%
▷ Protected methods00.00%
▷ Private methods11.69%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG files were detected