NatLibFi/Skosmos

View on GitHub

Showing 191 of 1,049 total issues

Method queryChangeList has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false)
Severity: Minor
Found in src/model/sparql/GenericSparql.php - About 35 mins to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($model, $vocab, $resource, $graph, $clang)
    Severity: Minor
    Found in src/model/Concept.php - About 35 mins to fix

      Function vocabularyStatistics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function vocabularyStatistics($request)
          {
              if ($this->notModified($request->getVocab())) {
                  return null;
              }
      Severity: Minor
      Found in src/controller/RestController.php - About 35 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 guessLanguage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function guessLanguage($request, $vocid = null)
          {
              // 1. select language based on SKOSMOS_LANGUAGE cookie
              $languageCookie = $request->getCookie('SKOSMOS_LANGUAGE');
              if ($languageCookie) {
      Severity: Minor
      Found in src/controller/WebController.php - About 35 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 getGitModifiedDate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getGitModifiedDate()
          {
              $commitDate = null;
              $cache = $this->model->getConfig()->getCache();
              $cacheKey = "git:modified_date";
      Severity: Minor
      Found in src/controller/Controller.php - About 35 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 getRDF has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getRDF($vocid, $uri, $format)
          {
      
              if ($format == 'text/turtle') {
                  $retform = 'turtle';
      Severity: Minor
      Found in src/model/Model.php - About 35 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 redirectToVocabData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function redirectToVocabData($request)
          {
              $urls = $request->getVocab()->getConfig()->getDataURLs();
              if (sizeof($urls) == 0) {
                  $vocid = $request->getVocab()->getId();
      Severity: Minor
      Found in src/controller/RestController.php - About 35 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 labelStatistics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function labelStatistics($request)
          {
              if ($this->notModified($request->getVocab())) {
                  return null;
              }
      Severity: Minor
      Found in src/controller/RestController.php - About 35 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 getConceptURL has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      const getConceptURL = (uri) => {
        const clangParam = (window.SKOSMOS.content_lang !== window.SKOSMOS.lang) ? 'clang=' + window.SKOSMOS.content_lang : ''
        let clangSeparator = '?'
        let page = ''
      
      
      Severity: Minor
      Found in resource/js/get-concept-url.js - About 35 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 transformCountLangConceptsResults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          private function transformCountLangConceptsResults($result, $langs, $props)
          {
              $ret = array();
              // set default count to zero; overridden below if query found labels
              foreach ($langs as $lang) {
      Severity: Minor
      Found in src/model/sparql/GenericSparql.php - About 35 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 compareConcepts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          compareConcepts (a, b) {
            let strA, strB
      
            if (window.SKOSMOS.sortByNotation) {
              if (a.notation && b.notation) {
      Severity: Minor
      Found in resource/js/tab-hierarchy.js - About 35 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 getAlphabet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getAlphabet($clang)
          {
              $chars = $this->getSparql()->queryFirstCharacters($clang, $this->config->getIndexClasses());
              $letters = array();
              $digits = false;
      Severity: Minor
      Found in src/model/Vocabulary.php - About 35 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 getForeignLabels has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getForeignLabels()
          {
              $prefLabels = $this->getForeignLabelList('skos:prefLabel', 'prefLabel');
              $altLabels = $this->getForeignLabelList('skos:altLabel', 'altLabel');
              $ret = array_merge_recursive($prefLabels, $altLabels);
      Severity: Minor
      Found in src/model/Concept.php - About 35 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 getPropertyOrder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getPropertyOrder()
          {
              $order = $this->getResource()->getResource('skosmos:propertyOrder');
              if ($order === null) {
                  return self::DEFAULT_PROPERTY_ORDER;
      Severity: Minor
      Found in src/model/VocabularyConfig.php - About 35 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

      Avoid too many return statements within this method.
      Open

                  return $this->resource->getLiteral('rdf:value', $lang);
      Severity: Major
      Found in src/model/ConceptPropertyValue.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $this->returnError(404, 'Bad Request', "no concept found with given uri");
        Severity: Major
        Found in src/controller/RestController.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $this->returnDataResults($results, $format);
          Severity: Major
          Found in src/controller/RestController.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $hits;
            Severity: Major
            Found in src/controller/RestController.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return $hits;
              Severity: Major
              Found in src/controller/RestController.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $hits;
                Severity: Major
                Found in src/controller/RestController.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language