log-oscon/google-docs-oembed

View on GitHub

Showing 11 of 11 total issues

Function google_docs_base_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function google_docs_base_url( $matches, $attr, $rawattr ) {

        $doc_type = $matches[2];
        $base_url = $matches[0];

Severity: Minor
Found in lib/Frontend.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Filenames should be all lowercase with hyphens as word separators. Expected frontend.php, but found Frontend.php.
Open

<?php
Severity: Minor
Found in lib/Frontend.php by phpcodesniffer

Class file names should be based on the class name with "class-" prepended. Expected class-i18n.php, but found I18n.php.
Open

<?php
Severity: Minor
Found in lib/I18n.php by phpcodesniffer

Expected 1 space before "?"; 2 found
Open

        $width    = isset( $rawattr['width'] )  ? absint( $rawattr['width'] )  : 0;
Severity: Minor
Found in lib/Frontend.php by phpcodesniffer

Expected 1 space before ":"; 2 found
Open

        $width    = isset( $rawattr['width'] )  ? absint( $rawattr['width'] )  : 0;
Severity: Minor
Found in lib/Frontend.php by phpcodesniffer

Class file names should be based on the class name with "class-" prepended. Expected class-frontend.php, but found Frontend.php.
Open

<?php
Severity: Minor
Found in lib/Frontend.php by phpcodesniffer

Filenames should be all lowercase with hyphens as word separators. Expected i18n.php, but found I18n.php.
Open

<?php
Severity: Minor
Found in lib/I18n.php by phpcodesniffer

Class file names should be based on the class name with "class-" prepended. Expected class-plugin.php, but found Plugin.php.
Open

<?php
Severity: Minor
Found in lib/Plugin.php by phpcodesniffer

Filenames should be all lowercase with hyphens as word separators. Expected plugin.php, but found Plugin.php.
Open

<?php
Severity: Minor
Found in lib/Plugin.php by phpcodesniffer

Usage of ELSE IF is discouraged; use ELSEIF instead
Open

        } else if ( $doc_type === 'spreadsheets' ) {
Severity: Minor
Found in lib/Frontend.php by phpcodesniffer

Usage of ELSE IF is discouraged; use ELSEIF instead
Open

        } else if ( $doc_type === 'presentation' ) {
Severity: Minor
Found in lib/Frontend.php by phpcodesniffer
Severity
Category
Status
Source
Language