87% sns-count-cache

Code Review | SNS Count Cache

WordPress plugin SNS Count Cache scored 87% from 54 tests.

About plugin

  • Plugin page: sns-count-cache
  • Plugin version: 1.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-5.2
  • WordPress version: 5.8.1
  • First release: Jun 28, 2014
  • Latest release: Jun 6, 2019
  • Number of updates: 72
  • Update frequency: every 25.1 days
  • Top authors: marubon (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

10,000+ active / 141,067 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲1.48MB] [CPU: ▼132.90ms] Passed 4 tests

Analyzing server-side resources used by SNS Count Cache
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.26 ▲1.5442.41 ▲20.86
Dashboard /wp-admin4.66 ▲1.6153.73 ▲9.90
Posts /wp-admin/edit.php4.62 ▲1.5153.72 ▲6.92
Add New Post /wp-admin/post-new.php6.85 ▲1.4293.08 ▼559.12
Media Library /wp-admin/upload.php4.44 ▲1.4442.34 ▲10.69
Help /wp-admin/admin.php?page=scc-help4.4936.94
Setting /wp-admin/admin.php?page=scc-setting5.7371.84
Cache Status /wp-admin/admin.php?page=scc-cache-status4.5336.79
Dashboard /wp-admin/admin.php?page=scc-dashboard4.5248.93
Share Count /wp-admin/admin.php?page=scc-share-count4.6742.54

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

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 84 new files
Database: no new tables, 4 new options
New WordPress options
scc_share_count_base_offset
scc_share_count_home
scc_follow_count_follow
scc_share_count_rush_offset

Browser metrics Passed 4 tests

SNS Count Cache: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,320 ▲72416.68 ▲1.1511.24 ▲0.8546.46 ▲0.18
Dashboard /wp-admin3,581 ▲6507.33 ▲1.11165.11 ▲20.25150.10 ▲30.16
Posts /wp-admin/edit.php2,788 ▲522.72 ▲0.0164.77 ▲1.4894.07 ▲0.02
Add New Post /wp-admin/post-new.php1,531 ▼14118.55 ▼0.20361.78 ▲12.71116.01 ▲0.91
Media Library /wp-admin/upload.php1,859 ▲525.03 ▼0.02146.62 ▼4.30119.86 ▲1.12
Help /wp-admin/admin.php?page=scc-help2,0292.8965.15120.09
Setting /wp-admin/admin.php?page=scc-setting3,3982.5778.37109.06
Cache Status /wp-admin/admin.php?page=scc-cache-status1,4012.9174.4896.32
Dashboard /wp-admin/admin.php?page=scc-dashboard1,6513.20103.76107.74
Share Count /wp-admin/admin.php?page=scc-share-count1,3922.9169.3496.18

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=scc-cache-status
    • > Notice in wp-content/plugins/sns-count-cache/includes/admin-cache-status.php+283
    Trying to access array offset on value of type bool

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
The following issues need your attention
  • 136× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'SCC_Crawl_Strategy' not found in wp-content/plugins/sns-count-cache/includes/class-scc-follow-twitter-crawl-strategy.php:33
    • > [SCC_Share_Pocket_Crawl_Strategy
      :__construct] (line=47)
    • > [SCC_Follow_Lazy_Cache_Engine
      :initialize] (line=81)
    • > [SCC_Common_Data_Export_Engine
      :initialize] (line=128)
    • > [SCC_Share_Crawl_Strategy_Factory
      :create_crawl_strategy] create crawl strategy: Facebook
    • > [SCC_Engine
      :__construct] (line=75)
    • > [SCC_Engine
      :__construct] (line=75)
    • > [SCC_Share_Lazy_Cache_Engine
      :initialize] (line=95)
    • > [SCC_Share_Crawl_Strategy_Factory
      :create_crawl_strategy] (line=42)
    • > [SCC_Share_Crawl_Strategy_Factory
      :create_crawl_strategy] create crawl strategy: Pocket

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need to be fixed:
  • Donate link: Invalid URI ("")
  • Screenshots: Add images for these screenshots: #1 (Dashboard page), #2 (Cache status page), #3 (Share count page), #4 (Hot content page), #5 (Setting page), #6 (Help page)
The official readme.txt is a good inspiration

sns-count-cache/sns-count-cache.php 92% from 13 tests

This is the main PHP file of "SNS Count Cache" version 1.1.3, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 305 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected12,447 lines of code in 74 files:
LanguageFilesBlank linesComment linesLines of code
PHP653,3405,79011,228
PO File1389792766
CSS25413279
JavaScript61916174

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Method cyclomatic complexity should be reduced to less than 100 (currently 127)
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity24.02
▷ Minimum class complexity1.00
▷ Maximum class complexity314.00
Average method complexity4.13
▷ Minimum method complexity1.00
▷ Maximum method complexity127.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes52
▷ Abstract classes815.38%
▷ Concrete classes4484.62%
▷ Final classes24.55%
Methods411
▷ Static methods338.03%
▷ Public methods34182.97%
▷ Protected methods399.49%
▷ Private methods317.54%
Functions24
▷ Named functions24100.00%
▷ Anonymous functions00.00%
Constants221
▷ Global constants00.00%
▷ Class constants221100.00%
▷ Public constants221100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
6 PNG files occupy 4.36MB with 1.62MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-3.png725.58KB511.70KB▼ 29.48%
screenshot-1.png102.12KB63.24KB▼ 38.08%
screenshot-6.png982.18KB568.80KB▼ 42.09%
screenshot-5.png1,448.74KB762.90KB▼ 47.34%
screenshot-4.png414.87KB294.19KB▼ 29.09%