84% device-detect

Code Review | Device Detect

WordPress plugin Device Detect scored84%from 54 tests.

About plugin

  • Plugin page: device-detect
  • Plugin version: 1.4.6
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jan 6, 2018
  • Latest release: Nov 13, 2022
  • Number of updates: 69
  • Update frequency: every 25.7 days
  • Top authors: Kleor (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /2,866 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

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

Server-side resources used by Device Detect
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0336.70 ▼0.91
Dashboard /wp-admin3.35 ▲0.0445.61 ▼1.27
Posts /wp-admin/edit.php3.40 ▲0.0450.03 ▼1.85
Add New Post /wp-admin/post-new.php5.93 ▲0.0497.51 ▲8.19
Media Library /wp-admin/upload.php3.27 ▲0.0433.68 ▼2.17

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 11 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

Device Detect: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.20 ▼1.381.51 ▼0.0742.11 ▲0.77
Dashboard /wp-admin2,206 ▲184.88 ▼0.98111.15 ▲12.5539.97 ▼0.63
Posts /wp-admin/edit.php2,092 ▲32.03 ▼0.0139.98 ▲3.3434.61 ▲2.75
Add New Post /wp-admin/post-new.php6,252 ▲4,73826.29 ▲8.83847.98 ▲126.2660.01 ▲6.59
Media Library /wp-admin/upload.php1,388 ▼04.22 ▼0.0194.72 ▼14.9841.20 ▼4.38

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
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

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)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/device-detect/index.php
    • > /wp-content/plugins/device-detect/libraries/index.php
    • > /wp-content/plugins/device-detect/languages/index.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration Passed 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
No tags were detected

device-detect/device-detect.php Passed 13 tests

The primary PHP file in "Device Detect" version 1.4.6 is used by WordPress to initiate all plugin functionality
116 characters long description:
Allows you to detect the device of the user, and to display some contents only for the phones, tablets or computers.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin814 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP4199871784
PO File16030

PHP code Passed 2 tests

A short review 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.79
Average class complexity139.00
▷ Minimum class complexity139.00
▷ Maximum class complexity139.00
Average method complexity4.83
▷ Minimum method complexity1.00
▷ Maximum method complexity78.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods36
▷ Static methods925.00%
▷ Public methods3391.67%
▷ Protected methods25.56%
▷ Private methods12.78%
Functions15
▷ Named functions1493.33%
▷ Anonymous functions16.67%
Constants16
▷ Global constants743.75%
▷ Class constants956.25%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There were not PNG files found in your plugin