10% code-scanner

Code Review | Code Scanner

WordPress plugin Code Scanner scored10%from 54 tests.

About plugin

  • Plugin page: code-scanner
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jun 20, 2018
  • Latest release: Feb 15, 2019
  • Number of updates: 5
  • Update frequency: every 50.2 days
  • Top authors: msicknick (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,091 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/code-scanner/includes/code-scanner.php+126
    Non-static method Code_Scanner::init() should not be called statically

Server metrics [RAM: ▼1.91MB] [CPU: ▼59.21ms] Passed 4 tests

A check of server-side resources used by Code Scanner
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.08 ▼1.384.91 ▼36.49
Dashboard /wp-admin2.10 ▼1.206.21 ▼42.38
Posts /wp-admin/edit.php2.10 ▼1.255.94 ▼53.16
Add New Post /wp-admin/post-new.php2.10 ▼3.785.54 ▼104.79
Media Library /wp-admin/upload.php2.10 ▼1.135.84 ▼32.51
Code Scanner /wp-admin/tools.php?page=code-scanner2.106.24

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 22 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Code Scanner
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.39 ▼0.141.71 ▼0.0843.89 ▼1.57
Dashboard /wp-admin2,193 ▲135.51 ▼0.2193.62 ▲2.2938.50 ▼4.76
Posts /wp-admin/edit.php2,104 ▲42.01 ▼0.0141.32 ▲1.8835.65 ▼5.12
Add New Post /wp-admin/post-new.php1,534 ▲823.10 ▼0.24686.77 ▼16.0651.78 ▲1.05
Media Library /wp-admin/upload.php1,404 ▲44.23 ▲0.10103.86 ▼1.6946.95 ▼2.94
Code Scanner /wp-admin/tools.php?page=code-scanner9942.1125.6744.42

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/code-scanner/includes/code-scanner.php+126
    Non-static method Code_Scanner::init() should not be called statically
  • Zombie WordPress options were found after uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Deprecated in wp-includes/class-wp-hook.php+310
    Non-static method Code_Scanner::init() should not be called statically
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Deprecated in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+17
    Function create_function() is deprecated
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Warning in wp-content/plugins/code-scanner/views/sidebar.php+43
    Use of undefined constant CODE_SCANNER_GITHUB_URL - assumed 'CODE_SCANNER_GITHUB_URL' (this will throw an Error in a future version of PHP)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined variable: file_error_count
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: twentytwentyone
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Warning in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    count(): Parameter must be an array or an object that implements Countable
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: twentytwenty
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: twentynineteen
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: twentytwentythree
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: twentytwentytwo
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: wp-admin
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: .git
    • > GET request to /wp-admin/tools.php?page=code-scanner
    • > Notice in wp-content/plugins/code-scanner/includes/code-scanner-functions.php+133
    Undefined index: wp-includes

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
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/code-scanner/views/admin.php
    • > /wp-content/plugins/code-scanner/views/description.php
  • 15× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      include_once(CS_MS_VIEWS_PATHsidebar.php): failed to open stream: No such file or directory in wp-content/plugins/code-scanner/views/admin.php on line 13
    • > PHP Warning
      Use of undefined constant CS_MS_VIEWS_PATH - assumed 'CS_MS_VIEWS_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/code-scanner/views/admin.php on line 13
    • > PHP Warning
      Use of undefined constant CS_MS_VIEWS_PATH - assumed 'CS_MS_VIEWS_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/code-scanner/views/admin.php on line 10
    • > PHP Warning
      Use of undefined constant CS_MS_VIEWS_PATH - assumed 'CS_MS_VIEWS_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/code-scanner/views/admin.php on line 17
    • > PHP Warning
      Use of undefined constant CS_MS_IMAGES_URL - assumed 'CS_MS_IMAGES_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/code-scanner/views/admin.php on line 3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/code-scanner/views/scan-results.php:7
    • > PHP Warning
      include_once(CS_MS_VIEWS_PATHscan-results.php): failed to open stream: No such file or directory in wp-content/plugins/code-scanner/views/admin.php on line 17
    • > PHP Warning
      include_once(): Failed opening 'CS_MS_VIEWS_PATHscan-results.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/code-scanner/views/admin.php on line 17
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/code-scanner/views/scan-result.php:2
    • > PHP Warning
      include_once(): Failed opening 'CS_MS_VIEWS_PATHsidebar.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/code-scanner/views/admin.php on line 13

User-side errors Passed 1 test

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

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
No plugin tags provided

code-scanner/code-scanner.php Passed 13 tests

The main file in "Code Scanner" v. 1.0.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
82 characters long description:
Scans WordPress plugin, theme, and core directories for malicious code injections.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
There were no executable files found in this plugin3,339 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
SVG1002,671
PHP10108168483
CSS2303170
JavaScript12015

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity11.33
▷ Minimum class complexity6.00
▷ Maximum class complexity22.00
Average method complexity2.55
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods20
▷ Static methods630.00%
▷ Public methods20100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants880.00%
▷ Class constants220.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/images/cs-icon.png8.79KB3.63KB▼ 58.71%