bwinkers/nugget

View on GitHub

Showing 134 of 134 total issues

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/SchemaBuilder.php by phpcodesniffer

Whitespace found at end of line
Open

     * 
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

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

Whitespace found at end of line
Open

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

Call to undeclared method \Activerules\Nugget\GClient::setAuthConfig
Open

        $this->setAuthConfig($credentials);
Severity: Critical
Found in src/GClient.php by phan

Saw an @param annotation for credentials, but it was not found in the param list of function __construct($url)
Open

     * @param array $credentials
Severity: Info
Found in src/GSheetReader.php by phan

Parameter $data has undeclared type \Activerules\Nugget\type
Open

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

Reference to undeclared property \Activerules\Nugget\Nugget->openAPI
Open

        $this->openAPI = new \Activerules\Nugget\OpenAPI();
Severity: Minor
Found in src/Nugget.php by phan

Reference to undeclared class \Aws\S3\S3Client
Open

            parent::__construct($config);
Severity: Critical
Found in src/SClient.php by phan

Possibly zero references to use statement for classlike/namespace NuggetException (\Activerules\Nugget\Exception\NuggetException)
Open

use Activerules\Nugget\Exception\NuggetException;
Severity: Minor
Found in src/Schema.php by phan

Reference to constant SPREADSHEETS_READONLY from undeclared class \Google_Service_Sheets
Open

define('SCOPES', implode(' ', array(Google_Service_Sheets::SPREADSHEETS_READONLY)));
Severity: Critical
Found in src/bin/readPropertiesFromGoogle.php by phan

When fetching an array index from a value of type string, found an array index of type 'name', but expected the index to be of type int
Open

    $propertyName = $property['name'];
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan

Suspicious attempt to unset an offset of a value of type string
Open

    unset($property['name']);
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan

Parameter $property has undeclared type \type
Open

function propertyExists($property)
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan

Returning type bool but propertyExists() is declared to return \type
Open

    return file_exists(PROPERTYDIR + DIRECTORY_SEPARATOR + $property['name'] + '.json');
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan

Argument 1 (schema) is false|string but \populateRef() takes object defined at /code/src/bin/schemaFromObject.php:68
Open

        populateRef($name, $defs);
Severity: Minor
Found in src/bin/schemaFromObject.php by phan

Define a constant instead of duplicating this literal "string" 9 times.
Open

    'string' => [
Severity: Critical
Found in src/lookup/nuggetTypes.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Severity
Category
Status
Source
Language