79% adshares

Code Review | Adshares

WordPress plugin Adshares scored79%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: 6.3.1
  • 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

10+ active /1,319 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼12.08ms] Passed 4 tests

A check of server-side resources used by Adshares
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0142.07 ▼2.25
Dashboard /wp-admin3.41 ▲0.0651.03 ▼17.75
Posts /wp-admin/edit.php3.46 ▲0.1054.45 ▲1.02
Add New Post /wp-admin/post-new.php5.93 ▲0.0486.53 ▼22.88
Media Library /wp-admin/upload.php3.29 ▲0.0635.67 ▼5.43
Adshares /wp-admin/options-general.php?page=adshares-config3.9139.89

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 1,089 new files
Database: no new tables, 7 new options
New WordPress options
adshares_settings
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Adshares
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.27 ▼0.011.81 ▲0.1746.14 ▲4.40
Dashboard /wp-admin2,201 ▲305.61 ▲0.0392.46 ▲2.2141.96 ▼3.48
Posts /wp-admin/edit.php2,106 ▲62.01 ▲0.0142.66 ▲1.9335.51 ▼2.18
Add New Post /wp-admin/post-new.php1,531 ▲523.11 ▲0.01668.38 ▼29.8950.71 ▼5.06
Media Library /wp-admin/upload.php1,406 ▲34.24 ▲0.0598.12 ▲0.0344.62 ▼1.27
Adshares /wp-admin/options-general.php?page=adshares-config8402.0023.7531.25

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 7 options
    • theysaidso_admin_options
    • adshares_settings
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 50% 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 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 output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/adshares/adshares.php
  • 366× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_Node_Expression_Test' not found in wp-content/plugins/adshares/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php:23
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/adshares/vendor/guzzlehttp/psr7/src/LazyOpenStream.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_Test_NodeTestCase' not found in wp-content/plugins/adshares/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/adshares/vendor/composer/installers/src/Composer/Installers/HuradInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/adshares/vendor/composer/installers/src/Composer/Installers/PrestashopInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_Test_NodeTestCase' not found in wp-content/plugins/adshares/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/adshares/vendor/ralouphie/getallheaders/tests/GetAllHeadersTest.php:3
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\UploadedFileInterface' not found in wp-content/plugins/adshares/vendor/guzzlehttp/psr7/src/UploadedFile.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/adshares/vendor/composer/installers/src/Composer/Installers/MagentoInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Twig_TokenParser' not found in wp-content/plugins/adshares/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php:27

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/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
9 plugin tags: adshares, publisher, ad manager, ad, advertising...

adshares/adshares.php Passed 13 tests

The entry point to "Adshares" version 0.1.3 is a PHP file that has certain tags in its header comment area
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 | 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 plugin37,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

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.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