84% tinywp-mobile-detect

Code Review | Mobile Detect

WordPress plugin Mobile Detect scored84%from 54 tests.

About plugin

  • Plugin page: tinywp-mobile-detect
  • Plugin version: 1.5.0
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.3
  • WordPress version: 6.3.1
  • First release: Dec 10, 2017
  • Latest release: Jul 22, 2023
  • Number of updates: 41
  • Update frequency: every 50.0 days
  • Top authors: pothi (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

3,000+ active /28,998 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼3.78ms] Passed 4 tests

Server-side resources used by Mobile Detect
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0242.06 ▲3.17
Dashboard /wp-admin3.32 ▼0.0266.07 ▼1.74
Posts /wp-admin/edit.php3.37 ▲0.0249.30 ▼0.60
Add New Post /wp-admin/post-new.php5.90 ▲0.0285.44 ▼15.95
Media Library /wp-admin/upload.php3.24 ▲0.0241.27 ▲5.35

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 5 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

Mobile Detect: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.45 ▲0.281.67 ▲0.1144.18 ▲1.77
Dashboard /wp-admin2,195 ▲155.63 ▼0.1185.06 ▼2.5838.19 ▼1.56
Posts /wp-admin/edit.php2,097 ▼32.03 ▼0.0035.60 ▼3.0933.92 ▼7.02
Add New Post /wp-admin/post-new.php1,526 ▼023.06 ▼0.10687.90 ▼7.2163.24 ▼1.28
Media Library /wp-admin/upload.php1,400 ▼04.22 ▲0.11110.21 ▼6.6748.42 ▲1.17

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments

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)
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/tinywp-mobile-detect/index.php
    • > /wp-content/plugins/tinywp-mobile-detect/mobile-detect.php

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
7 plugin tags: mobile, responsive, mobiledetect, ipad, browsers...

tinywp-mobile-detect/mobile-detect.php 92% from 13 tests

This is the main PHP file of "Mobile Detect" version 1.5.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("tinywp-mobile-detect.php" instead of "mobile-detect.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin695 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP3163862695

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 code1.01
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%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants00.00%
▷ Class constants9100.00%
▷ Public constants9100.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
No PNG images were found in this plugin