78% image-snippet

Code Review | ImageSnippets Gallery

WordPress plugin ImageSnippets Gallery scored 78% from 54 tests.

About plugin

  • Plugin page: image-snippet
  • Plugin version: 2.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-5.9
  • WordPress version: 5.9.2
  • First release: Jan 6, 2016
  • Latest release: Nov 6, 2020
  • Number of updates: 73
  • Update frequency: every 24.2 days
  • Top authors: adeel.athar (64.38%)jlott (36.99%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 2,129 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 gracefully, with no errors

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

An overview of server-side resources used by ImageSnippets Gallery
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0160.42 ▲6.00
Dashboard /wp-admin3.41 ▲0.0036.05 ▲0.15
Posts /wp-admin/edit.php3.64 ▲0.0042.55 ▲2.79
Add New Post /wp-admin/post-new.php6.88 ▼0.0996.96 ▼1,186.33
Media Library /wp-admin/upload.php3.29 ▲0.0028.37 ▼2.94

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 1,154 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for ImageSnippets Gallery
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,770 ▲1615.55 ▼0.136.27 ▲0.412.09 ▼0.50
Dashboard /wp-admin2,881 ▲206.00 ▼0.18118.12 ▼13.33161.21 ▼1.79
Posts /wp-admin/edit.php2,694 ▲33.24 ▲0.0164.09 ▲0.14141.27 ▼3.87
Add New Post /wp-admin/post-new.php1,752 ▲4121.19 ▲0.00405.46 ▼117.62156.31 ▼3.35
Media Library /wp-admin/upload.php1,698 ▲35.51 ▲0.03148.93 ▼11.42188.55 ▼27.74

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Uninstall script ran successfully

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 5× PHP files output text when accessed directly:
    • > /wp-content/plugins/image-snippet/image-snippet.php
    • > /wp-content/plugins/image-snippet/class.imagesnippet.php
    • > /wp-content/plugins/image-snippet/assets/libs/rdf/vendor/bin/sami.php
    • > /wp-content/plugins/image-snippet/index.php
    • > /wp-content/plugins/image-snippet/assets/libs/rdf/vendor/phpunit/phpunit/build/assertions.php
  • 524× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/phpunit/php-code-coverage/Tests/_files/CoverageFunctionParenthesesWhitespaceTest.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'PHP_CodeCoverage_Report_HTML_Renderer' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Report/HTML/Renderer/File.php:71
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Console\\Command\\Command' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/symfony/console/Tests/Fixtures/TestCommand.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/phpunit/phpunit/Tests/Regression/GitHub/765/Issue765Test.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Console\\Command\\Command' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/symfony/console/Tests/Fixtures/Foo1Command.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Httpful\\Handlers\\MimeHandlerAdapter' not found in wp-content/plugins/image-snippet/assets/libs/httpful/src/Httpful/Handlers/JsonHandler.php:9
    • > PHP Warning
      Use of undefined constant STDOUT - assumed 'STDOUT' (this will throw an Error in a future version of PHP) in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php on line 21
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_Comparator' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/phpunit/phpunit/PHPUnit/Framework/Comparator/Scalar.php:57
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/symfony/console/Tests/Input/ArrayInputTest.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Process\\Pipes\\AbstractPipes' not found in wp-content/plugins/image-snippet/assets/libs/rdf/vendor/symfony/process/Pipes/UnixPipes.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: Screenshot #1 (Use settings to generate your gallery) image required
  • Contributors: Plugin contributors field is missing
The official readme.txt is a good inspiration

image-snippet/image-snippet.php Passed 13 tests

This is the main PHP file of "ImageSnippets Gallery" version 2.7, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
57 characters long description:
Create a responsive image gallery using ImageSnippets.com

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
It is important to fix the following items
  • Do not distribute dangerous files with your plugin
    • .exe - Executable in Windows
      • wp-content/plugins/image-snippet/assets/libs/rdf/vendor/symfony/console/Resources/bin/hiddeninput.exe
    • .bat - Batch File in Windows
      • wp-content/plugins/image-snippet/assets/libs/rdf/vendor/bin/phpcs.bat
      • wp-content/plugins/image-snippet/assets/libs/rdf/vendor/bin/phpunit.bat
      • wp-content/plugins/image-snippet/assets/libs/rdf/vendor/bin/sami.php.bat
85,782 lines of code in 996 files:
LanguageFilesBlank linesComment linesLines of code
PHP81116,13244,57870,668
CSS81,0793184,583
YAML24145893,217
Markdown4564601,810
XML53135511,706
JSON32201,656
Ant41020678
SVG100655
JavaScript1112260488
XSD100251
HTML11043
Bourne Shell261018
DOS Batch3009

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 124)
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity9.66
▷ Minimum class complexity1.00
▷ Maximum class complexity520.00
Average method complexity2.55
▷ Minimum method complexity1.00
▷ Maximum method complexity124.00
Code structure
Namespaces60
Interfaces48
Traits0
Classes835
▷ Abstract classes374.43%
▷ Concrete classes79895.57%
▷ Final classes50.63%
Methods5,089
▷ Static methods50910.00%
▷ Public methods4,27083.91%
▷ Protected methods60211.83%
▷ Private methods2174.26%
Functions329
▷ Named functions19960.49%
▷ Anonymous functions13039.51%
Constants230
▷ Global constants219.13%
▷ Class constants20990.87%
▷ Public constants209100.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
4 PNG files occupy 0.39MB with 0.12MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png13.23KB8.14KB▼ 38.45%
assets/libs/rdf/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Report/HTML/Renderer/Template/img/glyphicons-halflings-white.png8.57KB9.20KB0.00%
assets/libs/rdf/vendor/phpunit/php-code-coverage/PHP/CodeCoverage/Report/HTML/Renderer/Template/img/glyphicons-halflings.png12.50KB10.35KB▼ 17.19%
assets/images/bg.png366.39KB115.45KB▼ 68.49%