10% south-pole-the-offset-movement

Code Review | South Pole: Climate action now

WordPress plugin South Pole: Climate action now scored 10% from 54 tests.

About plugin

  • Plugin page: south-pole-the-of...
  • Plugin version: 1.0.1
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.8.2
  • WordPress version: 5.9.2
  • First release: Jul 8, 2021
  • Latest release: Nov 16, 2021
  • Number of updates: 3
  • Update frequency: every 44.0 days
  • Top authors: co2ok (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 154 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
You still need to fix the following installer errors
  • The plugin cannot be installed
    • > Error in wp-content/plugins/south-pole-the-offset-movement/co2ok-plugin.php+294
    Uncaught Error: Class 'co2ok_plugin_woocommerce\Components\Co2ok_GraphQLClient' not found in wp-content/plugins/south-pole-the-offset-movement/co2ok-plugin.php:294
    Stack trace:
    #0 wp-content/plugins/south-pole-the-offset-movement/co2ok-plugin.php(347): co2ok_plugin_woocommerce\Co2ok_Plugin::registerMerchant()
    #1 wp-includes/class-wp-hook.php(307): co2ok_plugin_woocommerce\Co2ok_Plugin::co2ok_Activated()
    #2 wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(474): WP_Hook->do_action()
    #4 wp-admin/includes/plugin.php(689): do_action()

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

This is a short check of server-side resources used by South Pole: Climate action now
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0156.66 ▲5.78
Dashboard /wp-admin3.42 ▲0.0134.95 ▲0.90
Posts /wp-admin/edit.php3.65 ▲0.0138.56 ▼0.10
Add New Post /wp-admin/post-new.php6.89 ▼0.0993.20 ▼1,187.05
Media Library /wp-admin/upload.php3.30 ▲0.0026.13 ▲3.43

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 279 new files
Database: no new tables, 4 new options
New WordPress options
fs_debug_mode
fs_gdpr
fs_active_plugins
fs_accounts

Browser metrics Passed 4 tests

An overview of browser requirements for South Pole: Climate action now
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,763 ▲915.94 ▲1.155.52 ▼1.322.21 ▼0.60
Dashboard /wp-admin2,895 ▲376.12 ▼0.05131.86 ▼4.20166.54 ▲5.05
Posts /wp-admin/edit.php2,694 ▲93.23 ▼0.0263.21 ▼1.68142.31 ▼2.35
Add New Post /wp-admin/post-new.php1,752 ▲9121.05 ▲4.90433.12 ▲11.21158.50 ▲2.13
Media Library /wp-admin/upload.php1,698 ▼05.53 ▲0.04136.36 ▼10.57185.20 ▼2.38

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 4 options
    • fs_accounts
    • fs_active_plugins
    • fs_gdpr
    • fs_debug_mode

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

SRP 0% 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× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/south-pole-the-offset-movement/freemius/templates/ajax-loader.php
  • 33× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      require_once(/tmp/wordpress-tests-lib/includes/functions.php): failed to open stream: No such file or directory in wp-content/plugins/south-pole-the-offset-movement/tests/bootstrap.php on line 14
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_slug() on null in wp-content/plugins/south-pole-the-offset-movement/freemius/templates/account/partials/addon.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/south-pole-the-offset-movement/tests/test-co2ok-plugin.php:8
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/south-pole-the-offset-movement/freemius/templates/account/partials/addon.php on line 8
    • > PHP Fatal error
      Uncaught Error: Class 'cbschuld\\LogEntriesWriter' not found in wp-content/plugins/south-pole-the-offset-movement/vendor/cbschuld/logentries/tests/WriterTest.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function woocommerce_form_field() in wp-content/plugins/south-pole-the-offset-movement/Templates/co2ok_button_template_default_cfp.php:5
    • > PHP Notice
      Undefined variable: co2ok_session_opted in wp-content/plugins/south-pole-the-offset-movement/Templates/co2ok_button_template_minimal.php on line 3
    • > PHP Notice
      Undefined variable: cart in wp-content/plugins/south-pole-the-offset-movement/Templates/co2ok_button_template_south_pole.php on line 1
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/south-pole-the-offset-movement/freemius/templates/account/partials/addon.php on line 7
    • > PHP Fatal error
      Uncaught Error: Class 'WP_UnitTestCase' not found in wp-content/plugins/south-pole-the-offset-movement/tests/test-co2ok.php:11

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 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
You can look at the official readme.txt

south-pole-the-offset-movement/co2ok-plugin.php 85% from 13 tests

"South Pole: Climate action now" version 1.0.1'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: The principal plugin file should be the same as the plugin slug ("south-pole-the-offset-movement.php" instead of "co2ok-plugin.php")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected40,362 lines of code in 193 files:
LanguageFilesBlank linesComment linesLines of code
PHP1447,90717,12233,106
JSON7004,152
CSS1484321,038
JavaScript6155103649
Sass2593541
Markdown41730446
PO File37579209
Bourne Shell121799
XML33043
YAML26140
SVG60034
INI1005

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,907)
Cyclomatic complexity
Average complexity per logical line of code0.60
Average class complexity60.28
▷ Minimum class complexity1.00
▷ Maximum class complexity2,907.00
Average method complexity4.36
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces8
Interfaces2
Traits2
Classes68
▷ Abstract classes57.35%
▷ Concrete classes6392.65%
▷ Final classes00.00%
Methods1,307
▷ Static methods18914.46%
▷ Public methods95372.92%
▷ Protected methods151.15%
▷ Private methods33925.94%
Functions113
▷ Named functions9987.61%
▷ Anonymous functions1412.39%
Constants137
▷ Global constants9871.53%
▷ Class constants3928.47%
▷ Public constants39100.00%

Plugin size 0% from 2 tests

Image compression 0% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
27 PNG files occupy 0.91MB with 0.44MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/widgetmark.png4.80KB2.69KB▼ 43.99%
(invalid) images/co2_projects.png313.81KB0.00KB▼ 100.00%
images/gray_road_right.png4.29KB1.98KB▼ 53.94%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
images/button_minimal_co2ok.png15.11KB15.43KB0.00%