bwinkers/nugget

View on GitHub

Showing 134 of 134 total issues

Argument 1 (var) is string but \count() takes \Countable|array
Open

    if (count($types) === 1) {
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan

Class extends undeclared class \Google_Client
Open

class GClient extends Google_Client
Severity: Critical
Found in src/GClient.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/GSheet.php by phan

Argument 1 (json) is \Activerules\Nugget\type but \json_decode() takes string
Open

        $data = json_decode($data);
Severity: Minor
Found in src/JSON.php by phan

Catching undeclared class \Activerules\Nugget\Exception (Did you mean class \Exception)
Open

        } catch (Exception $ex) {
Severity: Critical
Found in src/GSheet.php by phan

Class extends undeclared class \Aws\S3\S3Client
Open

class SClient extends \Aws\S3\S3Client
Severity: Critical
Found in src/SClient.php by phan

Call to method useApplicationDefaultCredentials from undeclared class \Google_Client
Open

$client->useApplicationDefaultCredentials();
Severity: Critical
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

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

            $props[$property] = $nugget->schemaBuilder->loadPropertyFile($propertyFile);
Severity: Minor
Found in src/bin/schemaFromObject.php by phan

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

    public function loadGsheetCSV($url)
Severity: Minor
Found in src/GSheetReader.php by phan

Returning type void but processProperty() is declared to return string
Open

        return;
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.php by phan

Argument 2 (types) is string but \hydrateOneOfType() takes array defined at /code/src/bin/readPropertiesFromGoogle.php:117
Open

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

Argument 2 (args) is string but \array_merge() takes array
Open

    $property = array_merge($property, $typeData);
Severity: Minor
Found in src/bin/readPropertiesFromGoogle.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