78% cm-answers

Code Review | CM Answers

WordPress plugin CM Answers scored 78% from 54 tests.

About plugin

  • Plugin page: cm-answers
  • Plugin version: 3.1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.8.2
  • WordPress version: 5.8.1
  • First release: Mar 4, 2013
  • Latest release: Oct 27, 2021
  • Number of updates: 417
  • Update frequency: every 7.6 days
  • Top authors: CreativeMindsSolutions (100%)

Code review

54 tests

User reviews

86 reviews

Install metrics

1,000+ active / 121,935 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: ▲1.15MB] [CPU: ▼132.56ms] 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 3,424.36ms on /wp-admin/admin.php?page=cma_about)
PageMemory (MB)CPU Time (ms)
Home /3.93 ▲1.2147.48 ▲25.36
Dashboard /wp-admin4.23 ▲1.1752.01 ▲9.19
Posts /wp-admin/edit.php4.28 ▲1.1744.69 ▼1.04
Add New Post /wp-admin/post-new.php6.59 ▲1.1596.25 ▼547.92
Media Library /wp-admin/upload.php4.09 ▲1.0941.93 ▲9.54
Questions /wp-admin/edit.php?post_type=cma_thread4.2846.10
Answers /wp-admin/edit-comments.php?post_type=cma_thread4.1846.89
Upgrade ➤ /wp-admin/admin.php?page=cma_pro4.1037.58
Settings /wp-admin/admin.php?page=CMA_admin_settings4.347,411.31
User Guide /wp-admin/admin.php?page=cma_about4.213,424.36

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 110 new files
Database: no new tables, 1 new option
New WordPress options
cma_afterActivation

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 /4,047 ▲45115.97 ▼0.039.06 ▼0.1147.83 ▼3.34
Dashboard /wp-admin3,276 ▲3455.94 ▲0.02141.01 ▼34.88118.48 ▲7.07
Posts /wp-admin/edit.php2,793 ▲542.73 ▲0.0266.28 ▲2.3594.21 ▲6.16
Add New Post /wp-admin/post-new.php1,709 ▼16318.84 ▼0.20363.65 ▼13.95106.18 ▼5.73
Media Library /wp-admin/upload.php1,864 ▲575.14 ▲0.11143.99 ▼2.73127.31 ▲16.61
Questions /wp-admin/edit.php?post_type=cma_thread2,8472.7470.2188.02
Answers /wp-admin/edit-comments.php?post_type=cma_thread2,7532.9263.6495.25
Upgrade ➤ /wp-admin/admin.php?page=cma_pro2,0333.1163.71116.84
Settings /wp-admin/admin.php?page=CMA_admin_settings3,8385.8599.89132.30
User Guide /wp-admin/admin.php?page=cma_about4,9659.16201.27161.10

Uninstaller [IO: ▲0.00MB] [DB: ▲0.01MB] 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 1 option in the database
    • 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
  • 14× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > 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 admin_url() in wp-content/plugins/cm-answers/package/cminds-plugin-config.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'CMA_BaseController' not found in wp-content/plugins/cm-answers/lib/controllers/ErrorController.php:4
    • > 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 Fatal error
      Uncaught Error: Class 'CMA_BaseController' not found in wp-content/plugins/cm-answers/lib/controllers/AnswerController.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/cm-answers/cm-answers.php:23
    • > 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 Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/cm-answers/package/views/registration.php:42
    • > 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

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_admin_settings
    • > Other (warning) in unknown
    /wp-admin/admin.php?page=CMA_admin_settings 861 Allow attribute will take precedence over 'allowfullscreen'.

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
5 plugin tags: qa, forum, bulletin board, question, answers

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

The entry point to "CM Answers" version 3.1.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 plugin11,271 lines of code in 50 files:
LanguageFilesBlank linesComment linesLines of code
PHP321,5345847,362
PO File91,1072,3452,904
CSS513117896
JavaScript41857109

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.31
Average class complexity44.85
▷ Minimum class complexity1.00
▷ Maximum class complexity251.00
Average method complexity2.83
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes13
▷ Abstract classes215.38%
▷ Concrete classes1184.62%
▷ Final classes00.00%
Methods307
▷ Static methods15249.51%
▷ Public methods26285.34%
▷ Protected methods4113.36%
▷ Private methods41.30%
Functions6
▷ Named functions00.00%
▷ Anonymous functions6100.00%
Constants52
▷ Global constants59.62%
▷ Class constants4790.38%
▷ Public constants47100.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
42 PNG files occupy 0.52MB with 0.19MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
views/resources/toast/resources/images/warning.png1.15KB1.22KB0.00%
package/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.27KB0.18KB▼ 35.00%
package/views/99suite.png14.06KB5.58KB▼ 60.33%
views/resources/toast/resources/images/notice.png2.06KB1.65KB▼ 20.03%
package/views/businessdir.png30.22KB8.77KB▼ 70.98%