72% twitter-card-generator

Code Review | Twitter Card Generator

WordPress plugin Twitter Card Generator scored72%from 54 tests.

About plugin

  • Plugin page: twitter-card-gene...
  • Plugin version: 1.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5.1-3.9.1
  • WordPress version: 6.3.1
  • First release: Aug 26, 2013
  • Latest release: Jun 17, 2015
  • Number of updates: 19
  • Update frequency: every 34.9 days
  • Top authors: silencecm (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active /3,266 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.02MB] [CPU: ▼1.83ms] Passed 4 tests

An overview of server-side resources used by Twitter Card Generator
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0342.81 ▼1.77
Dashboard /wp-admin3.32 ▲0.0251.95 ▲1.79
Posts /wp-admin/edit.php3.38 ▲0.0253.50 ▲6.99
Add New Post /wp-admin/post-new.php5.91 ▲0.0288.30 ▼5.82
Media Library /wp-admin/upload.php3.25 ▲0.0234.54 ▼1.51
Twitter Card Generator /wp-admin/plugins.php?page=twitter-card-generator3.2929.90

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 22 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
db_upgraded
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
twitter-card-type

Browser metrics Passed 4 tests

A check of browser resources used by Twitter Card Generator
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲1914.58 ▲0.201.66 ▼0.2838.32 ▼6.15
Dashboard /wp-admin2,199 ▲195.52 ▼0.1585.51 ▼17.2338.53 ▼6.54
Posts /wp-admin/edit.php2,101 ▲11.99 ▲0.0433.62 ▼4.3736.94 ▼1.53
Add New Post /wp-admin/post-new.php1,529 ▲123.04 ▼0.08676.29 ▼11.1853.20 ▼0.69
Media Library /wp-admin/upload.php1,401 ▲14.27 ▲0.03100.08 ▼18.0446.51 ▼4.28
Twitter Card Generator /wp-admin/plugins.php?page=twitter-card-generator1,2772.0925.1031.35

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • twitter-card-type
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/plugins.php?page=twitter-card-generator
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/plugins.php?page=twitter-card-generator
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/plugins.php?page=twitter-card-generator
    • > Deprecated in wp-content/plugins/twitter-card-generator/views/admin.php+72
    Non-static method Twitter_Card_Generator::get_media_library_images() should not be called statically

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please take a closer look at the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/twitter-card-generator/views/public.php
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function screen_icon() in wp-content/plugins/twitter-card-generator/views/admin.php:87

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 93% 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
Please fix the following attributes:
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

twitter-card-generator/twitter-card-generator.php 92% from 13 tests

The main file in "Twitter Card Generator" v. 1.0.5 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin521 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP641229470
CSS15126
JavaScript21025

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity18.00
▷ Minimum class complexity18.00
▷ Maximum class complexity18.00
Average method complexity1.89
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods315.79%
▷ Public methods1894.74%
▷ Protected methods00.00%
▷ Private methods15.26%
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

PNG files should be compressed to save space and minimize bandwidth usage
5 PNG files occupy 0.60MB with 0.40MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/web_photo.png165.80KB51.13KB▼ 69.16%
images/web_summary_large.png142.31KB49.78KB▼ 65.02%
images/ios_app.png31.51KB12.94KB▼ 58.93%
images/web_summary.png70.59KB21.67KB▼ 69.30%
images/web_gallery.png201.09KB55.52KB▼ 72.39%