73% adshares

Code Review | Adshares

WordPress plugin Adshares scored 73% from 54 tests.

About plugin

  • Plugin page: adshares
  • Plugin version: 0.1.3
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.1
  • WordPress version: 5.9.2
  • First release: Feb 22, 2019
  • Latest release: Mar 11, 2019
  • Number of updates: 7
  • Update frequency: every 2.4 days
  • Top authors: adshares (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active / 1,032 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.96MB] [CPU: ▼287.14ms] Passed 4 tests

Server-side resources used by Adshares
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.04 ▲0.5255.23 ▲3.57
Dashboard /wp-admin4.53 ▲1.1238.35 ▲4.63
Posts /wp-admin/edit.php4.78 ▲1.1443.68 ▲6.21
Add New Post /wp-admin/post-new.php8.02 ▲1.05105.15 ▼1,162.98
Media Library /wp-admin/upload.php4.53 ▲1.2429.13 ▲6.41
Adshares /wp-admin/options-general.php?page=adshares-config4.6828.44

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 1,089 new files
Database: no new tables, 1 new option
New WordPress options
adshares_settings

Browser metrics Passed 4 tests

This is an overview of browser requirements for Adshares
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,792 ▲7015.77 ▲0.155.65 ▼0.012.24 ▼0.11
Dashboard /wp-admin2,901 ▲406.17 ▼0.04115.83 ▼19.93155.82 ▼1.10
Posts /wp-admin/edit.php2,695 ▲73.24 ▼0.0066.07 ▲5.10137.84 ▼1.19
Add New Post /wp-admin/post-new.php1,667 ▼116.53 ▼2.48391.32 ▼14.73151.06 ▼4.52
Media Library /wp-admin/upload.php1,707 ▲95.50 ▼0.00143.94 ▼5.77187.71 ▲0.28
Adshares /wp-admin/options-general.php?page=adshares-config1,0872.3753.55124.04

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 1 option in the database
    • adshares_settings

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=adshares-config
    • > Deprecated in wp-content/plugins/adshares/vendor/twig/twig/lib/Twig/Node.php+198
    Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)`

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
Almost there! Just fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/adshares/adshares.php
  • 366× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/adshares/vendor/composer/installers/src/Composer/Installers/PhiftyInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/adshares/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_Node_Expression_Binary' not found in wp-content/plugins/adshares/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_Test_NodeTestCase' not found in wp-content/plugins/adshares/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'Twig_RuntimeLoaderInterface' not found in wp-content/plugins/adshares/vendor/twig/twig/lib/Twig/ContainerRuntimeLoader.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_Environment' not found in wp-content/plugins/adshares/vendor/twig/twig/test/Twig/Tests/Node/Expression/PHP53/FilterInclude.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/adshares/vendor/composer/installers/src/Composer/Installers/AimeosInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_Node_Expression_Binary' not found in wp-content/plugins/adshares/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_TokenParser' not found in wp-content/plugins/adshares/vendor/twig/twig/lib/Twig/TokenParser/Import.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/adshares/vendor/composer/installers/src/Composer/Installers/ReIndexInstaller.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
9 plugin tags: ads, ad manager, publisher, ad inserter, ad...

adshares/adshares.php Passed 13 tests

The main file in "Adshares" v. 0.1.3 serves as a complement to information provided in readme.txt and as the entry point to the plugin
60 characters long description:
The easiest way to connect your site to the Adshares network

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
No dangerous file extensions were detected37,921 lines of code in 784 files:
LanguageFilesBlank linesComment linesLines of code
PHP6426,40311,95829,222
reStructuredText902,4332,1623,384
Markdown131,02403,274
JSON900895
C1171186860
Twig1060137
YAML213148
XML28047
HTML110017
C/C++ Header171315
make1409
CSS1108
m41215

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity4.94
▷ Minimum class complexity1.00
▷ Maximum class complexity159.00
Average method complexity2.25
▷ Minimum method complexity1.00
▷ Maximum method complexity69.00
Code structure
Namespaces32
Interfaces57
Traits2
Classes612
▷ Abstract classes162.61%
▷ Concrete classes59697.39%
▷ Final classes132.18%
Methods2,168
▷ Static methods994.57%
▷ Public methods1,83784.73%
▷ Protected methods1697.80%
▷ Private methods1627.47%
Functions224
▷ Named functions12857.14%
▷ Anonymous functions9642.86%
Constants112
▷ Global constants76.25%
▷ Class constants10593.75%
▷ Public constants105100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin