NatLibFi/Skosmos

View on GitHub

Showing 191 of 1,049 total issues

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

    public function invokeGlobalSearch($request)
    {
        $lang = $request->getLang();
        $template = $this->twig->load('global-search.twig');
        $this->model->setLocale($request->getLang());
Severity: Minor
Found in src/controller/WebController.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 getPluginArray has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPluginArray(): array
    {
        $this->setParameterizedPlugins();
        $pluginArray = array();
        $vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
Severity: Minor
Found in src/model/VocabularyConfig.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 labelStatistics has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function labelStatistics($request)
    {
        if ($this->notModified($request->getVocab())) {
            return null;
        }
Severity: Minor
Found in src/controller/RestController.php - About 1 hr to fix

    Method transformSearchResults has 42 lines of code (exceeds 25 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

      Method queryTopConcepts has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function queryTopConcepts($conceptSchemes, $lang, $fallback)
          {
              if (!is_array($conceptSchemes)) {
                  $conceptSchemes = array($conceptSchemes);
              }
      Severity: Minor
      Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

        Method vocabularyInformation has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Method searchConceptsAndInfo has 39 lines of code (exceeds 25 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

            Function renderResults has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                renderResults () {
                  // TODO: get the results list form cache if it is implemented
                  const renderedSearchTerm = this.searchTerm // save the search term in case it changes while rendering
            
                  this.renderedResultsList.forEach(result => {
            Severity: Minor
            Found in resource/js/vocab-search.js - About 1 hr to fix

              Method dumpJsonLd has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function dumpJsonLd()
                  {
                      $context = array(
                          'skos' => EasyRdf\RdfNamespace::get("skos"),
                          'isothes' => EasyRdf\RdfNamespace::get("isothes"),
              Severity: Minor
              Found in src/model/Concept.php - About 1 hr to fix

                Method getMappingProperties has 39 lines of code (exceeds 25 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 1 hr to fix

                  Method generateConceptSearchQueryInner has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph)
                      {
                          $valuesProp = $this->formatValues('?prop', $props);
                          $textcond = $this->generateConceptSearchQueryCondition($term, $searchLang);
                  
                  
                  Severity: Minor
                  Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

                    Method transformTransitivePropertyResults has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function transformTransitivePropertyResults($result, $lang, $fallbacklang)
                        {
                            $ret = array();
                            foreach ($result as $row) {
                                if (!isset($row->object)) {
                    Severity: Minor
                    Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

                      Method sendFeedback has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
                          {
                              $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
                              $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject;
                              if ($fromVocab !== null && $fromVocab !== '') {
                      Severity: Minor
                      Found in src/controller/WebController.php - About 1 hr to fix

                        Method generateChangeListQuery has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false)
                            {
                                $fcl = $this->generateFromClause();
                                $offset = ($offset) ? 'OFFSET ' . $offset : '';
                        
                        
                        Severity: Minor
                        Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

                          Method resolve has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function resolve(int $timeout): ?EasyRdf\Resource
                              {
                                  try {
                                      // unregister the legacy "json" format as it causes problems with CONSTRUCT requests
                                      EasyRdf\Format::unregister('json');
                          Severity: Minor
                          Found in src/model/resolver/WDQSResource.php - About 1 hr to fix

                            Method getLabel has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getLabel($lang = '', $fallbackToUri = 'uri')
                                {
                                    if ($this->clang) {
                                        $lang = $this->clang;
                                    }
                            Severity: Minor
                            Found in src/model/ConceptPropertyValue.php - About 1 hr to fix

                              Function transformConceptGroupsResults has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function transformConceptGroupsResults($result)
                                  {
                                      $ret = array();
                                      foreach ($result as $row) {
                                          if (!isset($row->group)) {
                              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 transformAlphabeticalListResults has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function transformAlphabeticalListResults($results)
                                  {
                                      $ret = array();
                              
                                      foreach ($results as $row) {
                              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 transformPropertyQueryResults has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function transformPropertyQueryResults($result, $lang)
                                  {
                                      $ret = array();
                                      foreach ($result as $row) {
                                          if (!isset($row->object)) {
                              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 addExternalTriplesToGraph has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function addExternalTriplesToGraph($res, &$seen, $props = null)
                                  {
                                      if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) {
                                          return;
                                      }
                              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

                              Severity
                              Category
                              Status
                              Source
                              Language