61% word-count-analysis

Code Review | Word Count Analysis

WordPress plugin Word Count Analysis scored61%from 54 tests.

About plugin

  • Plugin page: word-count-analysis
  • Plugin version: 1.0.11
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.1
  • WordPress version: 6.3.1
  • First release: Jun 2, 2022
  • Latest release: Mar 8, 2023
  • Number of updates: 63
  • Update frequency: every 4.4 days
  • Top authors: nusert (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /3,176 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

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

A check of server-side resources used by Word Count Analysis
It is recommended to improve the following
  • Extra RAM: Try to keep extra memory usage under 5MB (currently 5.30MB on /wp-admin/admin.php?page=word-count-analysis)
PageMemory (MB)CPU Time (ms)
Home /9.29 ▲5.8335.09 ▼9.19
Dashboard /wp-admin9.31 ▲6.0040.59 ▼8.07
Posts /wp-admin/edit.php9.31 ▲5.9540.58 ▼8.46
Add New Post /wp-admin/post-new.php9.31 ▲3.4238.86 ▼55.88
Media Library /wp-admin/upload.php9.31 ▲6.0837.64 ▲4.45
Freemius Debug [v.2.5.3] /wp-admin/admin.php?page=freemius9.3133.66
Word Count & Analysis /wp-admin/admin.php?page=word-count-analysis9.3135.44

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 268 new files
Database: 1 new table, 11 new options
New tables
wp_wca_posts
New WordPress options
fs_accounts
fs_gdpr
fs_debug_mode
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
db_upgraded
wca_version
can_compress_scripts
fs_active_plugins
...

Browser metrics Passed 4 tests

Checking browser requirements for Word Count Analysis
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,010 ▲27513.56 ▼1.024.82 ▲2.7226.48 ▼24.12
Dashboard /wp-admin2,324 ▲1335.86 ▲0.99104.28 ▼0.1643.97 ▼1.41
Posts /wp-admin/edit.php2,160 ▲712.04 ▲0.0042.07 ▼0.1837.59 ▲1.58
Add New Post /wp-admin/post-new.php1,541 ▲522.98 ▼0.25683.65 ▲0.0464.21 ▲4.07
Media Library /wp-admin/upload.php1,443 ▲554.22 ▲0.04101.58 ▼10.1845.50 ▼7.17
Freemius Debug [v.2.5.3] /wp-admin/admin.php?page=freemius1,0991.7230.9429.39
Word Count & Analysis /wp-admin/admin.php?page=word-count-analysis1,0011.7328.1158.84

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the ajax-script handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • This plugin does not fully uninstall, leaving 10 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • fs_gdpr
    • fs_active_plugins
    • can_compress_scripts
    • fs_accounts
    • fs_debug_mode

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=word-count-analysis
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the ajax-script handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)

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
Please fix the following items
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/word-count-analysis/templates/footer.php
    • > /wp-content/plugins/word-count-analysis/plugin.php
  • 14× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/word-count-analysis/wca_hook.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/word-count-analysis/word-count-analysis.php:28
    • > PHP Warning
      include_once(WCA_LIBSStopWords.php): failed to open stream: No such file or directory in wp-content/plugins/word-count-analysis/libs/words.php on line 2
    • > PHP Warning
      Use of undefined constant WCA_LIBS - assumed 'WCA_LIBS' (this will throw an Error in a future version of PHP) in wp-content/plugins/word-count-analysis/libs/words.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/word-count-analysis/templates/tab-authors.php:1
    • > PHP Warning
      include_once(): Failed opening 'WCA_LIBSStopWords.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/word-count-analysis/libs/words.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/word-count-analysis/vendor/vanderlee/php-sentence/tests/SentenceTest.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/word-count-analysis/templates/tab-posts.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/word-count-analysis/templates/tab-dashboard.php:1
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/word-count-analysis/templates/header.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes: The official readme.txt might help

word-count-analysis/word-count-analysis.php 77% from 13 tests

The entry point to "Word Count Analysis" version 1.0.11 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Requires PHP: Required version must match the one declared in readme.txt ("7.0" instead of "7.4")
  • Description: Keep the plugin description shorter than 140 characters (currently 148 characters long)
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis 97% 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
No dangerous file extensions were detected39,502 lines of code in 189 files:
LanguageFilesBlank linesComment linesLines of code
PHP1478,45817,81134,976
HTML955641,617
JavaScript81852111,478
CSS172591661,005
Markdown2950282
JSON30097
YAML24031
XML11016

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
The following items need your attention
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 3,089)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity76.85
▷ Minimum class complexity1.00
▷ Maximum class complexity3,089.00
Average method complexity4.41
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes60
▷ Abstract classes23.33%
▷ Concrete classes5896.67%
▷ Final classes00.00%
Methods1,366
▷ Static methods22116.18%
▷ Public methods95870.13%
▷ Protected methods181.32%
▷ Private methods39028.55%
Functions107
▷ Named functions10093.46%
▷ Anonymous functions76.54%
Constants151
▷ Global constants10368.21%
▷ Class constants4831.79%
▷ Public constants48100.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
12 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
vendor/vanderlee/php-sentence/doc/resources/sort.png0.17KB0.12KB▼ 30.41%
vendor/vanderlee/php-sentence/doc/resources/collapsed.png0.23KB0.14KB▼ 39.08%
vendor/vanderlee/php-sentence/doc/resources/tree-last.png0.17KB0.11KB▼ 36.05%
vendor/vanderlee/php-sentence/doc/resources/inherit.png0.15KB0.10KB▼ 29.61%