78% ahrefs-seo

Code Review | Ahrefs SEO

WordPress plugin Ahrefs SEO scored78%from 54 tests.

About plugin

  • Plugin page: ahrefs-seo
  • Plugin version: 0.10.2
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.4
  • WordPress version: 6.3.1
  • First release: Mar 25, 2020
  • Latest release: Nov 8, 2023
  • Number of updates: 99
  • Update frequency: every 13.4 days
  • Top authors: justinahrefs (62.63%)xsvet (31.31%)handywp (8.08%)

Code review

54 tests

User reviews

33 reviews

Install metrics

10,000+ active /241,553 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.35MB] [CPU: ▲7.98ms] Passed 4 tests

Server-side resources used by Ahrefs SEO
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.66 ▲1.1946.22 ▲2.94
Dashboard /wp-admin4.71 ▲1.4055.71 ▲6.37
Posts /wp-admin/edit.php4.82 ▲1.4663.05 ▲13.15
Add New Post /wp-admin/post-new.php7.29 ▲1.40104.85 ▲15.99
Media Library /wp-admin/upload.php4.63 ▲1.4045.73 ▲9.47

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 1,519 new files
Database: 2 new tables, 9 new options
New tables
wp_ahrefs_seo_content
wp_ahrefs_seo_snapshots
New WordPress options
db_upgraded
ahrefs-seo-last-hash
theysaidso_admin_options
widget_recent-posts
ahrefs-seo-content-rules-version
widget_theysaidso_widget
ahrefs-seo-db-version
can_compress_scripts
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Ahrefs SEO
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,817 ▲5514.77 ▲0.061.72 ▲0.0936.49 ▼10.74
Dashboard /wp-admin2,226 ▲465.63 ▲0.0385.06 ▼14.3637.75 ▼8.18
Posts /wp-admin/edit.php2,127 ▲272.05 ▲0.0340.49 ▲2.5437.13 ▲1.66
Add New Post /wp-admin/post-new.php1,538 ▲1223.85 ▲0.86618.30 ▼76.5362.68 ▲5.55
Media Library /wp-admin/upload.php1,425 ▲254.25 ▲0.04103.89 ▼9.9341.60 ▼6.16

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • db_upgraded
    • category_children
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options

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 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
  • 8× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/ahrefs-seo/php7/templates/parts/options/scope/section-close.php
    • > /wp-content/plugins/ahrefs-seo/php5/templates/headers/footer.php
    • > /wp-content/plugins/ahrefs-seo/php7/templates/parts/loader/settings-end.php
    • > /wp-content/plugins/ahrefs-seo/php5/templates/parts/loader/settings-end.php
    • > /wp-content/plugins/ahrefs-seo/php5/templates/parts/content-tips/footer-hidden.php
    • > /wp-content/plugins/ahrefs-seo/php7/templates/headers/footer.php
    • > /wp-content/plugins/ahrefs-seo/php7/templates/parts/content-tips/footer-hidden.php
    • > /wp-content/plugins/ahrefs-seo/php5/templates/parts/options/scope/section-close.php
  • 1011× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'ahrefs\\AhrefsSeo_Vendor\\Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/ahrefs-seo/vendor-prefixed/guzzlehttp/psr7/src/DroppingStream.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo_Vendor\\Google\\Collection' not found in wp-content/plugins/ahrefs-seo/vendor-prefixed/google/apiclient-services/src/SearchConsole/IndexStatusInspectionResult.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo\\Ahrefs_Seo_View' not found in wp-content/plugins/ahrefs-seo/php5/templates/parts/action-parts/table-positions.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo_Vendor\\Google\\Client' not found in wp-content/plugins/ahrefs-seo/php7/class-google-proxy-client.php:36
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo\\Ahrefs_Seo_View' not found in wp-content/plugins/ahrefs-seo/php5/templates/parts/action-steps/merge.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo_Vendor\\Google\\Model' not found in wp-content/plugins/ahrefs-seo/vendor-prefixed/google/apiclient-services/src/GoogleAnalyticsAdmin/GoogleAnalyticsAdminV1alphaGoogleSignalsSettings.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo_Vendor\\Google\\Model' not found in wp-content/plugins/ahrefs-seo/vendor-prefixed/google/apiclient-services/src/GoogleAnalyticsAdmin/GoogleAnalyticsAdminV1betaProvisionAccountTicketResponse.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo_Vendor\\Google\\Collection' not found in wp-content/plugins/ahrefs-seo/vendor-prefixed/google/apiclient-services/src/GoogleAnalyticsAdmin/GoogleAnalyticsAdminV1alphaExpandedDataSetFilterInListFilter.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo_Vendor\\Google\\Model' not found in wp-content/plugins/ahrefs-seo/vendor-prefixed/google/apiclient-services/src/GoogleAnalyticsAdmin/GoogleAnalyticsAdminV1alphaAccessStringFilter.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'ahrefs\\AhrefsSeo_Vendor\\Google\\Service' not found in wp-content/plugins/ahrefs-seo/vendor-prefixed/google/apiclient-services/src/AnalyticsReporting.php:34

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 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
10 plugin tags: google analytics, blog audit, seo, ahrefs, site audit...

ahrefs-seo/ahrefs-plugin.php 92% from 13 tests

The main PHP file in "Ahrefs SEO" ver. 0.10.2 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("ahrefs-seo.php" instead of "ahrefs-plugin.php")

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 detected157,768 lines of code in 1,431 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,3525,82075,894144,771
Markdown351,83705,234
CSS2252404,433
JavaScript4943133,112
SVG3710212
JSON1006

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 179)
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity13.99
▷ Minimum class complexity1.00
▷ Maximum class complexity644.00
Average method complexity2.56
▷ Minimum method complexity1.00
▷ Maximum method complexity179.00
Code structure
Namespaces80
Interfaces49
Traits12
Classes1,037
▷ Abstract classes312.99%
▷ Concrete classes1,00697.01%
▷ Final classes343.38%
Methods8,568
▷ Static methods6827.96%
▷ Public methods7,54288.03%
▷ Protected methods5045.88%
▷ Private methods5226.09%
Functions425
▷ Named functions11928.00%
▷ Anonymous functions30672.00%
Constants1,027
▷ Global constants918.86%
▷ Class constants93691.14%
▷ Public constants83789.42%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
4 PNG files occupy 0.20MB with 0.12MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/ahrefs-connect-2x.png53.27KB22.10KB▼ 58.52%
assets/images/chart-bg.png38.81KB9.11KB▼ 76.53%
assets/images/ahrefs-connect-3x.png83.68KB33.81KB▼ 59.60%
assets/images/ahrefs-connect.png24.95KB10.62KB▼ 57.42%