NatLibFi/Skosmos

View on GitHub

Showing 1,049 of 1,049 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        } elseif (isset($vocabStats[$groupClass])) {
            $ret['conceptGroups'] = array(
                'class' => $groupClass,
                'label' => isset($vocabStats[$groupClass]['label']) ? $vocabStats[$groupClass]['label'] : $this->model->getText(EasyRdf\RdfNamespace::shorten($groupClass)),
                'count' => $vocabStats[$groupClass]['count'],
Severity: Minor
Found in src/controller/RestController.php and 1 other location - About 50 mins to fix
src/controller/RestController.php on lines 319..326

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 97.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

The property $DELETED_PROPERTIES is not named in camelCase.
Open

class Concept extends VocabularyDataObject implements Modifiable
{
    /**
     * Stores a label string if the concept has been found through
     * a altLabel/label in a another language than the ui.
Severity: Minor
Found in src/model/Concept.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The parameter $honey_time is not named in camelCase.
Open

    public function generate($honey_name, $honey_time): string
    {
        // Encrypt the current time
        $honey_time_encrypted = $this->getEncryptedTime();
        return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" .
Severity: Minor
Found in src/controller/Honeypot.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $honey_name is not named in camelCase.
Open

    public function generate($honey_name, $honey_time): string
    {
        // Encrypt the current time
        $honey_time_encrypted = $this->getEncryptedTime();
        return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" .
Severity: Minor
Found in src/controller/Honeypot.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $sort_by_notation is not named in camelCase.
Open

    public function __construct($model, $prop, $label, $tooltip = null, $super = null, $sort_by_notation = false)
    {
        $this->model = $model;
        $this->prop = $prop;
        $this->label = $label;
Severity: Minor
Found in src/model/ConceptProperty.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

Avoid variables with short names like $b. Configured minimum length is 3.
Open

                uasort($this->values, function ($a, $b) {
Severity: Minor
Found in src/model/ConceptProperty.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $i. Configured minimum length is 3.
Open

                $i = 2;
Severity: Minor
Found in src/model/Concept.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

The parameter $config_name is not named in camelCase.
Open

    public function __construct(Model $model, string $config_name = '../../config.ttl')
    {
        $this->cache = new Cache();
        $this->filePath = realpath(dirname(__FILE__) . "/" . $config_name);
        if (!file_exists($this->filePath)) {
Severity: Minor
Found in src/model/GlobalConfig.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The property $DEFAULT_EXT_PROPERTIES is not named in camelCase.
Open

class Concept extends VocabularyDataObject implements Modifiable
{
    /**
     * Stores a label string if the concept has been found through
     * a altLabel/label in a another language than the ui.
Severity: Minor
Found in src/model/Concept.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $sort_by_notation is not named in camelCase.
Open

class ConceptProperty
{
    /** stores the Model object (used for translations) */
    private $model;
    /** stores the property type */
Severity: Minor
Found in src/model/ConceptProperty.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Avoid variables with short names like $a. Configured minimum length is 3.
Open

                uasort($this->values, function ($a, $b) {
Severity: Minor
Found in src/model/ConceptProperty.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

The parameter $config_filename is not named in camelCase.
Open

    public function __construct(string $config_filename = "../../config.ttl")
    {
        $this->resolver = new Resolver($this);
        $this->globalConfig = new GlobalConfig($this, $config_filename);
        $this->translator = null;
Severity: Minor
Found in src/model/Model.php by phpmd

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The property $MAPPING_PROPERTIES is not named in camelCase.
Open

class Concept extends VocabularyDataObject implements Modifiable
{
    /**
     * Stores a label string if the concept has been found through
     * a altLabel/label in a another language than the ui.
Severity: Minor
Found in src/model/Concept.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $is_sorted is not named in camelCase.
Open

class ConceptProperty
{
    /** stores the Model object (used for translations) */
    private $model;
    /** stores the property type */
Severity: Minor
Found in src/model/ConceptProperty.php by phpmd

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Avoid variables with short names like $a. Configured minimum length is 3.
Open

    protected function mycompare($a, $b)
Severity: Minor
Found in src/model/DataObject.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $b. Configured minimum length is 3.
Open

    protected function mycompare($a, $b)
Severity: Minor
Found in src/model/DataObject.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $id. Configured minimum length is 3.
Open

                    $id = $folder . '-' . substr($filename, 0, (strrpos($filename, ".")));
Severity: Minor
Found in src/model/PluginRegister.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $fd. Configured minimum length is 3.
Open

            $fd = fopen($this->uri, 'rb', false, $context);
Severity: Minor
Found in src/model/resolver/LOCResource.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $gc. Configured minimum length is 3.
Open

        $gc = $this->graphClause;
Severity: Minor
Found in src/model/sparql/JenaTextSparql.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Avoid variables with short names like $a. Configured minimum length is 3.
Open

        array_walk_recursive($array, function ($a) use (&$return) { $return[] = $a; });
Severity: Minor
Found in src/model/PluginRegister.php by phpmd

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

Source https://phpmd.org/rules/naming.html#shortvariable

Severity
Category
Status
Source
Language