NatLibFi/Skosmos

View on GitHub

Showing 191 of 1,049 total issues

Method invokeFeedbackForm has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function invokeFeedbackForm($request)
    {
        $template = $this->twig->load('feedback.twig');
        $this->model->setLocale($request->getLang());
        $vocabList = $this->model->getVocabularyList(false);
Severity: Minor
Found in src/controller/WebController.php - About 1 hr to fix

    Function linkUrlFilter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function linkUrlFilter($uri, $vocab, $lang, $type = 'page', $clang = null, $term = null)
        {
            // $vocab can either be null, a vocabulary id (string) or a Vocabulary object
            if ($vocab === null) {
                return $uri;
    Severity: Minor
    Found in src/controller/LinkUrlExtension.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 setParameterizedPlugins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function setParameterizedPlugins(): void
        {
            $this->pluginParameters = 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

    Function changedConcepts has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function changedConcepts($request, $prop, $offset, $limit)
        {
            $changeList = $request->getVocab()->getChangeList($prop, $request->getLang(), $offset, $limit);
    
            $simpleChangeList = array();
    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 transformQueryConceptSchemesResults has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function transformQueryConceptSchemesResults($result)
        {
            $ret = array();
            foreach ($result as $row) {
                $conceptscheme = array();
    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 getVocabularies has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getVocabularies()
        {
            if ($this->allVocabularies === null) { // initialize cache
                $vocs = $this->globalConfig->getGraph()->allOfType('skosmos:Vocabulary');
                $this->allVocabularies = $this->createDataObjects("Vocabulary", $vocs);
    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 getCollectionMembers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getCollectionMembers($coll, $narrowers)
        {
            $membersArray = array();
            if ($coll->label()) {
                $collLabel = $coll->label()->getValue($this->clang) ? $coll->label($this->clang) : $coll->label();
    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 mappings has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method label has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function label($request)
          {
              if (!$request->getUri()) {
                  return $this->returnError(400, "Bad Request", "uri parameter missing");
              }
      Severity: Minor
      Found in src/controller/RestController.php - About 1 hr to fix

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

          Method sortValues has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function sortValues()
              {
                  # TODO: sort by URI as last resort
                  # Note that getLabel() returns URIs in case of no label and may return a prefixed value which affects sorting
                  if (!empty($this->values)) {
          Severity: Minor
          Found in src/model/ConceptProperty.php - About 1 hr to fix

            Method generateChildQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function generateChildQuery($uri, $lang, $fallback, $props)
                {
                    $uri = is_array($uri) ? $uri[0] : $uri;
                    $fcl = $this->generateFromClause();
                    $propertyClause = implode('|', $props);
            Severity: Minor
            Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

              Method generateTransitivePropertyQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function generateTransitivePropertyQuery($uri, $props, $lang, $limit, $anylang)
                  {
                      $uri = is_array($uri) ? $uri[0] : $uri;
                      $fcl = $this->generateFromClause();
                      $propertyClause = implode('|', $props);
              Severity: Minor
              Found in src/model/sparql/GenericSparql.php - About 1 hr to fix

                Method changedConcepts has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function changedConcepts($request, $prop, $offset, $limit)
                    {
                        $changeList = $request->getVocab()->getChangeList($prop, $request->getLang(), $offset, $limit);
                
                        $simpleChangeList = array();
                Severity: Minor
                Found in src/controller/RestController.php - About 1 hr to fix

                  Function transformCountConceptsResults has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function transformCountConceptsResults($result, $lang)
                      {
                          $ret = array();
                          foreach ($result as $row) {
                              if (!isset($row->type)) {
                  Severity: Minor
                  Found in src/model/sparql/GenericSparql.php - About 55 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

                  Method transformTransitivePropertyResults has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      private function transformTransitivePropertyResults($uri, $lang, $objects, $tpropname, $tpropuri, $dpropname, $dpropuri)
                  Severity: Major
                  Found in src/controller/RestController.php - About 50 mins to fix

                    Method generateAlphabeticalListQuery has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        protected function generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated = false, $qualifier = null)
                    Severity: Major
                    Found in src/model/sparql/GenericSparql.php - About 50 mins to fix

                      Method queryConceptsAlphabetical has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function queryConceptsAlphabetical($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false, $qualifier = null)
                      Severity: Major
                      Found in src/model/sparql/GenericSparql.php - About 50 mins to fix

                        Method sendFeedback has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
                        Severity: Major
                        Found in src/controller/WebController.php - About 50 mins to fix

                          Method generateAlphabeticalListQuery has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function generateAlphabeticalListQuery($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false, $qualifier = null)
                          Severity: Major
                          Found in src/model/sparql/JenaTextSparql.php - About 50 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language