84% twitter-cards

Code Review | Twitter Cards

WordPress plugin Twitter Cards scored84%from 54 tests.

About plugin

  • Plugin page: twitter-cards
  • Plugin version: 1.0.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.5.1
  • WordPress version: 6.3.1
  • First release: Jun 17, 2012
  • Latest release: Apr 3, 2013
  • Number of updates: 16
  • Update frequency: every 18.1 days
  • Top authors: niallkennedy (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

500+ active /20,387 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

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

Server-side resources used by Twitter Cards
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0241.80 ▼4.96
Dashboard /wp-admin3.33 ▲0.0250.32 ▼6.09
Posts /wp-admin/edit.php3.38 ▲0.0254.25 ▲0.14
Add New Post /wp-admin/post-new.php5.91 ▲0.0293.71 ▼14.53
Media Library /wp-admin/upload.php3.25 ▲0.0244.28 ▲3.55

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 5 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
db_upgraded
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Twitter Cards
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.20 ▼0.191.93 ▲0.1043.17 ▼0.10
Dashboard /wp-admin2,195 ▲185.73 ▲0.1490.85 ▼4.1937.41 ▼8.75
Posts /wp-admin/edit.php2,103 ▲32.04 ▲0.0541.27 ▲5.3137.14 ▼0.82
Add New Post /wp-admin/post-new.php1,531 ▲523.48 ▲6.00688.37 ▲6.5651.98 ▼2.65
Media Library /wp-admin/upload.php1,403 ▲34.20 ▼0.0399.19 ▼22.6944.32 ▼6.24

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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 fix the following
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/twitter-cards/twitter-cards.php:126

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
3 plugin tags: twitter cards, twitter, semantic markup

twitter-cards/twitter-cards.php Passed 13 tests

Analyzing the main PHP file in "Twitter Cards" version 1.0.5
45 characters long description:
Add Twitter Cards markup to individual posts.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected421 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP370281335
Markdown139086

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.91
Average class complexity48.00
▷ Minimum class complexity24.00
▷ Maximum class complexity94.00
Average method complexity6.04
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods28
▷ Static methods1035.71%
▷ Public methods2485.71%
▷ Protected methods00.00%
▷ Private methods414.29%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants00.00%
▷ Class constants2100.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG files were detected