bwinkers/nugget

View on GitHub

Showing 134 of 134 total issues

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/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

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/OpenAPI.php by phan

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

    public function limitToSchema(string $object, $schema)
Severity: Minor
Found in src/Schema.php by phan

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

        $nugget->schemaBuilder->mergeProps($parentDef, $schemaDef);
Severity: Minor
Found in src/bin/schemaFromObject.php by phan

Argument 2 (ref) is array but \populateRef() takes string 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 ".json" 4 times.
Open

    $objFile = realpath($schemaDir . '/' . $refSchemaName . '.json');
Severity: Critical
Found in src/bin/schemaFromObject.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.

Variable $types is undeclared (Did you mean $this->types or $type)
Open

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

Call to method setScopes from undeclared class \Google_Client
Open

$client->setScopes(SCOPES);
Severity: Critical
Found in src/bin/readPropertiesFromGoogle.php by phan

Call to method __construct from undeclared class \Google_Service_Sheets
Open

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

Method \processProperty is declared to return string but has no return value
Open

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

Call to undeclared method \Activerules\Nugget\Nugget::jsonType
Open

    $jsonType = $nugget->jsonType($type);
Severity: Critical
Found in src/bin/readPropertiesFromGoogle.php by phan

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

use Activerules\Nugget\GClient;
Severity: Minor
Found in src/GSheet.php by phan

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

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

Possibly zero references to use statement for classlike/namespace S3Client (\Aws\S3\S3Client)
Open

use Aws\S3\S3Client;
Severity: Minor
Found in src/SClient.php by phan

Argument 1 (arr1) 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 "format" 8 times.
Open

        'format' => 'int32',
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.

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 class \Aws\S3\S3Client
Open

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

Reference to instance property properties from undeclared class \Activerules\Nugget\type
Open

        foreach (array_keys((array) $schema->properties) as $prop) {
Severity: Minor
Found in src/Schema.php by phan
Severity
Category
Status
Source
Language