57% yaexam

Code Review | YaExam

WordPress plugin YaExam scored57%from 54 tests.

About plugin

  • Plugin page: yaexam
  • Plugin version: 1.0.7
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.4
  • WordPress version: 6.3.1
  • First release: Jul 10, 2020
  • Latest release: Jul 21, 2020
  • Number of updates: 13
  • Update frequency: every 0.9 days
  • Top authors: yaexam (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /4,964 total downloads

Benchmarks

Plugin footprint 48% 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.46MB] [CPU: ▲1.07ms] Passed 4 tests

A check of server-side resources used by YaExam
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.90 ▲0.4453.63 ▲13.21
Dashboard /wp-admin3.79 ▲0.4954.69 ▲3.33
Posts /wp-admin/edit.php3.82 ▲0.4662.67 ▲7.36
Add New Post /wp-admin/post-new.php6.55 ▲0.6683.29 ▼9.34
Media Library /wp-admin/upload.php3.68 ▲0.4543.16 ▲2.93
Extensions /wp-admin/admin.php?page=em-extensions3.6448.59
Add Exam /wp-admin/post-new.php?post_type=exam6.57101.58
Settings /wp-admin/admin.php?page=em-settings3.6346.82
Dashboard /wp-admin/admin.php?page=yaexam3.6346.84
Questions /wp-admin/admin.php?page=em-questions3.7545.15
Exams /wp-admin/edit.php?post_type=exam3.6650.77
Categories /wp-admin/edit-tags.php?taxonomy=exam_cat&post_type=exam3.7545.25
Results /wp-admin/edit.php?post_type=exam&page=em-results3.6445.96
Tags /wp-admin/edit-tags.php?taxonomy=exam_tag&post_type=exam3.6243.03

Server storage [IO: ▲17.85MB] [DB: ▲0.03MB] Passed 3 tests

Filesystem and database footprint
The plugin installed successfully
Filesystem: 1,040 new files
Database: 10 new tables, 28 new options
New tables
wp_yaexam_results
wp_yaexam_question_categories
wp_yaexam_save_later
wp_yaexam_questions
wp_yaexam_user_sessions
wp_yaexam_sessions
wp_yaexam_exam_questions
wp_yaexam_exam_sessions
wp_yaexam_exam_results
wp_yaexam_user_questions
New WordPress options
yaexam_email_setting_user_registered_subject
yaexam_email_setting_footer
yaexam_default_exam_orderby
yaexam_db_version
yaexam_login_page_id
widget_yaexam_exam_categories
yaexam_myaccount_page_id
yaexam_version
yaexam_email_setting_user_registered_content
yaexam_is_uninstall_remove_data
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for YaExam
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,876 ▲11514.18 ▼0.191.85 ▲0.1640.89 ▼6.11
Dashboard /wp-admin2,262 ▲915.56 ▼0.1191.22 ▼0.7542.80 ▼1.03
Posts /wp-admin/edit.php2,176 ▲732.00 ▲0.0139.74 ▼6.2736.63 ▲0.16
Add New Post /wp-admin/post-new.php1,593 ▲6523.06 ▼0.08718.45 ▲104.8063.13 ▲10.59
Media Library /wp-admin/upload.php1,470 ▲704.17 ▲0.0997.63 ▼10.9343.33 ▼5.32
Extensions /wp-admin/admin.php?page=em-extensions1,11912.06223.5990.67
Add Exam /wp-admin/post-new.php?post_type=exam6,46228.411,192.9458.04
Settings /wp-admin/admin.php?page=em-settings1,30111.74179.7642.01
Dashboard /wp-admin/admin.php?page=yaexam1,11611.86172.7662.65
Questions /wp-admin/admin.php?page=em-questions1,27712.17177.1544.23
Exams /wp-admin/edit.php?post_type=exam1,33810.13204.3641.55
Categories /wp-admin/edit-tags.php?taxonomy=exam_cat&post_type=exam1,3502.1231.9231.98
Results /wp-admin/edit.php?post_type=exam&page=em-results1,13312.02171.8633.51
Tags /wp-admin/edit-tags.php?taxonomy=exam_tag&post_type=exam1,3192.2432.5430.98

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-admin/includes/plugin.php+1242
    Constant WP_UNINSTALL_PLUGIN already defined
  • The uninstall procedure failed, leaving 10 tables in the database
    • wp_yaexam_user_questions
    • wp_yaexam_results
    • wp_yaexam_save_later
    • wp_yaexam_exam_questions
    • wp_yaexam_questions
    • wp_yaexam_question_categories
    • wp_yaexam_user_sessions
    • wp_yaexam_exam_results
    • wp_yaexam_sessions
    • wp_yaexam_exam_sessions
  • This plugin does not fully uninstall, leaving 28 options in the database
    • yaexam_default_exam_orderby
    • yaexam_archive_exam_page_id
    • yaexam_email_setting_new_result_content
    • yaexam_db_version
    • widget_yaexam_exams
    • can_compress_scripts
    • yaexam_register_page_id
    • yaexam_email_setting_footer
    • theysaidso_admin_options
    • yaexam_email_setting_new_result_header
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Good news, no errors were detected

SRP 0% 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
  • 124× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIME.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xls.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_property_names.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar_stacked.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Basic/11_Documentsecurity.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Worksheet_count_and_names.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Basic/26_Utf8.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Basic/17_Html.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Basic/42_RichText.php
    • > /wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATEVALUE.php
  • 234× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'TCPDF' not found in wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Pdf/Tcpdf.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/yaexam/vendor/maennchen/zipstream-php/test/ZipStreamTest.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\Worksheet\\Dimension' not found in wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/RowDimension.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\RichText\\TextElement' not found in wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/RichText/Run.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\Reader\\BaseReader' not found in wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xls.php:61
    • > PHP Fatal error
      Uncaught Error: Class 'ZipStream\\Exception' not found in wp-content/plugins/yaexam/vendor/maennchen/zipstream-php/src/Exception/IncompatibleOptionsException.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Ramsey\\Uuid\\Uuid' not found in wp-content/plugins/yaexam/vendor/ramsey/uuid/src/DegradedUuid.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Brick\\Math\\Exception\\MathException' not found in wp-content/plugins/yaexam/vendor/brick/math/src/Exception/NegativeNumberException.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/yaexam/includes/admin/views/html-admin-question-category.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\BaseParserClass' not found in wp-content/plugins/yaexam/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php:9

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)
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots lack descriptions #1, #2, #3 in yaexam/assets to your readme.txt
Please take inspiration from this readme.txt

yaexam/yaexam.php Passed 13 tests

"YaExam" version 1.0.7's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
26 characters long description:
Create Custom Exams Online

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin148,031 lines of code in 835 files:
LanguageFilesBlank linesComment linesLines of code
PHP74323,05943,61189,287
XML725239,715
Markdown422,949011,480
CSS110144,009
SVG2111,630
JSON16001,597
HTML1240106
JavaScript610692
YAML613191
Bourne Again Shell16324

PHP code 0% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
These items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 1,011)
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 387)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity26.25
▷ Minimum class complexity1.00
▷ Maximum class complexity1,011.00
Average method complexity3.88
▷ Minimum method complexity1.00
▷ Maximum method complexity387.00
Code structure
Namespaces95
Interfaces44
Traits8
Classes424
▷ Abstract classes317.31%
▷ Concrete classes39392.69%
▷ Final classes307.63%
Methods4,404
▷ Static methods94621.48%
▷ Public methods3,56981.04%
▷ Protected methods1463.32%
▷ Private methods68915.64%
Functions483
▷ Named functions44792.55%
▷ Anonymous functions367.45%
Constants927
▷ Global constants222.37%
▷ Class constants90597.63%
▷ Public constants88998.23%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
34 PNG files occupy 0.98MB with 0.62MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/phpoffice/phpspreadsheet/docs/topics/images/08-styling-border-options.png18.44KB3.22KB▼ 82.55%
vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-2.png22.31KB8.30KB▼ 62.81%
vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-1.png50.57KB16.99KB▼ 66.40%
vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-1.png25.44KB10.81KB▼ 57.50%
assets/images/certificate.png9.60KB4.99KB▼ 48.04%