NatLibFi/Skosmos

View on GitHub

Showing 1,049 of 1,049 total issues

Missing class import via use statement (line '33', column '24').
Open

            $res = new LinkedDataResource($this->model, $uri);
Severity: Minor
Found in src/model/resolver/Resolver.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '172', column '24').
Open

            $res = new EasyRdf\Resource($uri);
Severity: Minor
Found in src/model/sparql/GenericSparql.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method generateConceptSearchQuery has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation.
Open

    protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
Severity: Minor
Found in src/model/sparql/GenericSparql.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '473', column '19').
Open

        throw new ValueError("Vocabulary id '$vocid' not found in configuration.");
Severity: Minor
Found in src/model/Model.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method filterPlugins has a boolean flag argument $raw, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function filterPlugins($type, $raw = false)
Severity: Minor
Found in src/model/PluginRegister.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '628', column '54').
Open

                $path = array_merge($path, array(new Breadcrumb($uri, $bTresult[$uri]['label'])));
Severity: Minor
Found in src/model/Vocabulary.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

The method queryConceptsAlphabetical has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function queryConceptsAlphabetical($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false, $qualifier = null)
Severity: Minor
Found in src/model/sparql/GenericSparql.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method generateConceptGroupContentsQuery has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation.
Open

    private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false)
Severity: Minor
Found in src/model/sparql/GenericSparql.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

The method listConceptGroupContents has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation.
Open

    public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false)
Severity: Minor
Found in src/model/sparql/GenericSparql.php by phpmd

BooleanArgumentFlag

Since: 1.4.0

A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

Example

class Foo {
    public function bar($flag = true) {
    }
}

Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

Missing class import via use statement (line '500', column '23').
Open

            throw new ValueError("no vocabulary found for graph $graph and endpoint $endpoint");
Severity: Minor
Found in src/model/Model.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Missing class import via use statement (line '31', column '24').
Open

            $res = new WDQSResource($this->model, $uri);
Severity: Minor
Found in src/model/resolver/Resolver.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Function getExternalLabel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getExternalLabel($exvoc, $exuri, $lang)
    {
        if ($exvoc) {
            try {
                $exsparql = $exvoc->getSparql();
Severity: Minor
Found in src/model/DataObject.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getExternalNotation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getExternalNotation($exvoc, $exuri)
    {
        if ($exvoc) {
            try {
                $exsparql = $exvoc->getSparql();
Severity: Minor
Found in src/model/DataObject.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getSidebarViews has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSidebarViews()
    {
        $views = $this->resource->getResource('skosmos:sidebarViews');
        if ($views) {
            $viewsArray = array();
Severity: Minor
Found in src/model/VocabularyConfig.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function data($request)
    {
        $vocab = $request->getVocab();
        if ($this->notModified($request->getVocab())) {
            return null;
Severity: Minor
Found in src/controller/RestController.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function updateJsonLD has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const updateJsonLD = (conceptHTML) => {
  const JsonLD = document.querySelector('script[type="application/ld+json"]')
  const newJsonLD = conceptHTML.querySelector('script[type="application/ld+json"]')
  if (JsonLD) {
    JsonLD.innerHTML = '{}'
Severity: Minor
Found in resource/js/partial-page-load.js - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function mappings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function mappings(Request $request)
    {
        $this->model->setLocale($request->getLang());
        $vocab = $request->getVocab();
        if ($this->notModified($vocab)) {
Severity: Minor
Found in src/controller/RestController.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function parseSearchLang has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    parseSearchLang () {
      // if content language can be found from uri params, use that and update it to SKOSMOS object and to search lang cookie
      const urlParams = new URLSearchParams(window.location.search)
      const paramLang = urlParams.get('clang')
      const anyLang = urlParams.get('anylang')
Severity: Minor
Found in resource/js/vocab-search.js - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function setPluginParameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function setPluginParameters(Easyrdf\Resource $pluginResource): void
    {
        $pluginName = $pluginResource->getLiteral('skosmos:usePlugin')->getValue();
        $this->pluginParameters[$pluginName] = array();

Severity: Minor
Found in src/model/VocabularyConfig.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function label($request)
    {
        if (!$request->getUri()) {
            return $this->returnError(400, "Bad Request", "uri parameter missing");
        }
Severity: Minor
Found in src/controller/RestController.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language