83% netbiscuits-device-detection

Code Review | Netbiscuits Device Detection

WordPress plugin Netbiscuits Device Detection scored 83% from 54 tests.

About plugin

  • Plugin page: netbiscuits-devic...
  • Plugin version: 1.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-4.4.2
  • WordPress version: 5.8.1
  • First release: Mar 11, 2016
  • Latest release: Apr 19, 2016
  • Number of updates: 11
  • Update frequency: every 3.5 days
  • Top authors: Netbiscuits (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 473 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.08MB] [CPU: ▼141.88ms] Passed 4 tests

A check of server-side resources used by Netbiscuits Device Detection
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.90 ▲0.0637.50 ▲2.39
Dashboard /wp-admin3.15 ▲0.0946.48 ▼1.00
Posts /wp-admin/edit.php3.26 ▲0.1548.75 ▼0.23
Add New Post /wp-admin/post-new.php5.50 ▲0.07100.29 ▼564.21
Media Library /wp-admin/upload.php3.09 ▲0.0934.32 ▼2.08
NB DD /wp-admin/options-general.php?page=netbiscuits-device-detection3.0630.04

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 5 new files
Database: no new tables, 4 new options
New WordPress options
nb_dd_token
nb_dd_debug
nb_dd_account
nb_dd_profile

Browser metrics Passed 4 tests

Checking browser requirements for Netbiscuits Device Detection
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,684 ▲8815.96 ▲0.288.72 ▲2.0049.19 ▲3.54
Dashboard /wp-admin2,997 ▲665.96 ▲0.02141.63 ▼2.20120.26 ▼0.83
Posts /wp-admin/edit.php2,744 ▲52.70 ▲0.0172.20 ▲3.1597.44 ▲6.01
Add New Post /wp-admin/post-new.php1,607 ▼7618.88 ▲0.29389.41 ▼23.96116.05 ▲1.97
Media Library /wp-admin/upload.php1,812 ▲55.01 ▼0.00157.31 ▲10.50125.00 ▲4.27
NB DD /wp-admin/options-general.php?page=netbiscuits-device-detection1,1122.0860.5275.57

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 4 options
    • nb_dd_token
    • nb_dd_debug
    • nb_dd_profile
    • nb_dd_account

Smoke tests 75% 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)
Even though no errors were found, this is by no means an exhaustive test

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
The following issues need your attention
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/netbiscuits-device-detection/nb-dd.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
2 plugin tags: device detection, netbiscuits

netbiscuits-device-detection/nb-dd.php 77% from 13 tests

The principal PHP file in "Netbiscuits Device Detection" v. 1.7 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 285 characters long)
  • Text Domain: The text domain name should consist of only dashes and lowercase characters
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("netbiscuits-device-detection.php" instead of "nb-dd.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
No dangerous file extensions were detected507 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP3102218507

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity39.00
▷ Minimum class complexity39.00
▷ Maximum class complexity39.00
Average method complexity2.03
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods37
▷ Static methods38.11%
▷ Public methods3286.49%
▷ Protected methods00.00%
▷ Private methods513.51%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
No PNG files were detected