bwinkers/nugget

View on GitHub

Showing 134 of 134 total issues

Suspicious array access to \type
Open

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

Define a constant instead of duplicating this literal "integer" 3 times.
Open

    'integer' => [
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.

Call to method isDir on non-class type string
Open

        if (!$fileInfo->isDot() && !$fileInfo->isDir() && substr($name, 0, 1) != '.') {
Severity: Critical
Found in src/Filesys.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/GClient.php by phan

Reference to undeclared class \Google_Service_Sheets
Open

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

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

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

Call to method __construct from undeclared class \Google_Client
Open

$client = new Google_Client();
Severity: Critical
Found in src/bin/readPropertiesFromGoogle.php by phan

Reference to instance property spreadsheets_values from undeclared class \Google_Service_Sheets
Open

$response = $service->spreadsheets_values->get($spreadsheetID, $range);
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan

Parameter $properties has undeclared type \type
Open

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

Return type of propertyExists() is undeclared type \type
Open

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

Argument 1 (filename) is float|int but \file_exists() takes string
Open

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

Argument 3 (defs) is string but \resolvePropertyReference() takes array defined at /code/src/bin/schemaFromObject.php:309
Open

        resolvePropertyReference($prop, $def, $defs);
Severity: Minor
Found in src/bin/schemaFromObject.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

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

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

     * @param string $key
Severity: Info
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

Argument 1 (property) is string but \propertyExists() takes \type defined at /code/src/bin/readPropertiesFromGoogle.php:192
Open

    if (propertyExists($property)) {
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.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/Nugget.php by phan

Call to method __construct from undeclared class \Activerules\JsonGuard\Validator
Open

        $validator = new \Activerules\JsonGuard\Validator($data, $schema);
Severity: Critical
Found in src/Schema.php by phan

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

    $types = $property['types'];
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan
Severity
Category
Status
Source
Language