84% bern-badge-for-bernie-sanders

Code Review | Feel the Bern Badge for Bernie Sanders

WordPress plugin Feel the Bern Badge for Bernie Sanders scored84%from 54 tests.

About plugin

  • Plugin page: bern-badge-for-be...
  • Plugin version: 1.1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.5.1
  • WordPress version: 6.3.1
  • First release: Mar 6, 2016
  • Latest release: Jun 20, 2016
  • Number of updates: 18
  • Update frequency: every 5.9 days
  • Top authors: spokanetony (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /899 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
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼7.22ms] Passed 4 tests

Analyzing server-side resources used by Feel the Bern Badge for Bernie Sanders
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0339.72 ▲2.89
Dashboard /wp-admin3.32 ▼0.0344.97 ▼13.92
Posts /wp-admin/edit.php3.37 ▲0.0143.85 ▲1.24
Add New Post /wp-admin/post-new.php5.90 ▲0.0177.68 ▼16.38
Media Library /wp-admin/upload.php3.24 ▲0.0134.70 ▲0.19
Bern Badge /wp-admin/options-general.php?page=bern-badge-for-bernie-sanders/bern-badge.php3.2630.71

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

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

Browser metrics Passed 4 tests

This is an overview of browser requirements for Feel the Bern Badge for Bernie Sanders
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,005 ▲25913.50 ▼1.2111.27 ▲9.6243.92 ▲3.68
Dashboard /wp-admin2,200 ▲205.55 ▼0.0994.91 ▼2.7343.41 ▲7.20
Posts /wp-admin/edit.php2,108 ▲111.98 ▼0.0434.78 ▲0.8932.97 ▼1.89
Add New Post /wp-admin/post-new.php1,533 ▼422.99 ▲4.42651.20 ▼3.8768.04 ▲11.69
Media Library /wp-admin/upload.php1,411 ▲114.17 ▼0.0796.22 ▼5.2542.78 ▼0.79
Bern Badge /wp-admin/options-general.php?page=bern-badge-for-bernie-sanders/bern-badge.php9801.8227.4636.55

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

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
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function BernBadge\\register_activation_hook() in wp-content/plugins/bern-badge-for-bernie-sanders/bern-badge.php:305
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/bern-badge-for-bernie-sanders/settings.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
5 plugin tags: bern, bernie sanders, bernie, feel the bern, bern badge

bern-badge-for-bernie-sanders/bern-badge.php 85% from 13 tests

"Feel the Bern Badge for Bernie Sanders" version 1.1.5's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("bern-badge-for-bernie-sanders.php" instead of "bern-badge.php")

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 plugin589 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP26694282
JavaScript34012181
CSS3200126

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity20.00
▷ Minimum class complexity20.00
▷ Maximum class complexity20.00
Average method complexity1.83
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods23
▷ Static methods00.00%
▷ Public methods23100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants00.00%
▷ Class constants4100.00%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
23 PNG files occupy 0.40MB with 0.24MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/bern-badge-left-black-en-1.png8.10KB4.80KB▼ 40.72%
images/bern-badge-right-blue-en-5.png37.17KB9.99KB▼ 73.12%
images/bern-badge-left-blue-en-3.png10.56KB5.00KB▼ 52.64%
images/bern-badge-left-white-en-2.png11.75KB5.25KB▼ 55.34%
images/bern-badge-right-blue-en-7.png24.97KB5.07KB▼ 79.69%