Showing 21 of 21 total issues

Function retrieveContent has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private function retrieveContent($tableName, $mapping, $geometry, $options = array())
    {
        
        /*
         * Return WKT if specified in config file
Severity: Minor
Found in app/include/iTag/Taggers/GenericTagger.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

File PoliticalTagger.php has 252 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * Copyright 2013 Jérôme Gasperi
 *
 * Licensed under the Apache License, version 2.0 (the "License");
Severity: Minor
Found in app/include/iTag/Taggers/PoliticalTagger.php - About 2 hrs to fix

    Method tag has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function tag($metadata, $taggers = array())
        {
            if (!isset($metadata['geometry'])) {
                throw new Exception('Missing mandatory geometry', 500);
            }
    Severity: Minor
    Found in app/include/iTag/iTag.php - About 1 hr to fix

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

          private function retrieveContent($tableName, $mapping, $geometry, $options = array())
          {
              
              /*
               * Return WKT if specified in config file
      Severity: Minor
      Found in app/include/iTag/Taggers/GenericTagger.php - About 1 hr to fix

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

            private function add(&$continents, $geometry, $what)
            {
                $prequery = 'WITH prequery AS (SELECT ' . $this->postgisGeomFromText($geometry) . ' AS corrected_geometry)';
                if ($what === PoliticalTagger::COUNTRIES) {
                    $query = $prequery . ' SELECT name as name, concat(normalize_initcap(name), \'' . iTag::TAG_SEPARATOR . '\', geonameid) as id, continent as continent, normalize_initcap(continent) as continentid, ' . $this->postgisArea($this->postgisIntersection('geom', 'corrected_geometry')) . ' as area, ' . $this->postgisArea('geom') . ' as entityarea FROM prequery, datasources.countries WHERE st_intersects(geom, corrected_geometry) ORDER BY area DESC';
        Severity: Minor
        Found in app/include/iTag/Taggers/PoliticalTagger.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 tag has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public function tag($metadata, $taggers = array())
            {
                if (!isset($metadata['geometry'])) {
                    throw new Exception('Missing mandatory geometry', 500);
                }
        Severity: Minor
        Found in app/include/iTag/iTag.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 getParams has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getParams()
            {
        
                // Input query
                $query = $this->sanitize(filter_input_array(INPUT_GET));
        Severity: Minor
        Found in app/include/iTagLauncher.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 getParams has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getParams()
            {
        
                // Input query
                $query = $this->sanitize(filter_input_array(INPUT_GET));
        Severity: Minor
        Found in app/include/iTagLauncher.php - About 1 hr to fix

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

              private function mergeRegion(&$regions, $element)
              {
                  if (!isset($element['regionid']) || !$element['regionid']) {
                      array_push($regions, array(
                          'states' => array()
          Severity: Minor
          Found in app/include/iTag/Taggers/PoliticalTagger.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 mergeRegion has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function mergeRegion(&$regions, $element)
              {
                  if (!isset($element['regionid']) || !$element['regionid']) {
                      array_push($regions, array(
                          'states' => array()
          Severity: Minor
          Found in app/include/iTag/Taggers/PoliticalTagger.php - About 1 hr to fix

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

                private function addCountriesToContinents(&$continents, $element)
                {
                    $index = -1;
                    for ($i = count($continents); $i--;) {
                        if ($continents[$i]['name'] === $element['continent']) {
            Severity: Minor
            Found in app/include/iTag/Taggers/PoliticalTagger.php - About 1 hr to fix

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

                  private function mergeRegionsAndStates(&$country, $element)
                  {
                      $index = -1;
                      for ($k = count($country['regions']); $k--;) {
                          if (!$element['regionid'] && !isset($country['regions'][$k]['id'])) {
              Severity: Minor
              Found in app/include/iTag/Taggers/PoliticalTagger.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

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

                  private function retrieveRawLandCover($geometry)
                  {
                      $classes = array();
                      $prequery = 'WITH prequery AS (SELECT ' . $this->postgisGeomFromText($geometry) . ' AS corrected_geometry)';
                      if ($this->config['returnGeometries']) {
              Severity: Minor
              Found in app/include/iTag/Taggers/LandcoverTagger.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

              Function addRegionsToCountries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function addRegionsToCountries(&$continents, $element)
                  {
                      for ($i = count($continents); $i--;) {
                          for ($j = count($continents[$i]['countries']); $j--;) {
                              $countryName = isset(CountryInfos::$countryNames[$element['isoa3']]) ? CountryInfos::$countryNames[$element['isoa3']] : null;
              Severity: Minor
              Found in app/include/iTag/Taggers/PoliticalTagger.php - About 45 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

              Function loadPHP has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function loadPHP($folder)
              {
                  global $phps;
              
                  $files = glob($folder . "/*");
              Severity: Minor
              Found in build/itag/container_root/etc/fpm/preload.php - About 45 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

              Function getLandCoverDetails has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getLandCoverDetails($rawLandCover)
                  {
                      $landCoverDetails = array();
                      foreach ($rawLandCover as $key => $val) {
                          if ($val['area'] !== 0) {
              Severity: Minor
              Found in app/include/iTag/Taggers/LandcoverTagger.php - About 35 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

              Function tag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function tag($metadata, $options = array())
                  {
              
                      /*
                       * Relative location on earth
              Severity: Minor
              Found in app/include/iTag/Taggers/AlwaysTagger.php - About 35 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

              Function getLocations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getLocations($geometry, $planet)
                  {
                      $locations = array();
                      foreach ($this->areas as $key => $value) {
              
              
              Severity: Minor
              Found in app/include/iTag/Taggers/AlwaysTagger.php - About 35 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

              Function getResults has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getResults($tableName, $mapping, $geometry, $options)
                  {
                      $propertyList = array();
                      $geom = $this->postgisGeomFromText($geometry);
                      $orderBy = '';
              Severity: Minor
              Found in app/include/iTag/Taggers/GenericTagger.php - About 35 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

              Avoid too many return statements within this method.
              Open

                              return $str;
              Severity: Major
              Found in app/include/iTagLauncher.php - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language