88% nano-stats

Code Review | NaNo Stats

WordPress plugin NaNo Stats scored 88% from 54 tests.

About plugin

  • Plugin page: nano-stats
  • Plugin version: 1.2.11
  • PHP version: 7.4.16
  • WordPress compatibility: 2.5-4.9
  • WordPress version: 5.8.1
  • First release: Aug 21, 2012
  • Latest release: Nov 9, 2017
  • Number of updates: 33
  • Update frequency: every 57.8 days
  • Top authors: camilstaps (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 3,484 total downloads

Benchmarks

Plugin footprint Passed 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.01MB] [CPU: ▼142.37ms] Passed 4 tests

Server-side resources used by NaNo Stats
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.1236.70 ▲14.28
Dashboard /wp-admin3.07 ▲0.0143.99 ▼3.67
Posts /wp-admin/edit.php3.12 ▲0.0145.50 ▲2.81
Add New Post /wp-admin/post-new.php5.42 ▼0.0190.28 ▼564.76
Media Library /wp-admin/upload.php3.01 ▲0.0131.22 ▼3.85
NaNo Stats /wp-admin/options-general.php?page=nanostats3.0625.95

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 13 new files
Database: no new tables, 8 new options
New WordPress options
nanostats_width
nanostats_region
nanostats_title
nanostats_username
nanostats_color_daily
nanostats_color_goal
nanostats_color_wordcount
nanostats_height

Browser metrics Passed 4 tests

NaNo Stats: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,849 ▲25316.78 ▲1.1915.81 ▲6.4448.97 ▲2.54
Dashboard /wp-admin2,984 ▲506.51 ▲0.56148.91 ▲8.37110.73 ▼5.81
Posts /wp-admin/edit.php2,753 ▲143.13 ▲0.4069.08 ▲2.7089.78 ▲0.10
Add New Post /wp-admin/post-new.php1,515 ▼16818.86 ▲0.11378.74 ▲15.56106.75 ▲1.60
Media Library /wp-admin/upload.php1,824 ▲175.35 ▲0.32131.63 ▼19.95119.30 ▲4.29
NaNo Stats /wp-admin/options-general.php?page=nanostats1,7812.5057.0782.31

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
The smoke test was a success, however most plugin functionality was not tested

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
Almost there! Just fix the following items
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/nano-stats/nanostats.php:31
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/nano-stats/admin.php:2

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There are user-side issues you should fix
    • > GET request to /wp-admin/options-general.php?page=nanostats
    • > Javascript (severe) in unknown
    /wp-content/plugins/nano-stats/jquery.jqplot.min.js?ver=5.8.1 56:4513 Uncaught TypeError: Cannot read properties of undefined (reading 'msie')
    • > GET request to /wp-admin/options-general.php?page=nanostats
    • > Javascript (severe) in unknown
    /wp-content/plugins/nano-stats/jqplot.barRenderer.min.js?ver=5.8.1 56:110 Uncaught TypeError: d.jqplot.LineRenderer is not a constructor
    • > GET request to /wp-admin/options-general.php?page=nanostats
    • > Javascript (severe) in unknown
    /wp-content/plugins/nano-stats/jqplot.categoryAxisRenderer.min.js?ver=5.8.1 56:163 Uncaught TypeError: a.jqplot.LinearAxisRenderer is not a constructor
    • > GET request to /wp-admin/options-general.php?page=nanostats
    • > Javascript (severe) in unknown
    /wp-content/plugins/nano-stats/jqplot.highlighter.min.js?ver=5.8.1 56:41 Uncaught TypeError: Cannot read properties of undefined (reading 'push')

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need to be fixed:
  • Screenshots: These screenshots require images: #1 (With an easy shortcode, you can add this awesome stats chart to your site! Colors, size and title are customizable.), #2 (The settings page is clear and simple.)
You can take inspiration from this readme.txt

nano-stats/nanostats.php 92% from 13 tests

This is the main PHP file of "NaNo Stats" version 1.2.11, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Main file name: The principal plugin file should be the same as the plugin slug ("nano-stats.php" instead of "nanostats.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 detected673 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP25740665
JavaScript703927
CSS1001

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.05MB with 0.04MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png27.95KB8.14KB▼ 70.88%
screenshot-2.png28.32KB9.39KB▼ 66.84%