72% library-management-system

Code Review | Library Management System

WordPress plugin Library Management System scored72%from 54 tests.

About plugin

  • Plugin page: library-managemen...
  • Plugin version: 2.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.2.2
  • WordPress version: 6.3.1
  • First release: Nov 5, 2018
  • Latest release: Jul 31, 2023
  • Number of updates: 74
  • Update frequency: every 23.4 days
  • Top authors: owthub (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

200+ active /8,651 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.48MB] [CPU: ▼4.83ms] Passed 4 tests

This is a short check of server-side resources used by Library Management System
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4641.48 ▲3.76
Dashboard /wp-admin3.84 ▲0.5049.70 ▼10.65
Posts /wp-admin/edit.php3.90 ▲0.5445.83 ▼0.88
Add New Post /wp-admin/post-new.php6.36 ▲0.4884.73 ▼8.35
Media Library /wp-admin/upload.php3.70 ▲0.4740.07 ▲0.57
Issue Book /wp-admin/admin.php?page=owt-lib-create-book-issue3.6634.78
Issued History /wp-admin/admin.php?page=owt-lib-book-issue-list3.7034.29
Returned History /wp-admin/admin.php?page=owt-lib-return-book-list3.7135.18
Settings Panel /wp-admin/admin.php?page=owt-lib-manage-settings3.8834.12
/wp-admin/admin.php?page=owt-lib-create-user3.9037.56
Dashboard /wp-admin/admin.php?page=owt-lib-manage3.7236.15
Bookcase & Sections /wp-admin/admin.php?page=owt-lib-manage-bookcase3.7134.23
Categories & Books /wp-admin/admin.php?page=owt-lib-manage-books3.7234.66
Departments & Users /wp-admin/admin.php?page=owt-lib-manage-users3.7131.31
Return Book /wp-admin/admin.php?page=owt-lib-create-book-return3.7035.32

Server storage [IO: ▲7.95MB] [DB: ▲0.02MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 106 new files
Database: 14 new tables, 8 new options
New tables
wp_owt_lib_category
wp_owt_lib_students
wp_owt_lib_return_book
wp_owt_lib_staff_type
wp_owt_lib_currency_code
wp_owt_lib_bookcase_sections
wp_owt_lib_days_settings
wp_owt_lib_books
wp_owt_lib_branch
wp_owt_lib_staffs
...
New WordPress options
db_upgraded
widget_recent-posts
owt_lib_book_late_fine
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
theysaidso_admin_options
owt_lib_currency_code

Browser metrics Passed 4 tests

An overview of browser requirements for Library Management System
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,973 ▲21213.57 ▼1.0610.61 ▲9.0141.80 ▲3.50
Dashboard /wp-admin2,255 ▲815.52 ▼0.0192.58 ▲8.6943.69 ▲3.39
Posts /wp-admin/edit.php2,160 ▲602.00 ▲0.0133.42 ▼2.9934.34 ▼1.75
Add New Post /wp-admin/post-new.php1,572 ▲4023.43 ▲0.28679.62 ▲33.4952.53 ▲3.89
Media Library /wp-admin/upload.php1,460 ▲664.17 ▼0.0593.62 ▼4.2942.42 ▼0.37
Issue Book /wp-admin/admin.php?page=owt-lib-create-book-issue1,0836.53174.0779.83
Issued History /wp-admin/admin.php?page=owt-lib-book-issue-list1,0865.46170.4526.35
Returned History /wp-admin/admin.php?page=owt-lib-return-book-list1,1765.45112.6026.86
Settings Panel /wp-admin/admin.php?page=owt-lib-manage-settings1,6526.50102.3728.59
/wp-admin/admin.php?page=owt-lib-create-user2,5146.66114.1577.81
Dashboard /wp-admin/admin.php?page=owt-lib-manage1,2346.4595.5747.29
Bookcase & Sections /wp-admin/admin.php?page=owt-lib-manage-bookcase1,2015.59111.2824.58
Categories & Books /wp-admin/admin.php?page=owt-lib-manage-books1,2255.42108.0627.41
Departments & Users /wp-admin/admin.php?page=owt-lib-manage-users1,1745.42106.5124.37
Return Book /wp-admin/admin.php?page=owt-lib-create-book-return1,0146.4491.8827.26

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
These items require your attention
  • This plugin does not fully uninstall, leaving 8 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • owt_lib_book_late_fine
    • widget_theysaidso_widget
    • owt_lib_currency_code
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=owt-lib-manage-settings
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=owt-lib-manage-settings
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query does not contain the correct number of placeholders (0) for the number of arguments passed (1). Please see Debugging in WordPress for more information. (This message was added in version 4.8.3.)

SRP 0% 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
Almost there! Just fix the following items
  • 24× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/library-management-system/admin/views/book/tmpl-lms-books-list.php
    • > /wp-content/plugins/library-management-system/admin/views/owt-lms-dashboard.php
    • > /wp-content/plugins/library-management-system/admin/views/staff/owt-lms-create-staff.php
    • > /wp-content/plugins/library-management-system/admin/views/book/owt-lms-create-book.php
    • > /wp-content/plugins/library-management-system/admin/views/report/owt-lms-student-book-issue-list.php
    • > /wp-content/plugins/library-management-system/admin/views/common.php
    • > /wp-content/plugins/library-management-system/admin/views/report/owt-lms-book-return-list.php
    • > /wp-content/plugins/library-management-system/public/views/owt-lms-frontend-tabs.php
    • > /wp-content/plugins/library-management-system/admin/views/report/owt-lms-entry-return-book.php
    • > /wp-content/plugins/library-management-system/admin/views/report/owt-lib-contact-details.php
  • 103× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      count(): Parameter must be an array or an object that implements Countable in wp-content/plugins/library-management-system/admin/views/staff/owt-lms-create-staff.php on line 50
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/library-management-system/admin/views/report/owt-lms-create-issue-book.php on line 63
    • > PHP Warning
      include_once(OWT_LIBRARY_PLUGIN_DIR_PATHadmin/views/common.php): failed to open stream: No such file or directory in wp-content/plugins/library-management-system/admin/views/book/owt-lms-create-book.php on line 23
    • > PHP Warning
      include_once(): Failed opening 'OWT_LIBRARY_PLUGIN_DIR_PATHadmin/views/common.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/library-management-system/admin/views/report/owt-lms-entry-return-book.php on line 13
    • > PHP Warning
      include_once(OWT_LIBRARY_PLUGIN_DIR_PATHadmin/views/common.php): failed to open stream: No such file or directory in wp-content/plugins/library-management-system/admin/views/book/owt-lms-books-list.php on line 13
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/library-management-system/admin/views/report/owt-lms-create-issue-book.php on line 33
    • > PHP Warning
      Use of undefined constant OWT_LIBRARY_PLUGIN_BOOK_CURRENCY - assumed 'OWT_LIBRARY_PLUGIN_BOOK_CURRENCY' (this will throw an Error in a future version of PHP) in wp-content/plugins/library-management-system/admin/views/report/owt-lms-book-return-list.php on line 96
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/library-management-system/admin/views/owt-lms-dashboard.php on line 26
    • > PHP Warning
      Use of undefined constant OWT_LIBRARY_PLUGIN_DIR_PATH - assumed 'OWT_LIBRARY_PLUGIN_DIR_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/library-management-system/admin/views/report/owt-lms-staff-book-return-list.php on line 12
    • > PHP Notice
      Undefined variable: params in wp-content/plugins/library-management-system/admin/views/report/owt-lms-create-issue-book.php on line 33

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 93% 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:
  • Plugin Name: Please replace "Plugin Name" with the name of your plugin on the first line ( === library-management-system === )
The official readme.txt is a good inspiration

library-management-system/library-management-system.php 92% from 13 tests

The main PHP script in "Library Management System" version 2.0.0 is automatically included on every request by WordPress
The following require your attention:
  • Description: Please don't use more than 140 characters for the plugin description (currently 274 characters long)

Code Analysis 97% from 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
Success! There were no dangerous files found in this plugin29,878 lines of code in 66 files:
LanguageFilesBlank linesComment linesLines of code
SVG61313,301
CSS132,79418210,327
PHP357645315,077
JavaScript1171751,166
Markdown1207

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 265)
Cyclomatic complexity
Average complexity per logical line of code0.50
Average class complexity51.00
▷ Minimum class complexity1.00
▷ Maximum class complexity306.00
Average method complexity5.79
▷ Minimum method complexity1.00
▷ Maximum method complexity265.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods73
▷ Static methods00.00%
▷ Public methods6893.15%
▷ Protected methods00.00%
▷ Private methods56.85%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants8100.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
8 PNG files occupy 0.23MB with 0.09MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/teacher.png148.74KB58.46KB▼ 60.69%
assets/images/blank-user.png18.84KB7.92KB▼ 57.97%
assets/images/sort_asc.png0.16KB0.25KB0.00%
assets/images/issue-return.png5.90KB4.75KB▼ 19.59%
assets/images/student.png55.40KB25.88KB▼ 53.29%