58% pets

Code Review | Pets

WordPress plugin Pets scored58%from 54 tests.

About plugin

  • Plugin page: pets
  • Plugin version: 1.4.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.9.3
  • WordPress version: 6.3.1
  • First release: May 27, 2018
  • Latest release: Apr 17, 2022
  • Number of updates: 35
  • Update frequency: every 40.6 days
  • Top authors: ibenic (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /4,867 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲5.17MB] [CPU: ▲25.48ms] 75% from 4 tests

An overview of server-side resources used by Pets
Please have a look at the following items
  • Extra RAM: Extra memory usage should kept under 5MB (currently 5.17MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /8.82 ▲5.3574.84 ▲32.66
Dashboard /wp-admin8.84 ▲5.5376.47 ▲25.92
Posts /wp-admin/edit.php8.84 ▲5.4883.13 ▲31.35
Add New Post /wp-admin/post-new.php10.21 ▲4.32118.38 ▲12.95
Media Library /wp-admin/upload.php8.84 ▲5.6169.84 ▲31.68
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius8.8457.75

Server storage [IO: ▲3.13MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 220 new files
Database: 2 new tables, 15 new options
New tables
wp_pets_fields_sections
wp_pets_fields
New WordPress options
widget_pets_search
widget_recent-comments
fs_gdpr
widget_pets_add_missing
fs_accounts
fs_active_plugins
widget_pets_add
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
...

Browser metrics Passed 4 tests

An overview of browser requirements for Pets
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,917 ▲14613.33 ▼1.422.17 ▼0.0134.58 ▼12.82
Dashboard /wp-admin2,292 ▲1045.86 ▼0.0399.22 ▼3.7642.90 ▼6.83
Posts /wp-admin/edit.php2,172 ▲832.02 ▲0.0040.92 ▼1.2738.75 ▲1.75
Add New Post /wp-admin/post-new.php1,546 ▲1823.20 ▲5.07673.46 ▲15.4151.60 ▼2.82
Media Library /wp-admin/upload.php1,472 ▲844.14 ▼0.08107.40 ▼9.2646.44 ▼3.37
Freemius Debug [v.2.4.3] /wp-admin/admin.php?page=freemius1,1181.7724.9131.48

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/pets/freemius/includes/class-freemius.php+8575
    Undefined property: stdClass::$plugins
  • Zombie tables were found after uninstall: 2 tables
    • wp_pets_fields
    • wp_pets_fields_sections
  • Zombie WordPress options were found after uninstall: 15 options
    • fs_debug_mode
    • widget_pets_search
    • widget_theysaidso_widget
    • widget_pets_add_missing
    • pets_version
    • can_compress_scripts
    • fs_active_plugins
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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 fix the following items
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/pets/templates/before-loop.php
    • > /wp-content/plugins/pets/templates/before-loop-while.php
    • > /wp-content/plugins/pets/templates/after-loop-while.php
    • > /wp-content/plugins/pets/templates/after-loop.php
  • 27× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_the_ID() in wp-content/plugins/pets/templates/archive/single.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_admin_page_title() in wp-content/plugins/pets/includes/admin/settings/views/main.php:2
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/pets/includes/admin/class-pets-fields-sections-table.php on line 11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/pets/includes/widgets/class-widgets-add-missing.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Pets\\DB\\Fields' not found in wp-content/plugins/pets/templates/missing-form.php:6
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/pets/includes/admin/class-pets-fields-table.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/pets/includes/widgets/class-widgets-search.php:14
    • > PHP Notice
      Undefined variable: information in wp-content/plugins/pets/templates/single/information.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_header() in wp-content/plugins/pets/templates/archive/loop.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_type_archive_link() in wp-content/plugins/pets/templates/search-form.php:8

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 Passed 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
3 plugin tags: animals, pets, animal shelter

pets/pets.php Passed 13 tests

"Pets" version 1.4.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
31 characters long description:
Manage Pets and Animal Shelters

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin35,219 lines of code in 178 files:
LanguageFilesBlank linesComment linesLines of code
PHP1588,08017,31034,256
JavaScript46477348
CSS1300301
LESS2540291
SVG10023

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
The following items need your attention
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 2,911)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity59.31
▷ Minimum class complexity1.00
▷ Maximum class complexity2,911.00
Average method complexity4.39
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces5
Interfaces0
Traits0
Classes75
▷ Abstract classes34.00%
▷ Concrete classes7296.00%
▷ Final classes11.39%
Methods1,323
▷ Static methods21216.02%
▷ Public methods97673.77%
▷ Protected methods181.36%
▷ Private methods32924.87%
Functions111
▷ Named functions111100.00%
▷ Anonymous functions00.00%
Constants128
▷ Global constants10380.47%
▷ Class constants2519.53%
▷ Public constants25100.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
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%