72% ncm-api

Code Review | NCM API

WordPress plugin NCM API scored72%from 54 tests.

About plugin

  • Plugin page: ncm-api
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Nov 7, 2021
  • Latest release: Nov 8, 2021
  • Number of updates: 4
  • Update frequency: every 1.3 days
  • Top authors: nepalcangroup (100%)

Code review

54 tests

User reviews

1 review

Install metrics

30+ active /389 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼4.22ms] 75% from 4 tests

Server-side resources used by NCM API
The following require your attention
  • CPU: Try to keep total CPU usage under 500.00ms (currently 1,043.30ms on /wp-admin/admin.php?page=ncm-api-settings)
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0343.72 ▲2.75
Dashboard /wp-admin3.33 ▲0.0346.25 ▼4.61
Posts /wp-admin/edit.php3.38 ▲0.0247.11 ▼2.86
Add New Post /wp-admin/post-new.php5.91 ▲0.0284.41 ▼10.88
Media Library /wp-admin/upload.php3.25 ▲0.0235.83 ▲1.49
NCM Orders /wp-admin/admin.php?page=ncm-orders-list3.2832.42
Dashboard /wp-admin/admin.php?page=ncm-api-settings3.271,043.30
Non NCM Orders /wp-admin/admin.php?page=non-ncm-orders-list3.2931.14

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 1,748 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
widget_recent-posts
widget_recent-comments
db_upgraded
theysaidso_admin_options
recovery_mode_email_last_sent
widget_theysaidso_widget

Browser metrics Passed 4 tests

NCM API: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,935 ▲20013.63 ▼0.995.57 ▲4.0142.50 ▲2.54
Dashboard /wp-admin2,233 ▲414.81 ▼0.17108.07 ▼9.1938.49 ▼4.80
Posts /wp-admin/edit.php2,116 ▲272.04 ▲0.0239.29 ▼1.3535.64 ▼2.25
Add New Post /wp-admin/post-new.php1,556 ▲4223.05 ▲5.56664.64 ▼5.2563.04 ▲11.49
Media Library /wp-admin/upload.php1,409 ▲244.21 ▼0.1196.07 ▼5.0841.17 ▼0.47
NCM Orders /wp-admin/admin.php?page=ncm-orders-list7242.0817.4339.73
Dashboard /wp-admin/admin.php?page=ncm-api-settings8482.3533.0932.56
Non NCM Orders /wp-admin/admin.php?page=non-ncm-orders-list7242.1811.5721.01

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • db_upgraded
    • recovery_mode_email_last_sent
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=ncm-orders-list
    • > Error in wp-content/plugins/ncm-api/admin/partials/ncm-api-order-list.php+2
    Uncaught Error: Class 'WC_Order_Query' not found in wp-content/plugins/ncm-api/admin/partials/ncm-api-order-list.php:2
    Stack trace:
    #0 wp-content/plugins/ncm-api/admin/class-ncm-api-admin.php(191): include_once()
    #1 wp-includes/class-wp-hook.php(310): Ncm_Api_Admin->ncm_orders()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=non-ncm-orders-list
    • > Error in wp-content/plugins/ncm-api/admin/partials/all-order-list.php+2
    Uncaught Error: Class 'WC_Order_Query' not found in wp-content/plugins/ncm-api/admin/partials/all-order-list.php:2
    Stack trace:
    #0 wp-content/plugins/ncm-api/admin/class-ncm-api-admin.php(197): include_once()
    #1 wp-includes/class-wp-hook.php(310): Ncm_Api_Admin->non_ncm_orders()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown

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
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/ncm-api/admin/partials/ncm-api-admin-display.php
    • > /wp-content/plugins/ncm-api/public/partials/ncm-api-public-display.php
  • 9× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Order_Query' not found in wp-content/plugins/ncm-api/admin/partials/all-order-list.php:2
    • > PHP Warning
      Use of undefined constant NCM_API_PLUGIN_URI - assumed 'NCM_API_PLUGIN_URI' (this will throw an Error in a future version of PHP) in wp-content/plugins/ncm-api/admin/partials/ncm-api-dashboard.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/ncm-api/includes/upload-order.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ncm-api/includes/custom-input-order-edit.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Order_Query' not found in wp-content/plugins/ncm-api/admin/partials/ncm-api-order-list.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/ncm-api/includes/order-list-column.php:25
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ncm-api/includes/order-details.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ncm-api/includes/view-order-comment.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/ncm-api/admin/partials/ncm-api-dashboard.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

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
Attributes that need to be fixed:
  • Screenshots: These screenshots do not have images: #1 (Add the Token Provided by NCM to link your WordPress site to the Vendor Portal of NCM.), #2 (Go to “Non NCM Order” submenu to see all the orders that have been placed on our WordPress site.), #3 (Go to "NCM Order" submenu to veiw all the order placed to NCM Portal using your WordPress Site.), #4 (Add Comment and place update.), #5 (Place Order to NCM Portal from Woocommerce Edit page.), #6 (Place Order to NCM Portal from NON NCM Order Table View.)
You can take inspiration from this readme.txt

ncm-api/ncm-api.php Passed 13 tests

The primary PHP file in "NCM API" version 1.0.0 is used by WordPress to initiate all plugin functionality
96 characters long description:
NCM API Plugin helps all the NCM Vendors to connect their wordpress website with the NCM Portal.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected130,626 lines of code in 1,718 files:
LanguageFilesBlank linesComment linesLines of code
JSON20060,839
YAML40025,394
SVG1,61501216,003
JavaScript219273928,975
CSS193,676948,801
Sass18507344,780
LESS18504554,738
PHP213065741,096

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity3.12
▷ Minimum class complexity1.00
▷ Maximum class complexity11.00
Average method complexity1.59
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods29
▷ Static methods26.90%
▷ Public methods2482.76%
▷ Protected methods00.00%
▷ Private methods517.24%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
9 PNG files occupy 0.94MB with 0.60MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/Screenshot-1.png114.16KB41.73KB▼ 63.45%
assets/Screenshot-4.png194.54KB65.00KB▼ 66.59%
assets/square-icon.png60.29KB27.25KB▼ 54.81%
assets/Screenshot-3.png153.05KB52.46KB▼ 65.73%
assets/icon.png27.69KB7.82KB▼ 71.74%