84% simple-pregnancy-calculator

Code Review | Simple Pregnancy Calculator

WordPress plugin Simple Pregnancy Calculator scored84%from 54 tests.

About plugin

  • Plugin page: simple-pregnancy-...
  • Plugin version: 1.1.2
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jun 15, 2016
  • Latest release: Jun 2, 2017
  • Number of updates: 21
  • Update frequency: every 16.8 days
  • Top authors: giannisdallas (100%)

Code review

54 tests

User reviews

1 review

Install metrics

90+ active /2,585 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.03MB] [CPU: ▼3.91ms] Passed 4 tests

A check of server-side resources used by Simple Pregnancy Calculator
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0441.65 ▼2.53
Dashboard /wp-admin3.33 ▲0.0344.62 ▼1.40
Posts /wp-admin/edit.php3.38 ▲0.0344.99 ▲0.04
Add New Post /wp-admin/post-new.php5.91 ▲0.0382.04 ▼10.19
Media Library /wp-admin/upload.php3.25 ▲0.0234.44 ▼1.50

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 10 new files
Database: no new tables, 7 new options
New WordPress options
widget_pregnancy_widget
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_recent-posts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

Simple Pregnancy Calculator: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,933 ▲19813.80 ▼0.8412.81 ▲10.5040.78 ▼22.60
Dashboard /wp-admin2,203 ▲155.82 ▼0.0494.11 ▼11.3139.03 ▼5.72
Posts /wp-admin/edit.php2,089 ▼02.01 ▼0.0332.87 ▼3.2730.56 ▼6.18
Add New Post /wp-admin/post-new.php1,533 ▼123.25 ▲0.06656.13 ▼13.4962.94 ▲2.30
Media Library /wp-admin/upload.php1,388 ▼04.23 ▲0.0494.80 ▼6.5542.19 ▲0.96

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • The uninstall procedure has failed, leaving 7 options in the database
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_pregnancy_widget
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/simple-pregnancy-calculator/simple-pregnancy-calculator-widget.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/simple-pregnancy-calculator/simple-pregnancy-calculator.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention:
  • Requires at least: The plugin version is formatted incorrectly
You can take inspiration from this readme.txt

simple-pregnancy-calculator/simple-pregnancy-calculator.php Passed 13 tests

This is the main PHP file of "Simple Pregnancy Calculator" version 1.1.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
48 characters long description:
Simple pregnancy calculator shortcode and widget

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin3,380 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript26723183,120
CSS1180149
PHP35121111

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.05
Average class complexity3.00
▷ Minimum class complexity3.00
▷ Maximum class complexity3.00
Average method complexity1.50
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.07MB with 0.05MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
img/pregnancy1.png68.24KB16.93KB▼ 75.19%