NatLibFi/Skosmos

View on GitHub

Showing 191 of 1,049 total issues

RestController has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

class RestController extends Controller
{
    /* supported MIME types that can be used to return RDF data */
    public const SUPPORTED_FORMATS = 'application/rdf+xml text/turtle application/ld+json application/json application/marcxml+xml';
    /* context array template */
Severity: Minor
Found in src/controller/RestController.php - About 4 hrs to fix

    Method generateConceptInfoQuery has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function generateConceptInfoQuery($uris, $arrayClass, $vocabs)
        {
            $gcl = $this->graphClause;
            $fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
            $values = $this->formatValues('?uri', $uris, 'uri');
    Severity: Major
    Found in src/model/sparql/GenericSparql.php - About 4 hrs to fix

      File vocab-search.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* global Vue */
      
      const vocabSearch = Vue.createApp({
        data () {
          return {
      Severity: Minor
      Found in resource/js/vocab-search.js - About 4 hrs to fix

        GlobalConfig has 33 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class GlobalConfig extends BaseConfig
        {
            /** Cache reference */
            private $cache;
            /** Location of the configuration file. Used for caching. */
        Severity: Minor
        Found in src/model/GlobalConfig.php - About 4 hrs to fix

          Function getLabel has a Cognitive Complexity of 27 (exceeds 5 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 3 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

          Request has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Request
          {
              private $lang;
              private $clang;
              private $page;
          Severity: Minor
          Found in src/model/Request.php - About 3 hrs to fix

            Function transformTransitivePropertyResults has a Cognitive Complexity of 25 (exceeds 5 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 3 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 getCollections has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getCollections($includeArrays)
                {
                    $groups = array();
                    $collections = $this->graph->resourcesMatching('skos:member', $this->resource);
                    if (isset($collections)) {
            Severity: Minor
            Found in src/model/Concept.php - About 3 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

            Model has 28 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Model
            {
                /** cache for Vocabulary objects */
                private $allVocabularies = null;
                /** cache for Vocabulary objects */
            Severity: Minor
            Found in src/model/Model.php - About 3 hrs to fix

              Method getInfo has 82 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getInfo($lang = null)
                  {
                      $ret = array();
                      if (!$lang) {
                          $lang = $this->getLang();
              Severity: Major
              Found in src/model/Vocabulary.php - About 3 hrs to fix

                File tab-hierarchy.js has 300 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* global Vue */
                /* global partialPageLoad, getConceptURL */
                
                const tabHierApp = Vue.createApp({
                  data () {
                Severity: Minor
                Found in resource/js/tab-hierarchy.js - About 3 hrs to fix

                  Method generateConceptSearchQuery has 79 lines of code (exceeds 25 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: Major
                  Found in src/model/sparql/GenericSparql.php - About 3 hrs to fix

                    Function startResourceCountsApp has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function startResourceCountsApp () {
                      const resourceCountsApp = Vue.createApp({
                        data () {
                          return {
                            concepts: {},
                    Severity: Major
                    Found in resource/js/vocab-counts.js - About 2 hrs to fix

                      ConceptSearchParameters has 24 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ConceptSearchParameters
                      {
                          private $config;
                          private $request;
                          private $vocabs;
                      Severity: Minor
                      Found in src/model/ConceptSearchParameters.php - About 2 hrs to fix

                        Method asJskos has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function asJskos($queryExVocabs = true, $lang = null, $hrefLink = null)
                            {
                                $propertyLabel = $this->getLabel($lang, $queryExVocabs);
                                $propertyLang = $lang;
                                if (!is_string($propertyLabel)) {
                        Severity: Major
                        Found in src/model/ConceptMappingPropertyValue.php - About 2 hrs to fix

                          Method vocabularyStatistics has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            Function searchConcepts has a Cognitive Complexity of 19 (exceeds 5 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 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 getCrumbs has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private function getCrumbs($bTresult, $uri, $path = null)
                                {
                                    $crumbs = array();
                                    if (!isset($path)) {
                                        $path = array();
                            Severity: Minor
                            Found in src/model/Vocabulary.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 startTermCountsApp has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function startTermCountsApp () {
                              const termCountsApp = Vue.createApp({
                                data () {
                                  return {
                                    languages: []
                            Severity: Major
                            Found in resource/js/term-counts.js - About 2 hrs to fix

                              Method transformConceptSearchResult has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function transformConceptSearchResult($row, $vocabs, $fields)
                                  {
                                      $hit = array();
                                      $hit['uri'] = $row->s->getUri();
                              
                              
                              Severity: Major
                              Found in src/model/sparql/GenericSparql.php - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language