78% cm-answers

Code Review | CM Answers

WordPress plugin CM Answers scored78%from 54 tests.

About plugin

  • Plugin page: cm-answers
  • Plugin version: 3.2.2
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4.0-6.3
  • WordPress version: 6.3.1
  • First release: Mar 4, 2013
  • Latest release: Jul 23, 2023
  • Number of updates: 1
  • Update frequency: every 365.0 days

Code review

54 tests

User reviews

86 reviews

Install metrics

700+ active /131,162 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
Installer ran successfully

Server metrics [RAM: ▲0.31MB] [CPU: ▲1.93ms] 75% from 4 tests

A check of server-side resources used by CM Answers
The following require your attention
  • CPU: Total CPU usage should be kept under 500.00ms (currently 931.01ms on /wp-admin/admin.php?page=CMA_admin_settings)
PageMemory (MB)CPU Time (ms)
Home /3.78 ▲0.3245.40 ▲9.38
Dashboard /wp-admin3.61 ▲0.3153.13 ▲3.78
Posts /wp-admin/edit.php3.66 ▲0.3049.44 ▲4.71
Add New Post /wp-admin/post-new.php6.24 ▲0.3586.37 ▼4.99
Media Library /wp-admin/upload.php3.52 ▲0.3039.33 ▲4.20
Answers /wp-admin/edit-comments.php?post_type=cma_thread3.5440.88
User Guide /wp-admin/admin.php?page=cma_about3.66413.99
Settings /wp-admin/admin.php?page=CMA_admin_settings3.75931.01
Upgrade ➤ /wp-admin/admin.php?page=cma_pro3.5830.85
Questions /wp-admin/edit.php?post_type=cma_thread3.6442.96

Server storage [IO: ▲1.31MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
This plugin installed successfully
Filesystem: 95 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
db_upgraded
widget_recent-posts
cma_afterActivation
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for CM Answers
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,051 ▲29014.28 ▼0.371.72 ▲0.1344.17 ▲7.64
Dashboard /wp-admin2,411 ▲2305.55 ▼0.1382.97 ▼29.4441.36 ▼8.05
Posts /wp-admin/edit.php2,142 ▲422.02 ▼0.0133.37 ▼10.7638.70 ▼1.65
Add New Post /wp-admin/post-new.php1,563 ▲3723.48 ▲0.29665.92 ▼7.7555.54 ▼9.96
Media Library /wp-admin/upload.php1,445 ▲424.21 ▲0.0296.62 ▼2.0547.42 ▲5.86
Answers /wp-admin/edit-comments.php?post_type=cma_thread2,0642.2737.0036.18
User Guide /wp-admin/admin.php?page=cma_about3,12712.73248.03188.32
Settings /wp-admin/admin.php?page=CMA_admin_settings2,7937.9164.1960.48
Upgrade ➤ /wp-admin/admin.php?page=cma_pro2,3702.3143.2251.50
Questions /wp-admin/edit.php?post_type=cma_thread2,1291.9833.4833.25

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 does not fully uninstall, leaving 7 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • cma_afterActivation

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 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 15× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cm-answers/package/views/registration.php:42
    • > PHP Fatal error
      Uncaught Error: Class 'CMA_BaseController' not found in wp-content/plugins/cm-answers/lib/controllers/AnswerController.php:3
    • > PHP Warning
      Use of undefined constant CMA_PATH - assumed 'CMA_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cm-answers/lib/controllers/AnswerController.php on line 2
    • > PHP Warning
      include_once(CMA_PATH/lib/models/PostType.php): failed to open stream: No such file or directory in wp-content/plugins/cm-answers/lib/models/AnswerThread.php on line 2
    • > PHP Warning
      include_once(CMA_PATH/lib/models/AnswerThread.php): failed to open stream: No such file or directory in wp-content/plugins/cm-answers/lib/controllers/AnswerController.php on line 2
    • > PHP Warning
      include_once(): Failed opening 'CMA_PATH/lib/models/AnswerThread.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/cm-answers/lib/controllers/AnswerController.php on line 2
    • > PHP Warning
      include_once(): Failed opening 'CMA_PATH/lib/models/PostType.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/cm-answers/lib/models/AnswerThread.php on line 2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/cm-answers/package/views/userguide_free.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cm-answers/package/views/plugin_compare_table.php:51
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/cm-answers/package/cminds-plugin-config.php:4

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=cma_about
    • > Network (severe)
    wp-content/plugins/cm-answers/package/css/rolling@2x.gif - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=cma_about
    • > Network (severe)
    wp-content/plugins/cm-answers/package/js/mailerlite.js?ver=3.2.2 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=cma_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/admin.php?page=cma_about
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.
    • > GET request to /wp-admin/admin.php?page=CMA_admin_settings
    • > Network (severe)
    wp-content/plugins/cm-answers/package/js/froogaloop.js - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=CMA_admin_settings
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: $f is not defined" "ReferenceError: $f is not defined\n at HTMLDocument.\u003Canonymous> (/wp-admin/admin.php?page=CMA_admin_settings:1418:51)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=CMA_admin_settings
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught ReferenceError: $f is not defined

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
4 plugin tags: forum plugin, q and a plugin, questions and answers, question

cm-answers/cm-answers.php 92% from 13 tests

The entry point to "CM Answers" version 3.2.2 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Description: Please don't use more than 140 characters for the plugin description (currently 152 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin12,110 lines of code in 50 files:
LanguageFilesBlank linesComment linesLines of code
PHP341,7845968,206
PO File91,1072,3452,904
CSS513117896
JavaScript21857104

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity45.77
▷ Minimum class complexity1.00
▷ Maximum class complexity254.00
Average method complexity2.80
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes13
▷ Abstract classes215.38%
▷ Concrete classes1184.62%
▷ Final classes00.00%
Methods318
▷ Static methods16250.94%
▷ Public methods27486.16%
▷ Protected methods4012.58%
▷ Private methods41.26%
Functions6
▷ Named functions00.00%
▷ Anonymous functions6100.00%
Constants56
▷ Global constants58.93%
▷ Class constants5191.07%
▷ Public constants51100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
30 PNG files occupy 0.52MB with 0.32MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
package/views/banner_yearly-membership_220px.png31.34KB10.91KB▼ 65.19%
package/views/img/circle.png10.91KB4.69KB▼ 57.01%
package/views/99suite.png14.06KB5.58KB▼ 60.33%
package/views/img/assets.png16.34KB6.92KB▼ 57.67%
views/resources/imgs/success.png4.34KB1.51KB▼ 65.32%