84% import-youtube-videos-as-wp-post

Code Review | Import YouTube videos as WP Posts

WordPress plugin Import YouTube videos as WP Posts scored84%from 54 tests.

About plugin

  • Plugin page: import-youtube-vi...
  • Plugin version: 2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.9
  • WordPress version: 6.3.1
  • First release: Nov 11, 2015
  • Latest release: Dec 11, 2017
  • Number of updates: 29
  • Update frequency: every 26.2 days
  • Top authors: enguerranws (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

100+ active /16,003 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.04MB] [CPU: ▼3.04ms] Passed 4 tests

Analyzing server-side resources used by Import YouTube videos as WP Posts
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0436.91 ▼1.56
Dashboard /wp-admin3.35 ▲0.0546.44 ▼4.25
Posts /wp-admin/edit.php3.40 ▲0.0451.02 ▼2.65
Add New Post /wp-admin/post-new.php5.93 ▲0.0493.57 ▼3.70
Media Library /wp-admin/upload.php3.27 ▲0.0434.93 ▼0.61
Youtube importer /wp-admin/options-general.php?page=yt-to-posts3.3036.27

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 665 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by Import YouTube videos as WP Posts
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲8313.19 ▼0.834.75 ▲3.0240.23 ▼5.64
Dashboard /wp-admin2,224 ▲364.85 ▼1.04108.79 ▼2.7743.44 ▼2.50
Posts /wp-admin/edit.php2,107 ▲152.07 ▲0.0740.54 ▼0.2037.67 ▲0.85
Add New Post /wp-admin/post-new.php1,529 ▼417.54 ▼5.69698.98 ▲31.2254.67 ▲0.56
Media Library /wp-admin/upload.php1,409 ▲184.22 ▲0.0196.69 ▼6.1341.76 ▼0.86
Youtube importer /wp-admin/options-general.php?page=yt-to-posts9462.0321.4628.69

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
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 75% 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 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
Please fix the following
  • 454× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\TestCase' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/monolog/monolog/tests/Monolog/Processor/GitProcessorTest.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/monolog/monolog/tests/Monolog/Formatter/NormalizerFormatterTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Google_Model' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/google/apiclient-services/src/Google/Service/YouTube/IngestionInfo.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Google_Collection' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/google/apiclient-services/src/Google/Service/YouTube/VideoGetRatingResponse.php:18
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\RequestInterface' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/psr/http-message/src/ServerRequestInterface.php:43
    • > PHP Fatal error
      Uncaught Error: Class 'Google_Model' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/google/apiclient-services/src/Google/Service/YouTube/LiveChatBanSnippet.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/monolog/monolog/tests/Monolog/Formatter/MongoDBFormatterTest.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Google_Model' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/google/apiclient-services/src/Google/Service/YouTube/LocalizedString.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'Google_Service_Resource' not found in wp-content/plugins/import-youtube-videos-as-wp-post/vendor/google/apiclient-services/src/Google/Service/YouTube/Resource/I18nRegions.php:26

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Plugin Name: Please specify the plugin name on the first line ( === import-youtube-videos-as-wp-post === )
You can look at the official readme.txt

import-youtube-videos-as-wp-post/import-youtube-videos-as-wp-post.php Passed 13 tests

This is the main PHP file of "Import YouTube videos as WP Posts" version 2.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
127 characters long description:
Get a video list from a request to Youtube (free query, playlist ID, channel ID) and add their content to your own Wordpress :)

Code Analysis 97% from 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
Everything looks great! No dangerous files found in this plugin66,649 lines of code in 632 files:
LanguageFilesBlank linesComment linesLines of code
PHP5779,75132,78860,080
Markdown291,42704,637
JSON16001,181
PO File2128190375
JavaScript1381227
CSS15361
XML33043
YAML29036
make1409

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 104)
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity10.32
▷ Minimum class complexity1.00
▷ Maximum class complexity592.00
Average method complexity2.17
▷ Minimum method complexity1.00
▷ Maximum method complexity104.00
Code structure
Namespaces38
Interfaces25
Traits5
Classes570
▷ Abstract classes101.75%
▷ Concrete classes56098.25%
▷ Final classes91.61%
Methods4,835
▷ Static methods1322.73%
▷ Public methods4,38390.65%
▷ Protected methods2044.22%
▷ Private methods2485.13%
Functions256
▷ Named functions8432.81%
▷ Anonymous functions17267.19%
Constants322
▷ Global constants216.52%
▷ Class constants30193.48%
▷ Public constants301100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
img/logo-t2p.png3.29KB1.56KB▼ 52.74%