94% social-media-post-generator

Code Review | Social Media Post Generator

WordPress plugin Social Media Post Generator scored 94% from 54 tests.

About plugin

  • Plugin page: social-media-post...
  • Plugin version: 0.2.3
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4-5.7
  • WordPress version: 5.8.1
  • First release: Apr 9, 2021
  • Latest release: Apr 9, 2021
  • Number of updates: 9
  • Update frequency: every 0.1 days
  • Top authors: cap31 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 132 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼142.62ms] Passed 4 tests

Server-side resources used by Social Media Post Generator
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.1235.60 ▲10.26
Dashboard /wp-admin3.08 ▲0.0247.20 ▼9.31
Posts /wp-admin/edit.php3.16 ▲0.0545.15 ▼5.13
Add New Post /wp-admin/post-new.php5.43 ▲0.0094.49 ▼553.71
Media Library /wp-admin/upload.php3.02 ▲0.0233.27 ▼2.31

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 63 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Social Media Post Generator
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,713 ▲6617.25 ▲1.318.62 ▼2.6750.35 ▼3.52
Dashboard /wp-admin3,001 ▲747.70 ▲1.80157.69 ▼0.21116.99 ▼11.84
Posts /wp-admin/edit.php2,773 ▲343.76 ▲1.0676.23 ▲12.13107.17 ▲7.43
Add New Post /wp-admin/post-new.php1,631 ▲13319.07 ▲0.20407.05 ▲32.59116.99 ▼1.27
Media Library /wp-admin/upload.php1,844 ▲346.23 ▲1.22144.84 ▼18.56128.11 ▲5.73

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

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
The following issues need your attention
  • 12× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'SMPG_IDesignData' not found in wp-content/plugins/social-media-post-generator/designs/QuoteDesign.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/social-media-post-generator/vendor/league/color-extractor/tests/League/ColorExtractor/Test/PaletteTest.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/social-media-post-generator/vendor/gumlet/php-image-resize/test/ImageResizeExceptionTest.php:7
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/class-wp-list-table.php): failed to open stream: No such file or directory in wp-content/plugins/social-media-post-generator/posts-wp-list-table.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit\\Framework\\TestCase' not found in wp-content/plugins/social-media-post-generator/vendor/gumlet/php-image-resize/test/ImageResizeTest.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'SMPG_IDesignData' not found in wp-content/plugins/social-media-post-generator/designs/BlackWhiteBadges.php:5
    • > PHP Fatal error
      Uncaught Error: Interface 'SMPG_IDesignData' not found in wp-content/plugins/social-media-post-generator/designs/BasicDesign.php:5
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/social-media-post-generator/posts-wp-list-table.php on line 4
    • > PHP Warning
      require(wp-content/plugins/social-media-post-generator/vendor/league/color-extractor/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/social-media-post-generator/vendor/league/color-extractor/tests/bootstrap.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/class-wp-list-table.php' (include_path='.:/usr/share/php') in wp-content/plugins/social-media-post-generator/posts-wp-list-table.php on line 4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: image, social, media, automation, generation

social-media-post-generator/index.php 92% from 13 tests

"Social Media Post Generator" version 0.2.3's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("social-media-post-generator.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin13,128 lines of code in 46 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript21037,3479,826
PHP307125882,581
Markdown41610352
JSON500298
YAML28040
XML20027
CSS1004

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity11.55
▷ Minimum class complexity1.00
▷ Maximum class complexity103.00
Average method complexity2.44
▷ Minimum method complexity1.00
▷ Maximum method complexity37.00
Code structure
Namespaces5
Interfaces1
Traits0
Classes21
▷ Abstract classes00.00%
▷ Concrete classes21100.00%
▷ Final classes00.00%
Methods163
▷ Static methods3923.93%
▷ Public methods14488.34%
▷ Protected methods137.98%
▷ Private methods63.68%
Functions11
▷ Named functions1090.91%
▷ Anonymous functions19.09%
Constants11
▷ Global constants19.09%
▷ Class constants1090.91%
▷ Public constants10100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
5 PNG files occupy 0.39MB with 0.26MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/league/color-extractor/tests/assets/test.png289.38KB81.88KB▼ 71.70%
vendor/league/color-extractor/tests/assets/red-transparent-50.png0.07KB0.09KB0.00%
(invalid) designs/tmp/image.png3.88KB0.00KB▼ 100.00%
vendor/league/color-extractor/tests/assets/google.png21.29KB6.96KB▼ 67.29%
(invalid) designs/tmp/image2.png80.32KB0.00KB▼ 100.00%