bwinkers/nugget

View on GitHub

Showing 134 of 134 total issues

Missing class import via use statement (line '20', column '30').
Open

        $this->filesys = new \Activerules\Nugget\Filesys();
Severity: Minor
Found in src/SchemaBuilder.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '21', column '29').
Open

        $this->schema = new \Activerules\Nugget\Schema();
Severity: Minor
Found in src/SchemaBuilder.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '22', column '30').
Open

        $this->filesys = new \Activerules\Nugget\Filesys();
Severity: Minor
Found in src/Nugget.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method hydrateTypes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        hydrateOneOfType($property, $types);
    }
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused local variables such as '$types'.
Open

            $this->types = $types;
Severity: Minor
Found in src/OpenAPI.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

The method resolveType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

    } else {
        // Assume we got a valid Schema name
        $resolved['$ref'] = "#/components/schema/" . $type;
    }
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using empty try-catch blocks in __construct.
Open

        } catch (NuggetException $ex) {
            
        }
Severity: Minor
Found in src/SClient.php by phpmd

EmptyCatchBlock

Since: 2.7.0

Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

Example

class Foo {

  public function bar()
  {
      try {
          // ...
      } catch (Exception $e) {} // empty catch block
  }
}

Source https://phpmd.org/rules/design.html#emptycatchblock

Whitespace found at end of line
Open

     * 
Severity: Minor
Found in src/SClient.php by phpcodesniffer

Whitespace found at end of line
Open

     * 
Severity: Minor
Found in src/JSON.php by phpcodesniffer

Expected 1 newline at end of file; 0 found
Open

}
Severity: Minor
Found in src/SClient.php by phpcodesniffer

Whitespace found at end of line
Open

     * 
Severity: Minor
Found in src/GSheet.php by phpcodesniffer

Line indented incorrectly; expected at least 12 spaces, found 11
Open

           return $data;
Severity: Minor
Found in src/JSON.php by phpcodesniffer

Whitespace found at end of line
Open

 * 
Severity: Minor
Found in src/bin/schemaFromObject.php by phpcodesniffer

Whitespace found at end of line
Open

     * 
Severity: Minor
Found in src/SchemaBuilder.php by phpcodesniffer

Whitespace found at end of line
Open

     * 
Severity: Minor
Found in src/GSheet.php by phpcodesniffer

Whitespace found at end of line
Open

    public function valid($data) 
Severity: Minor
Found in src/JSON.php by phpcodesniffer

Whitespace found at end of line
Open

 * 
Severity: Minor
Found in src/bin/schemaFromObject.php by phpcodesniffer

Whitespace found at end of line
Open

 * 

Whitespace found at end of line
Open

     * @return mixed False or object 
Severity: Minor
Found in src/JSON.php by phpcodesniffer

Whitespace found at end of line
Open

     * Replace a string in the schema 
Severity: Minor
Found in src/SchemaBuilder.php by phpcodesniffer
Severity
Category
Status
Source
Language