10% get-first-image-set-as-featured-image

Code Review | Get First Image Set As Featured Image

WordPress plugin Get First Image Set As Featured Image scored10%from 54 tests.

About plugin

  • Plugin page: get-first-image-s...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 1.0-4.9
  • WordPress version: 6.3.1
  • First release: Dec 28, 2015
  • Latest release: Mar 19, 2018
  • Number of updates: 15
  • Update frequency: every 54.4 days
  • Top authors: mynamevenu24 (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

100+ active /10,257 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
You still need to fix the following installer errors
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/get-first-image-set-as-featured-image/get_first_image_set_as_featured_image.php+102
    Undefined index: post

Server metrics [RAM: ▼1.93MB] [CPU: ▼53.67ms] Passed 4 tests

An overview of server-side resources used by Get First Image Set As Featured Image
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.06 ▼1.405.14 ▼35.74
Dashboard /wp-admin2.08 ▼1.225.42 ▼46.43
Posts /wp-admin/edit.php2.08 ▼1.286.22 ▼45.29
Add New Post /wp-admin/post-new.php2.08 ▼3.816.92 ▼87.23
Media Library /wp-admin/upload.php2.08 ▼1.156.54 ▼26.66

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 3 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

Get First Image Set As Featured Image: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲2913.26 ▼1.131.81 ▼0.1243.74 ▲1.84
Dashboard /wp-admin2,206 ▲214.87 ▼0.9898.54 ▼1.3639.72 ▼5.47
Posts /wp-admin/edit.php2,089 ▼02.04 ▼0.0140.56 ▼1.2832.89 ▼7.12
Add New Post /wp-admin/post-new.php1,514 ▼017.60 ▼5.88622.10 ▲31.0254.66 ▼12.01
Media Library /wp-admin/upload.php1,382 ▼64.17 ▲0.0199.44 ▼19.3944.58 ▼1.95

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/get-first-image-set-as-featured-image/get_first_image_set_as_featured_image.php+102
    Undefined index: post
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% 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
Almost there! Just fix the following items
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post() in wp-content/plugins/get-first-image-set-as-featured-image/get_first_image_set_as_featured_image.php:17

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 on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need your attention:
  • Screenshots: Screenshot #1 (Get Image from content set as featured image automatically) image not found
Please take inspiration from this readme.txt

get-first-image-set-as-featured-image/get_first_image_set_as_featured_image.php 92% from 13 tests

"Get First Image Set As Featured Image" version 1.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("get-first-image-set-as-featured-image.php" instead of "get_first_image_set_as_featured_image.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
There were no executable files found in this plugin54 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1232954

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.63MB with 0.46MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png640.48KB169.36KB▼ 73.56%