84% astra-hooks

Code Review | Astra Hooks

WordPress plugin Astra Hooks scored84%from 54 tests.

About plugin

  • Plugin page: astra-hooks
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.3
  • WordPress version: 6.3.1
  • First release: Aug 2, 2017
  • Latest release: Aug 21, 2023
  • Number of updates: 22
  • Update frequency: every 100.7 days
  • Top authors: brainstormworg (54.55%)Nikschavan (45.45%)dineshc (9.09%)

Code review

54 tests

User reviews

6 reviews

Install metrics

30,000+ active /127,353 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.00MB] [CPU: ▼3.06ms] Passed 4 tests

Analyzing server-side resources used by Astra Hooks
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0041.32 ▼2.37
Dashboard /wp-admin3.31 ▲0.0146.67 ▼4.95
Posts /wp-admin/edit.php3.36 ▲0.0046.69 ▼5.39
Add New Post /wp-admin/post-new.php5.89 ▲0.0194.45 ▲0.88
Media Library /wp-admin/upload.php3.23 ▲0.0035.40 ▲0.48

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 12 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts
widget_recent-comments
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Astra Hooks
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲5414.48 ▼0.181.92 ▼0.1440.18 ▼2.86
Dashboard /wp-admin2,221 ▲185.80 ▲0.9397.38 ▼16.9840.39 ▼0.17
Posts /wp-admin/edit.php2,100 ▼01.99 ▼0.0339.86 ▼0.7135.57 ▼0.26
Add New Post /wp-admin/post-new.php1,547 ▲1623.44 ▲0.27604.91 ▼66.3959.91 ▲7.17
Media Library /wp-admin/upload.php1,403 ▲34.27 ▲0.04100.37 ▼6.2244.26 ▼4.85

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 50% 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
Almost there! Just fix the following items
  • 11× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      Use of undefined constant ASTRA_HOOKS_DIR - assumed 'ASTRA_HOOKS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/astra-hooks/classes/class-astra-hooks.php on line 38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/astra-hooks/classes/class-astra-hooks-markup.php:40
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/astra-hooks/classes/class-astra-hooks-white-label.php:56
    • > PHP Warning
      Use of undefined constant ASTRA_HOOKS_DIR - assumed 'ASTRA_HOOKS_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/astra-hooks/classes/class-astra-hooks-loader.php on line 118
    • > PHP Fatal error
      require_once(): Failed opening required 'ASTRA_HOOKS_DIRclasses/class-astra-hooks-loader.php' (include_path='.:/usr/share/php') in wp-content/plugins/astra-hooks/classes/class-astra-hooks.php on line 38
    • > PHP Notice
      Undefined variable: wp_customize in wp-content/plugins/astra-hooks/classes/customizer-panels-and-sections.php on line 8
    • > PHP Fatal error
      require_once(): Failed opening required 'ASTRA_HOOKS_DIRclasses/class-astra-hooks-white-label.php' (include_path='.:/usr/share/php') in wp-content/plugins/astra-hooks/classes/class-astra-hooks-loader.php on line 118
    • > PHP Warning
      require_once(ASTRA_HOOKS_DIRclasses/class-astra-hooks-white-label.php): failed to open stream: No such file or directory in wp-content/plugins/astra-hooks/classes/class-astra-hooks-loader.php on line 118
    • > PHP Warning
      require_once(ASTRA_HOOKS_DIRclasses/class-astra-hooks-loader.php): failed to open stream: No such file or directory in wp-content/plugins/astra-hooks/classes/class-astra-hooks.php on line 38
    • > PHP Fatal error
      Uncaught Error: Call to a member function add_panel() on null in wp-content/plugins/astra-hooks/classes/customizer-panels-and-sections.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: Please add descriptions for these screenshots #1, #2, #3 in astra-hooks/assets to your readme.txt
You can take inspiration from this readme.txt

astra-hooks/astra-hooks.php Passed 13 tests

"Astra Hooks" version 1.0.2's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
27 characters long description:
Customizer Hooks for Theme.

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 plugin603 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP9120367603

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.12
Average class complexity4.50
▷ Minimum class complexity2.00
▷ Maximum class complexity12.00
Average method complexity1.42
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods33
▷ Static methods618.18%
▷ Public methods3296.97%
▷ Protected methods00.00%
▷ Private methods13.03%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
PNG images were not found in this plugin