88% featured-image-licence

Code Review | Featured Image Licence

WordPress plugin Featured Image Licence scored 88% from 53 tests.

About plugin

  • Plugin page: featured-image-li...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress version: 5.8.1
  • First release: Aug 2, 2021
  • Latest release: Aug 2, 2021
  • Number of updates: 3
  • Update frequency: every 1.0 days
  • Top authors: simonwood (100%)

Code review

53 tests

User reviews

1 review

Install metrics

10+ active / 55 total downloads

Benchmarks

Plugin footprint Passed 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: ▼279.59ms] Passed 4 tests

Analyzing server-side resources used by Featured Image Licence
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.83 ▲0.1127.98 ▲3.90
Dashboard /wp-admin3.10 ▲0.0446.39 ▲4.00
Posts /wp-admin/edit.php3.15 ▲0.0444.27 ▲4.19
Add New Post /wp-admin/post-new.php4.69 ▼0.7463.68 ▼1,121.77
Media Library /wp-admin/upload.php3.04 ▲0.0332.48 ▼4.49
Featured Image Licence Options /wp-admin/options-general.php?page=swfil-plugin-options2.9829.56

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 5 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Featured Image Licence: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,678 ▲9616.33 ▲0.787.84 ▼0.8553.79 ▲6.74
Dashboard /wp-admin2,938 ▲825.89 ▲0.02144.84 ▲7.37104.55 ▼0.00
Posts /wp-admin/edit.php2,711 ▲52.69 ▲0.0268.33 ▼1.9398.28 ▲6.31
Add New Post /wp-admin/post-new.php1,656 ▼19518.76 ▲1.32385.22 ▲19.01113.35 ▲6.59
Media Library /wp-admin/upload.php1,774 ▲25.04 ▲0.04170.20 ▼0.05136.47 ▲3.66
Featured Image Licence Options /wp-admin/options-general.php?page=swfil-plugin-options1,0052.1061.7590.09

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstall script ran successfully

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=swfil-plugin-options
    • > Warning in wp-content/plugins/featured-image-licence/admin/SW_Featured_Image_Licence_Options.php+93
    asort() expects parameter 1 to be array, null given
    • > GET request to /wp-admin/options-general.php?page=swfil-plugin-options
    • > Warning in wp-content/plugins/featured-image-licence/admin/SW_Featured_Image_Licence_Options.php+94
    Invalid argument supplied for foreach()

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
Almost there! Just fix the following items
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/featured-image-licence/featured-image-licence.php:14

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 errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === featured-image-licence === )
You can look at the official readme.txt

featured-image-licence/featured-image-licence.php Passed 13 tests

The main PHP script in "Featured Image Licence" version 1.1 is automatically included on every request by WordPress
70 characters long description:
Inserts an attribution into the post where a CC licensed image is used

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin137 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP43167137

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.19
Average class complexity5.00
▷ Minimum class complexity2.00
▷ Maximum class complexity7.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods9
▷ Static methods00.00%
▷ Public methods9100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 1 test

Image compression Passed 1 test

PNG files should be compressed to save space and minimize bandwidth usage
PNG images were not found in this plugin