77% nota-fiscal-eletronica-woocommerce

Code Review | Nota Fiscal Eletrônica WooCommerce

WordPress plugin Nota Fiscal Eletrônica WooCommerce scored77%from 54 tests.

About plugin

  • Plugin page: nota-fiscal-eletr...
  • Plugin version: 3.3.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.4
  • WordPress version: 6.3.1
  • First release: Mar 31, 2016
  • Latest release: Nov 29, 2023
  • Number of updates: 320
  • Update frequency: every 8.8 days
  • Top authors: webmaniabr (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

500+ active /31,032 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.03MB] [CPU: ▼8.42ms] Passed 4 tests

This is a short check of server-side resources used by Nota Fiscal Eletrônica WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0435.58 ▼4.41
Dashboard /wp-admin3.35 ▲0.0050.36 ▼10.44
Posts /wp-admin/edit.php3.46 ▲0.1147.88 ▲0.90
Add New Post /wp-admin/post-new.php5.93 ▲0.0487.87 ▼17.54
Media Library /wp-admin/upload.php3.27 ▲0.0433.54 ▼1.30

Server storage [IO: ▲29.14MB] [DB: ▲0.00MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Just a few items left to fix
  • The filesystem usage should be lower than 25MB (currently using 29.14MB)
Filesystem: 252 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
widget_recent-posts
woocommercenfe_error_messages
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Nota Fiscal Eletrônica WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.34 ▼0.361.75 ▼0.1438.47 ▼5.87
Dashboard /wp-admin2,195 ▲185.61 ▲0.0992.75 ▼6.6039.21 ▼3.39
Posts /wp-admin/edit.php2,100 ▲32.03 ▲0.0038.86 ▲1.9035.64 ▼0.01
Add New Post /wp-admin/post-new.php1,526 ▼323.85 ▲0.41583.51 ▼22.7849.77 ▼12.91
Media Library /wp-admin/upload.php1,400 ▲34.17 ▼0.0294.98 ▼2.4144.34 ▲3.68

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • woocommercenfe_error_messages
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • 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: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/pdf/tcpdf/tools/tcpdf_addfont.php
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WooCommerceNFe' not found in wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/gateways/pagseguro.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WooCommerceNFe' not found in wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/gateways/bacs.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'TCPDF' not found in wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/pdf/tcpdf/tcpdi.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'WooCommerceNFe' not found in wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/gateways/paypal.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WooCommerceNFe' not found in wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/gateways/ebanx.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/pdf/tcpdf/fpdf_tpl.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'WooCommerceNFe' not found in wp-content/plugins/nota-fiscal-eletronica-woocommerce/inc/gateways/pagarme.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% 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 to be fixed:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
  • Screenshots: Please add an image for screenshot #7 (E-mail enviado para o cliente automaticamente.)
The official readme.txt is a good inspiration

nota-fiscal-eletronica-woocommerce/woocommerce_nfe.php 92% from 13 tests

"Nota Fiscal Eletrônica WooCommerce" version 3.3.6's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("nota-fiscal-eletronica-woocommerce.php" instead of "woocommerce_nfe.php")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin54,379 lines of code in 124 files:
LanguageFilesBlank linesComment linesLines of code
PHP1153,11813,29853,288
PO File2218274554
JavaScript411512322
CSS2280175
JSON10040

PHP code 0% from 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Please fix the following
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 4,349)
  • Method cyclomatic complexity should be reduced to less than 100 (currently 499)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity217.60
▷ Minimum class complexity1.00
▷ Maximum class complexity4,349.00
Average method complexity9.15
▷ Minimum method complexity1.00
▷ Maximum method complexity499.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes35
▷ Abstract classes00.00%
▷ Concrete classes35100.00%
▷ Final classes00.00%
Methods927
▷ Static methods14415.53%
▷ Public methods63168.07%
▷ Protected methods28330.53%
▷ Private methods131.40%
Functions6
▷ Named functions350.00%
▷ Anonymous functions350.00%
Constants121
▷ Global constants121100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There are no PNG files in this plugin