52% turtle-ad-network

Code Review | Turtle Ad Network

WordPress plugin Turtle Ad Networkscored52%from 54 tests.

About plugin

  • Plugin page: turtle-ad-network
  • Plugin version: 1.0.13
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.8-5.5
  • WordPress version: 6.3.1
  • First release: Apr 1, 2019
  • Latest release: Aug 26, 2020
  • Number of updates: 40
  • Update frequency: every 19.4 days
  • Top authors: gord0b (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active /977 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.17MB] [CPU: ▼1.66ms] Passed 4 tests

Server-side resources used by Turtle Ad Network
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.76 ▲0.3045.00 ▲2.08
Dashboard /wp-admin3.46 ▲0.1651.68 ▼4.15
Posts /wp-admin/edit.php3.58 ▲0.2252.23 ▲6.66
Add New Post /wp-admin/post-new.php6.04 ▲0.1685.53 ▼11.23
Media Library /wp-admin/upload.php3.38 ▲0.1640.27 ▲7.52
Ad Segments /wp-admin/admin.php?page=tan-add-ad-slots3.3938.23
Wallet Address /wp-admin/admin.php?page=tan-add-wallet-address3.3733.77
Settings /wp-admin/admin.php?page=tan-settings3.4033.61
Ad Manager /wp-admin/admin.php?page=tan-approve-ad3.4035.88

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 33 new files
Database: 5 new tables, 8 new options
New tables
wp_tan_adsegment
wp_tan_min_amount_txid
wp_tan_ads_size
wp_tan_wallet_address
wp_tan_ad_segment_details
New WordPress options
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
tadn_jal_db_version
theysaidso_admin_options
db_upgraded
api_server
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Turtle Ad Network
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲6413.21 ▼1.111.61 ▼0.2636.22 ▼5.71
Dashboard /wp-admin2,244 ▲595.88 ▲1.01106.05 ▲2.5741.10 ▼0.57
Posts /wp-admin/edit.php2,124 ▲322.03 ▲0.0439.35 ▼0.7935.77 ▼0.97
Add New Post /wp-admin/post-new.php1,561 ▲1923.35 ▼1.41660.44 ▼105.6161.39 ▲4.47
Media Library /wp-admin/upload.php1,417 ▲294.24 ▼0.07100.53 ▲0.1540.80 ▼0.55
Ad Segments /wp-admin/admin.php?page=tan-add-ad-slots9262.0623.2125.98
Wallet Address /wp-admin/admin.php?page=tan-add-wallet-address8712.0423.5325.30
Settings /wp-admin/admin.php?page=tan-settings1,0052.1622.3625.24
Ad Manager /wp-admin/admin.php?page=tan-approve-ad8752.0223.2424.15

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The plugin did not uninstall successfully, leaving 5 tables in the database
    • wp_tan_min_amount_txid
    • wp_tan_ads_size
    • wp_tan_wallet_address
    • wp_tan_adsegment
    • wp_tan_ad_segment_details
  • This plugin did not uninstall successfully, leaving 8 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • api_server
    • widget_recent-posts
    • tadn_jal_db_version
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=tan-add-wallet-address
    • > Notice in wp-content/plugins/turtle-ad-network/includes/add-wallet-address.php+75
    Undefined variable: labell
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=tan-add-ad-slots
    • > Notice in wp-content/plugins/turtle-ad-network/includes/add-ad-slots.php+107
    Undefined variable: size_id_db
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=tan-add-wallet-address
    • > Notice in wp-content/plugins/turtle-ad-network/includes/add-wallet-address.php+82
    Undefined variable: id
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=tan-add-wallet-address
    • > Notice in wp-content/plugins/turtle-ad-network/includes/add-wallet-address.php+87
    Undefined variable: btntxt
    • > GET request to /wp-admin/admin.php?page=tan-add-wallet-address
    • > Notice in wp-content/plugins/turtle-ad-network/includes/add-wallet-address.php+79
    Undefined variable: addresss
    • > GET request to /wp-admin/admin.php?page=tan-settings
    • > Notice in wp-content/plugins/turtle-ad-network/includes/ad-settings.php+180
    Undefined variable: selected_tn
    • > GET request to /wp-admin/admin.php?page=tan-settings
    • > Notice in wp-content/plugins/turtle-ad-network/includes/ad-settings.php+181
    Undefined variable: selected_tusd

SRP 0% 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 fix the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/turtle-ad-network/base58php/vendor/kevinlebrun/colors.php/example.php
  • 578× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageNotProtectedTest.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Prophecy\\Exception\\Doubler\\DoubleException' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpspec/prophecy/src/Prophecy/Exception/Doubler/ReturnByReferenceException.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/phpunit/tests/_files/ExceptionInAssertPostConditionsTest.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_Constraint' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/phpunit/src/Framework/Constraint/Composite.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_Constraint' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/phpunit/src/Framework/Constraint/Count.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/php-token-stream/tests/Token/FunctionTest.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/php-token-stream/tests/Token/ClosureTest.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/phpunit/tests/Framework/ConstraintTest.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_Assert' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/phpunit/src/ForwardCompatibility/Assert.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/turtle-ad-network/base58php/vendor/phpunit/php-code-coverage/tests/_files/NamespaceCoverageCoversClassTest.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === Turtle Ad Network=== )
Please take inspiration from this readme.txt

turtle-ad-network/turtle-ad-network.php 92% from 13 tests

Analyzing the main PHP file in "Turtle Ad Network" version 1.0.13
Please take the time to fix the following:
  • Git Repository: A Git repository was detected inside this plugin

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Almost there! Just fix the following issues
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/turtle-ad-network/base58php/bin/athletic.bat
      • wp-content/plugins/turtle-ad-network/base58php/bin/phpunit.bat
72,283 lines of code in 1,176 files:
LanguageFilesBlank linesComment linesLines of code
PHP97213,54928,58860,326
YAML48211893,578
Markdown501,30502,751
JSON321202,468
XML438611916
C115232756
Ant10910573
SVG100288
XSD100264
C/C++ Header23546122
CSS326498
reStructuredText1707862
m41111141
JavaScript752120
Bourne Shell26212
DOS Batch2008

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
It is recommended to fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 154)
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity6.18
▷ Minimum class complexity1.00
▷ Maximum class complexity252.00
Average method complexity2.28
▷ Minimum method complexity1.00
▷ Maximum method complexity154.00
Code structure
Namespaces83
Interfaces76
Traits2
Classes945
▷ Abstract classes313.28%
▷ Concrete classes91496.72%
▷ Final classes545.91%
Methods4,240
▷ Static methods46110.87%
▷ Public methods3,58484.53%
▷ Protected methods3428.07%
▷ Private methods3147.41%
Functions284
▷ Named functions17360.92%
▷ Anonymous functions11139.08%
Constants117
▷ Global constants1311.11%
▷ Class constants10488.89%
▷ Public constants104100.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
4 compressed PNG files occupy 0.01MB
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/imgs/11.png9.70KB7.02KB▼ 27.67%
includes/imgs/1.png0.76KB0.84KB0.00%
includes/imgs/1 (1).png0.64KB0.64KB0.15%
includes/imgs/1 (2).png2.17KB2.11KB▼ 2.97%