57% course-booking-system-extension

Code Review | Course Booking System Extension

WordPress plugin Course Booking System Extension scored57%from 54 tests.

About plugin

  • Plugin page: course-booking-sy...
  • Plugin version: 0.4.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8.1-5.9
  • WordPress version: 6.3.1
  • First release: Jul 12, 2021
  • Latest release: Feb 15, 2022
  • Number of updates: 75
  • Update frequency: every 2.9 days
  • Top authors: codesport (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,080 total downloads

Benchmarks

Plugin footprint 64% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.82MB] [CPU: ▼1.27ms] Passed 4 tests

Analyzing server-side resources used by Course Booking System Extension
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.02 ▲0.5640.15 ▲1.01
Dashboard /wp-admin4.23 ▲0.9347.57 ▼4.56
Posts /wp-admin/edit.php4.28 ▲0.9347.02 ▲0.09
Add New Post /wp-admin/post-new.php6.80 ▲0.9184.78 ▼1.60
Media Library /wp-admin/upload.php4.09 ▲0.8740.46 ▲7.30
Course Booking System Extension /wp-admin/options-general.php?page=course_booking_system_extension4.0633.82

Server storage [IO: ▲30.55MB] [DB: ▲0.00MB] 33% from 3 tests

Input-output and database impact of this plugin
Just a few items left to fix
  • There were 3 files (2.18KB) illegally modified outside of "wp-content/plugins/course-booking-system-extension/" and "wp-content/uploads/"
    • (new file) wp-admin/var/www/wordpress/wp-content/cbse/logs/2023-10-23.log
    • (new file) wp-content/themes/twentytwentyone/mp-timetable/shortcodes/cbse_event_head_courses-single.php
    • (new file) var/www/wordpress/wp-content/cbse/logs/2023-10-23.log
  • Total filesystem usage must be limited to 25MB (currently using 30.55MB)
Filesystem: 1,635 new files
Database: no new tables, 12 new options
New WordPress options
cbse_licenses_options
cbse_general_options
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
cbse_coach_mail_options
cbse_covid19_options
db_upgraded
cbse_auto_print_options
...

Browser metrics Passed 4 tests

Checking browser requirements for Course Booking System Extension
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.14 ▼0.151.60 ▼0.1240.10 ▼3.66
Dashboard /wp-admin2,193 ▲135.54 ▼0.1381.10 ▼14.3240.25 ▼2.39
Posts /wp-admin/edit.php2,107 ▲71.98 ▼0.0533.92 ▼1.0632.51 ▼6.24
Add New Post /wp-admin/post-new.php1,531 ▲523.31 ▲0.01626.62 ▼44.3852.00 ▼22.78
Media Library /wp-admin/upload.php1,404 ▲44.25 ▼0.0493.17 ▼2.9138.57 ▼3.99
Course Booking System Extension /wp-admin/options-general.php?page=course_booking_system_extension8521.9922.8325.78

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Warning in wp-includes/class-wp-hook.php+310
    call_user_func_array() expects parameter 1 to be a valid callback, function 'cbse_cron_deactivate' not found or invalid function name
  • Zombie WordPress options detected upon uninstall: 12 options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • cbse_covid19_options
    • cbse_pdf_header_options
    • widget_recent-posts
    • cbse_coach_mail_options
    • widget_theysaidso_widget
    • cbse_licenses_options
    • theysaidso_admin_options
    • ...

Smoke tests 50% 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 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
The following issues need your attention
  • 93× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_png.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/example_035.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/example_033.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/example_016.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/example_014.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_pdf417_html.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/example_036.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/example_062.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/barcodes/example_2d_qrcode_svg.php
    • > /wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/example_048.php
  • 197× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CBSE\\Admin\\Settings\\CbseSettings' not found in wp-content/plugins/course-booking-system-extension/src/Admin/Settings/AutoPrintCbseSettings.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Spatie\\Enum\\Enum' not found in wp-content/plugins/course-booking-system-extension/vendor/spatie/icalendar-generator/src/Enums/Classification.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Spatie\\IcalendarGenerator\\Properties\\Property' not found in wp-content/plugins/course-booking-system-extension/vendor/spatie/icalendar-generator/src/Properties/DateTimeProperty.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Translation\\Catalogue\\AbstractOperation' not found in wp-content/plugins/course-booking-system-extension/vendor/symfony/translation/Catalogue/MergeOperation.php:25
    • > PHP Fatal error
      Uncaught ReflectionException: Class Symfony\\Component\\Translation\\Translator does not exist in wp-content/plugins/course-booking-system-extension/vendor/nesbot/carbon/src/Carbon/Translator.php:22
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Translation\\Exception\\ExceptionInterface' not found in wp-content/plugins/course-booking-system-extension/vendor/symfony/translation/Exception/InvalidResourceException.php:19
    • > PHP Fatal error
      require_once(): Failed opening required 'lib/Analog.php' (include_path='.:/usr/share/php') in wp-content/plugins/course-booking-system-extension/vendor/analog/analog/tests/PsrLogCompatTest.php on line 5
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Translation\\Exception\\RuntimeException' not found in wp-content/plugins/course-booking-system-extension/vendor/symfony/translation/Exception/ProviderException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Carbon\\Exceptions\\UnitException' not found in wp-content/plugins/course-booking-system-extension/vendor/nesbot/carbon/src/Carbon/Exceptions/UnitNotConfiguredException.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'CBSE\\Database\\DatabaseBase' not found in wp-content/plugins/course-booking-system-extension/src/Database/CoursesForAthlete.php:8

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

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed: You can take inspiration from this readme.txt

course-booking-system-extension/course-booking-system-extension.php Passed 13 tests

The primary PHP file in "Course Booking System Extension" version 0.4.2 is used by WordPress to initiate all plugin functionality
35 characters long description:
Extension for Course Booking System

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
These items require your attention
  • Do not distribute dangerous files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/course-booking-system-extension/vendor/bin/carbon.bat
      • wp-content/plugins/course-booking-system-extension/vendor/nesbot/carbon/bin/carbon.bat
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/course-booking-system-extension/vendor/tecnickcom/tcpdf/examples/data/cert/tcpdf.crt
102,894 lines of code in 1,278 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,22212,61844,91494,905
XSD392482,803
SVG3111,882
JSON13001,536
Markdown2065601,490
YAML5360133
XML51092
JavaScript12235
CSS30010
DOS Batch2008
HTML1010

PHP code 0% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please tend to the following items
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 4,413)
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 502)
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity29.46
▷ Minimum class complexity1.00
▷ Maximum class complexity4,413.00
Average method complexity4.66
▷ Minimum method complexity1.00
▷ Maximum method complexity502.00
Code structure
Namespaces57
Interfaces30
Traits28
Classes279
▷ Abstract classes207.17%
▷ Concrete classes25992.83%
▷ Final classes228.49%
Methods3,029
▷ Static methods61520.30%
▷ Public methods2,39278.97%
▷ Protected methods43314.30%
▷ Private methods2046.73%
Functions329
▷ Named functions6218.84%
▷ Anonymous functions26781.16%
Constants275
▷ Global constants14352.00%
▷ Class constants13248.00%
▷ Public constants12695.45%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
7 PNG files occupy 0.56MB with 0.23MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/tecnickcom/tcpdf/examples/images/tcpdf_cell.png37.51KB36.62KB▼ 2.39%
vendor/tecnickcom/tcpdf/examples/images/img.png190.57KB64.69KB▼ 66.06%
vendor/tecnickcom/tcpdf/examples/images/alpha.png23.33KB30.34KB0.00%
vendor/tecnickcom/tcpdf/examples/images/tcpdf_signature.png66.34KB25.47KB▼ 61.61%
vendor/tecnickcom/tcpdf/examples/images/image_with_alpha.png238.49KB61.71KB▼ 74.12%