78% copy-to-clipboard-for-wp

Code Review | Copy to Clipboard for WordPress

WordPress plugin Copy to Clipboard for WordPress scored78%from 54 tests.

About plugin

  • Plugin page: copy-to-clipboard...
  • Plugin version: 1.2.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.4
  • WordPress version: 6.3.1
  • First release: Jun 7, 2023
  • Latest release: Nov 9, 2023
  • Number of updates: 14
  • Update frequency: every 11.2 days
  • Top authors: noruzzaman (100%)

Code review

54 tests

User reviews

1 review

Install metrics

80+ active /807 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.23MB] [CPU: ▼4.23ms] Passed 4 tests

A check of server-side resources used by Copy to Clipboard for WordPress
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.75 ▲0.2937.67 ▼1.81
Dashboard /wp-admin3.57 ▲0.2250.41 ▼12.76
Posts /wp-admin/edit.php3.62 ▲0.2649.84 ▲4.33
Add New Post /wp-admin/post-new.php6.11 ▲0.2387.26 ▼6.68
Media Library /wp-admin/upload.php3.43 ▲0.2038.68 ▲4.37
Help /wp-admin/edit.php?post_type=copy_to_clipboard&page=help6.5644.87
Add New /wp-admin/post-new.php?post_type=copy_to_clipboard3.8757.86
All Items /wp-admin/edit.php?post_type=copy_to_clipboard3.8644.70

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 210 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

Copy to Clipboard for WordPress: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,928 ▲15613.35 ▼0.978.33 ▲6.2839.20 ▼3.33
Dashboard /wp-admin2,247 ▲705.59 ▼0.0684.28 ▼17.1439.19 ▼4.10
Posts /wp-admin/edit.php2,152 ▲522.00 ▲0.0341.60 ▲3.6535.06 ▲1.43
Add New Post /wp-admin/post-new.php1,556 ▲1823.34 ▲0.27676.74 ▼35.4751.24 ▼9.90
Media Library /wp-admin/upload.php1,455 ▲524.25 ▲0.0595.76 ▼4.7640.66 ▼6.40
Help /wp-admin/edit.php?post_type=copy_to_clipboard&page=help1,0773.7047.5934.49
Add New /wp-admin/post-new.php?post_type=copy_to_clipboard8,9775.23479.8956.54
All Items /wp-admin/edit.php?post_type=copy_to_clipboard1,3423.9548.9326.74

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
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/copy-to-clipboard-for-wp/admin/partials/catcwp-admin-display.php
    • > /wp-content/plugins/copy-to-clipboard-for-wp/public/partials/catcwp-public-display.php
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/copy-to-clipboard-for-wp/includes/class-catcwp-custom-post.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/copy-to-clipboard-for-wp/functions.php:13
    • > PHP Warning
      require_once(wp-content/plugins/copy-to-clipboard-for-wp/vendor/appsero/client/vendor/tareq1988/wp-php-cs-fixer/loader.php): failed to open stream: No such file or directory in wp-content/plugins/copy-to-clipboard-for-wp/vendor/appsero/client/.php-cs-fixer.dist.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/copy-to-clipboard-for-wp/widgets/catcwp-widget.php:9
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/copy-to-clipboard-for-wp/vendor/appsero/client/vendor/tareq1988/wp-php-cs-fixer/loader.php' (include_path='.:/usr/share/php') in wp-content/plugins/copy-to-clipboard-for-wp/vendor/appsero/client/.php-cs-fixer.dist.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/copy-to-clipboard-for-wp/widgets/catcwp-copy-widget.php:3

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)
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
6 plugin tags: clipboard, paste, copy to clipboard, content sharing, copy...

copy-to-clipboard-for-wp/catcwp.php 77% from 13 tests

The main PHP script in "Copy to Clipboard for WordPress" version 1.2.0 is automatically included on every request by WordPress
It is important to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Description: The description should be shorter than 140 characters (currently 150 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("copy-to-clipboard-for-wp.php" instead of "catcwp.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin42,188 lines of code in 175 files:
LanguageFilesBlank linesComment linesLines of code
PHP1184,1372,93217,926
JavaScript71,3255316,662
PO File203,1983,5916,500
Sass1697035,674
CSS63785174,915
Markdown1820255
JSON300127
XML161195
YAML16032
SVG2002

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.56
Average class complexity23.89
▷ Minimum class complexity1.00
▷ Maximum class complexity151.00
Average method complexity5.47
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes80
▷ Abstract classes22.50%
▷ Concrete classes7897.50%
▷ Final classes00.00%
Methods411
▷ Static methods6315.33%
▷ Public methods36789.29%
▷ Protected methods81.95%
▷ Private methods368.76%
Functions36
▷ Named functions3597.22%
▷ Anonymous functions12.78%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.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
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
libs/codestar-framework/assets/images/checkerboard.png2.29KB2.54KB0.00%