NatLibFi/Skosmos

View on GitHub

Showing 1,049 of 1,049 total issues

File GenericSparql.php has 1655 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Generates SPARQL queries and provides access to the SPARQL endpoint.
 */
Severity: Major
Found in src/model/sparql/GenericSparql.php - About 4 days to fix

    Function getProperties has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getProperties()
        {
            $properties = array();
            $narrowersByUri = array();
            $inCollection = array();
    Severity: Minor
    Found in src/model/Concept.php - About 2 days 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

    File RestController.php has 883 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * RestController is responsible for handling all the requests directed to the /rest address.
     */
    Severity: Major
    Found in src/controller/RestController.php - About 2 days to fix

      GenericSparql has 80 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class GenericSparql
      {
          /**
           * A SPARQL Client eg. an EasyRDF instance.
           * @property EasyRdf\Sparql\Client $client
      Severity: Major
      Found in src/model/sparql/GenericSparql.php - About 1 day to fix

        File Concept.php has 655 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Dataobject for a single concept.
         */
        Severity: Major
        Found in src/model/Concept.php - About 1 day to fix

          File VocabularyConfig.php has 498 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * VocabularyConfig provides access to the vocabulary configuration defined in config.ttl.
           */
          Severity: Minor
          Found in src/model/VocabularyConfig.php - About 7 hrs to fix

            VocabularyConfig has 48 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class VocabularyConfig extends BaseConfig
            {
                private $globalPlugins;
                private $pluginRegister;
                private $pluginParameters = array();
            Severity: Minor
            Found in src/model/VocabularyConfig.php - About 6 hrs to fix

              File Vocabulary.php has 429 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * Vocabulary dataobjects provide access to the vocabularies on the SPARQL endpoint.
               */
              Severity: Minor
              Found in src/model/Vocabulary.php - About 6 hrs to fix

                Function transformParentListResults has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                Open

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

                    private function transformConceptSearchResult($row, $vocabs, $fields)
                    {
                        $hit = array();
                        $hit['uri'] = $row->s->getUri();
                
                
                Severity: Minor
                Found in src/model/sparql/GenericSparql.php - About 6 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

                File Model.php has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * Importing the dependencies.
                 */
                Severity: Minor
                Found in src/model/Model.php - About 6 hrs to fix

                  Function hierarchy has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                      public function getMappingProperties(array $whitelist = null)
                      {
                          $ret = array();
                  
                          $longUris = $this->resource->propertyUris();
                  Severity: Minor
                  Found in src/model/Concept.php - About 5 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

                  Vocabulary has 41 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Vocabulary extends DataObject implements Modifiable
                  {
                      /** cached value of URI space */
                      private $urispace = null;
                      private $config;
                  Severity: Minor
                  Found in src/model/Vocabulary.php - About 5 hrs to fix

                    Method getProperties has 129 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getProperties()
                        {
                            $properties = array();
                            $narrowersByUri = array();
                            $inCollection = array();
                    Severity: Major
                    Found in src/model/Concept.php - About 5 hrs to fix

                      File WebController.php has 381 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      /**
                       * Importing the dependencies.
                       */
                      Severity: Minor
                      Found in src/controller/WebController.php - About 5 hrs to fix

                        Concept has 38 functions (exceeds 20 allowed). Consider refactoring.
                        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 - About 5 hrs to fix

                          Function findLookupHits has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function findLookupHits($results, $label, $lang)
                              {
                                  $hits = array();
                                  // case 1: exact match on preferred label
                                  foreach ($results as $res) {
                          Severity: Minor
                          Found in src/controller/RestController.php - About 4 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 disambiguateVocabulary has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function disambiguateVocabulary($vocabs, $uri, $preferredVocabId = null)
                              {
                                  // if there is only one candidate vocabulary, return it
                                  if (sizeof($vocabs) == 1) {
                                      return $vocabs[0];
                          Severity: Minor
                          Found in src/model/Model.php - About 4 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 getInfo has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getInfo($lang = null)
                              {
                                  $ret = array();
                                  if (!$lang) {
                                      $lang = $this->getLang();
                          Severity: Minor
                          Found in src/model/Vocabulary.php - About 4 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

                          Severity
                          Category
                          Status
                          Source
                          Language