74% anspress-question-answer

Code Review | AnsPress - Question and answer

WordPress plugin AnsPress - Question and answer scored74%from 54 tests.

About plugin

  • Plugin page: anspress-question...
  • Plugin version: 4.3.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.2.2
  • WordPress version: 6.3.1
  • First release: Oct 20, 2014
  • Latest release: Jul 15, 2023
  • Number of updates: 209
  • Update frequency: every 15.3 days
  • Top authors: nerdaryan (93.3%)lattepress (7.18%)

Code review

54 tests

User reviews

98 reviews

Install metrics

4,000+ active /234,664 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.85MB] [CPU: ▲0.38ms] Passed 4 tests

A check of server-side resources used by AnsPress - Question and answer
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.31 ▲0.8544.94 ▲1.27
Dashboard /wp-admin4.20 ▲0.8952.64 ▲2.34
Posts /wp-admin/edit.php4.26 ▲0.9050.13 ▲2.58
Add New Post /wp-admin/post-new.php6.74 ▲0.8588.20 ▼4.68
Media Library /wp-admin/upload.php4.05 ▲0.8242.19 ▲8.69
AnsPress /wp-admin/admin.php?page=anspress4.1548.57
All Answers /wp-admin/edit.php?post_type=answer4.2144.52
Settings /wp-admin/admin.php?page=anspress_options4.1448.13
Question Categories /wp-admin/edit-tags.php?taxonomy=question_category4.0742.36
New Question /wp-admin/post-new.php?post_type=question4.3277.09
All Questions /wp-admin/edit.php?post_type=question4.2158.14
New Answer /wp-admin/admin.php?page=ap_select_question4.0842.31

Server storage [IO: ▲5.68MB] [DB: ▲0.02MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 331 new files
Database: 7 new tables, 17 new options
New tables
wp_ap_reputations
wp_ap_reputation_events
wp_ap_qameta
wp_ap_subscribers
wp_ap_views
wp_ap_activity
wp_ap_votes
New WordPress options
anspress_addons
ap_categories_path
anspress_opt
widget_ap_questions_widget
widget_ap_search_widget
widget_anspress_category_widget
widget_recent-comments
widget_theysaidso_widget
widget_ap_breadcrumbs_widget
widget_ap_askform_widget
...

Browser metrics Passed 4 tests

AnsPress - Question and answer: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,874 ▲13913.20 ▼1.391.85 ▼0.4641.94 ▼2.27
Dashboard /wp-admin2,269 ▲844.97 ▼0.93100.17 ▼19.0483.46 ▲35.01
Posts /wp-admin/edit.php2,144 ▲552.24 ▲0.2433.53 ▼5.4132.35 ▼0.16
Add New Post /wp-admin/post-new.php1,714 ▲18122.62 ▼0.56734.15 ▲59.7656.18 ▲5.27
Media Library /wp-admin/upload.php1,437 ▲494.34 ▲0.1098.94 ▼1.9072.18 ▲29.86
AnsPress /wp-admin/admin.php?page=anspress1,3953.9577.23105.33
All Answers /wp-admin/edit.php?post_type=answer1,4053.7665.6174.47
Settings /wp-admin/admin.php?page=anspress_options1,7103.5551.8881.18
Question Categories /wp-admin/edit-tags.php?taxonomy=question_category1,6943.9660.6282.51
New Question /wp-admin/post-new.php?post_type=question2,9227.92179.56143.24
All Questions /wp-admin/edit.php?post_type=question1,4723.6551.5089.83
New Answer /wp-admin/admin.php?page=ap_select_question1,0653.3644.6869.97

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The plugin did not uninstall successfully, leaving 7 tables in the database
    • wp_ap_qameta
    • wp_ap_subscribers
    • wp_ap_reputation_events
    • wp_ap_views
    • wp_ap_votes
    • wp_ap_reputations
    • wp_ap_activity
  • Zombie WordPress options detected upon uninstall: 17 options
    • widget_ap_leaderboard_widget
    • anspress_opt
    • widget_recent-posts
    • widget_ap_questions_widget
    • widget_ap_askform_widget
    • can_compress_scripts
    • widget_anspress_category_widget
    • widget_ap_stats_widget
    • widget_theysaidso_widget
    • anspress_db_version
    • ...

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 17× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/anspress-question-answer/widgets/leaderboard.php:14
    • > PHP Notice
      Undefined property: stdClass::$prefix in wp-content/plugins/anspress-question-answer/includes/functions.php on line 1108
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/anspress-question-answer/includes/functions.php on line 1104
    • > PHP Notice
      Undefined property: stdClass::$prefix in wp-content/plugins/anspress-question-answer/includes/functions.php on line 1109
    • > PHP Warning
      Creating default object from empty value in wp-content/plugins/anspress-question-answer/includes/functions.php on line 1104
    • > PHP Fatal error
      Uncaught Error: Class 'AP_License' not found in wp-content/plugins/anspress-question-answer/admin/views/licenses.php:11
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/anspress-question-answer/.devcontainer/wp-settings.php' (include_path='.:/usr/share/php') in wp-content/plugins/anspress-question-answer/.devcontainer/wp-config.php on line 105
    • > PHP Notice
      Undefined property: stdClass::$prefix in wp-content/plugins/anspress-question-answer/includes/functions.php on line 1107
    • > PHP Fatal error
      Uncaught Error: Interface 'ReCaptcha\\RequestMethod' not found in wp-content/plugins/anspress-question-answer/addons/recaptcha/recaptcha/ReCaptcha/RequestMethod/CurlPost.php:44
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/anspress-question-answer/addons/categories/widget.php:20

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 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
8 plugin tags: quora, profile, stackoverflow, answer, qa...

anspress-question-answer/anspress-question-answer.php Passed 13 tests

The main PHP file in "AnsPress - Question and answer" ver. 4.3.2 adds more information about the plugin and also serves as the entry point for this plugin
67 characters long description:
The most advance community question and answer system for WordPress

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin37,710 lines of code in 288 files:
LanguageFilesBlank linesComment linesLines of code
PHP1605,58513,13522,709
Sass34315576,625
CSS25262743,536
JavaScript505257113,272
SVG130111,379
JSON20075
YAML12035
HTML11033
Bourne Shell191331
Markdown16015

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity19.97
▷ Minimum class complexity1.00
▷ Maximum class complexity97.00
Average method complexity3.00
▷ Minimum method complexity1.00
▷ Maximum method complexity29.00
Code structure
Namespaces13
Interfaces1
Traits0
Classes94
▷ Abstract classes44.26%
▷ Concrete classes9095.74%
▷ Final classes00.00%
Methods901
▷ Static methods27029.97%
▷ Public methods78787.35%
▷ Protected methods748.21%
▷ Private methods404.44%
Functions356
▷ Named functions35399.16%
▷ Anonymous functions30.84%
Constants25
▷ Global constants1560.00%
▷ Class constants1040.00%
▷ Public constants10100.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
15 PNG files occupy 0.06MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
addons/akismet/image.png5.36KB4.47KB▼ 16.60%
addons/buddypress/image.png4.23KB3.30KB▼ 21.89%
assets/question.png3.04KB0.63KB▼ 79.40%
addons/avatar/image.png6.35KB5.43KB▼ 14.50%
addons/notifications/image.png2.99KB2.09KB▼ 30.16%