83% pattern

Code Review | Pattern

WordPress plugin Pattern scored83%from 54 tests.

About plugin

  • Plugin page: pattern
  • Plugin version: 1.0.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-5.5
  • WordPress version: 6.3.1
  • First release: Aug 20, 2020
  • Latest release: Nov 3, 2020
  • Number of updates: 17
  • Update frequency: every 4.4 days
  • Top authors: blockhandbook (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /699 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.16MB] [CPU: ▼3.14ms] Passed 4 tests

Analyzing server-side resources used by Pattern
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1642.50 ▲3.46
Dashboard /wp-admin3.46 ▲0.1649.90 ▼3.93
Posts /wp-admin/edit.php3.58 ▲0.2250.29 ▲1.83
Add New Post /wp-admin/post-new.php6.05 ▲0.1690.48 ▼13.21
Media Library /wp-admin/upload.php3.39 ▲0.1537.07 ▲2.74

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 43 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
db_upgraded
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Pattern
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,866 ▲9514.48 ▲0.101.61 ▼0.3941.66 ▼1.59
Dashboard /wp-admin2,261 ▲735.88 ▼0.01105.29 ▼27.5441.52 ▼7.64
Posts /wp-admin/edit.php2,144 ▲522.05 ▲0.0441.17 ▼0.2531.97 ▼1.51
Add New Post /wp-admin/post-new.php1,537 ▲2323.06 ▲5.35620.55 ▼46.3075.31 ▲4.76
Media Library /wp-admin/upload.php1,464 ▲764.20 ▲0.02130.85 ▲20.4449.14 ▲6.32

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
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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 take a closer look at the following
  • 9× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/faq/columns.php:82
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/pricing-table/stacked.php:105
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/faq/blocks.php:140
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/faq/sidebar.php:136
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/pricing-table/cover.php:41
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/pricing-table/simple.php:115
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Pattern\\plugin_dir_path() in wp-content/plugins/pattern/Plugin.php:89
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/faq/side-by-side.php:72
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pattern/includes/block-patterns/pricing-table/floating.php:131

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
6 plugin tags: block patterns, sections, section, pattern, patterns...

pattern/Plugin.php 77% from 13 tests

"Pattern" version 1.0.6's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist
  • Requires PHP: Required version does not match the one declared in readme.txt ("7.0.0" instead of "7.0")
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("pattern.php" instead of "Plugin.php")

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 plugin1,680 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
PHP233894161,324
CSS47838305
Sass251244
JSON1004
JavaScript2393

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity9.62
▷ 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
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods50
▷ Static methods1836.00%
▷ Public methods4896.00%
▷ Protected methods00.00%
▷ Private methods24.00%
Functions2
▷ Named functions150.00%
▷ Anonymous functions150.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
6 PNG files occupy 0.07MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
src/assets/img/faq-blocks-icon-6.png16.96KB4.54KB▼ 73.21%
src/assets/img/faq-blocks-icon-3.png15.31KB4.62KB▼ 69.84%
src/assets/img/faq-blocks-icon-1.png9.29KB1.50KB▼ 83.84%
src/assets/img/faq-blocks-icon-5.png11.59KB2.15KB▼ 81.42%
src/assets/img/faq-blocks-icon-4.png7.92KB1.06KB▼ 86.62%