NatLibFi/Skosmos

View on GitHub

Showing 191 of 1,049 total issues

Method invokeVocabularySearch has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function invokeVocabularySearch($request)
    {
        $template = $this->twig->load('vocab-search.twig');
        $this->model->setLocale($request->getLang());
        $vocab = $request->getVocab();
Severity: Major
Found in src/controller/WebController.php - About 2 hrs to fix

    Method transformParentListResults has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function transformParentListResults($result, $lang)
        {
            $ret = array();
            foreach ($result as $row) {
                if (!isset($row->broad)) {
    Severity: Major
    Found in src/model/sparql/GenericSparql.php - About 2 hrs to fix

      Method hierarchy has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function hierarchy($request)
          {
              if ($this->notModified($request->getVocab())) {
                  return null;
              }
      Severity: Major
      Found in src/controller/RestController.php - About 2 hrs to fix

        Function transformConceptGroupContentsResults has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            private function transformConceptGroupContentsResults($result, $lang)
            {
                $ret = array();
                $values = array();
                foreach ($result as $row) {
        Severity: Minor
        Found in src/model/sparql/GenericSparql.php - About 2 hrs 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 getDataURLs has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getDataURLs()
            {
                $ret = array();
                $urls = $this->resource->allResources("void:dataDump");
                foreach ($urls as $url) {
        Severity: Minor
        Found in src/model/VocabularyConfig.php - About 2 hrs 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

        Method findLookupHits has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function findLookupHits($results, $label, $lang)
            {
                $hits = array();
                // case 1: exact match on preferred label
                foreach ($results as $res) {
        Severity: Major
        Found in src/controller/RestController.php - About 2 hrs to fix

          Method invokeGlobalSearch has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function invokeGlobalSearch($request)
              {
                  $lang = $request->getLang();
                  $template = $this->twig->load('global-search.twig');
                  $this->model->setLocale($request->getLang());
          Severity: Major
          Found in src/controller/WebController.php - About 2 hrs to fix

            Function generateConceptSearchQuery has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
                {
                    $vocabs = $params->getVocabs();
                    $gcl = $this->graphClause;
                    $fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
            Severity: Minor
            Found in src/model/sparql/GenericSparql.php - About 2 hrs 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 transformChangeListResults has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                private function transformChangeListResults($result)
                {
                    $ret = array();
                    foreach ($result as $row) {
                        $concept = array('uri' => $row->concept->getURI());
            Severity: Minor
            Found in src/model/sparql/GenericSparql.php - About 2 hrs 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 filterPlugins has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                private function filterPlugins($type, $raw = false)
                {
                    $plugins = $this->getPlugins();
                    $plugins = $this->sortPlugins($plugins);
                    $ret = array();
            Severity: Minor
            Found in src/model/PluginRegister.php - About 2 hrs 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 loadConceptHierarchy has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                loadConceptHierarchy () {
                  this.loadingHierarchy = true
                  fetch('rest/v1/' + window.SKOSMOS.vocab + '/hierarchy/?uri=' + window.SKOSMOS.uri + '&lang=' + window.SKOSMOS.content_lang)
                    .then(data => {
                      return data.json()
            Severity: Major
            Found in resource/js/tab-hierarchy.js - About 2 hrs to fix

              Function removeDuplicatePropertyValues has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function removeDuplicatePropertyValues($ret, $duplicates)
                  {
                      $propertyValues = array();
              
                      foreach ($ret as $prop) {
              Severity: Minor
              Found in src/model/Concept.php - About 1 hr 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

              Method generateAlphabeticalListQuery has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function generateAlphabeticalListQuery($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false, $qualifier = null)
                  {
                      if ($letter == '*' || $letter == '0-9' || $letter == '!*') {
                          // text index cannot support special character queries, use the generic implementation for these
                          return parent::generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated, $qualifier);
              Severity: Minor
              Found in src/model/sparql/JenaTextSparql.php - About 1 hr to fix

                Method generateParentListQuery has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function generateParentListQuery($uri, $lang, $fallback, $props)
                    {
                        $fcl = $this->generateFromClause();
                        $propertyClause = implode('|', $props);
                        $query = <<<EOQ
                Severity: Minor
                Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

                  Method generateAlphabeticalListQuery has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated = false, $qualifier = null)
                      {
                          $gcl = $this->graphClause;
                          $classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
                          $values = $this->formatValues('?type', $classes, 'uri');
                  Severity: Minor
                  Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

                    Method searchConcepts has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function searchConcepts($params)
                        {
                            // don't even try to search for empty prefix if no other search criteria (group or parent concept) has been set
                            if (($params->getSearchTerm() === "" || !preg_match('/[^*]/', $params->getSearchTerm())) && !$params->getGroupLimit() && !$params->getParentLimit()) {
                                return array();
                    Severity: Minor
                    Found in src/model/Model.php - About 1 hr to fix

                      Function transformNarrowerResults has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function transformNarrowerResults($result, $lang)
                          {
                              $ret = array();
                              foreach ($result as $row) {
                                  if (!isset($row->child)) {
                      Severity: Minor
                      Found in src/model/sparql/GenericSparql.php - About 1 hr 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 searchConceptsAndInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function searchConceptsAndInfo($params)
                          {
                              $params->setUnique(true);
                              $allhits = $this->searchConcepts($params);
                              $count = sizeof($allhits);
                      Severity: Minor
                      Found in src/model/Model.php - About 1 hr 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 transformSearchResults has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function transformSearchResults($request, $results, $parameters)
                          {
                              // before serializing to JSON, get rid of the Vocabulary object that came with each resource
                              foreach ($results as &$res) {
                                  unset($res['voc']);
                      Severity: Minor
                      Found in src/controller/RestController.php - About 1 hr 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 getTypes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getTypes($vocid = null, $lang = null)
                          {
                              $sparql = (isset($vocid)) ? $this->getVocabulary($vocid)->getSparql() : $this->getDefaultSparql();
                              $result = $sparql->queryTypes($lang);
                              foreach ($result as $uri => $values) {
                      Severity: Minor
                      Found in src/model/Model.php - About 1 hr 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