howardjones/network-weathermap

View on GitHub

Showing 463 of 1,093 total issues

Function MapCollection has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const MapCollection = (props) => {

  if (props.group_id === 'default' && props.maps[0]) {
    return (
        <Redirect to={`/group/${props.maps[0].group_id}`}/>
Severity: Minor
Found in websrc/cacti-user/src/components/MapCollection.js - About 1 hr to fix

    Method handleNODE_USESCALE has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function handleNODE_USESCALE($fullcommand, $args, $matches)
        {
            $svar = '';
            $stype = 'percent';
            // in or out?
    Severity: Minor
    Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

      Method readData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function readData(&$map, &$mapItem)
          {
              MapUtility::debug("ReadData for $mapItem ($this->pluginName $this->pluginRunnable)\n");
              if (!$this->pluginRunnable) {
                  MapUtility::debug("Plugin %s isn't runnable\n", $this->pluginName);
      Severity: Minor
      Found in lib/Weathermap/Core/Target.php - About 1 hr to fix

        Method createColorizePalette has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function createColorizePalette($red, $green, $blue)
            {
                // We will create a monochromatic palette based on the input color
                // which will go from black to white
        
        
        Severity: Minor
        Found in lib/Weathermap/Core/ImageUtility.php - About 1 hr to fix

          Method drawArtificialIcon has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function drawArtificialIcon(&$map, $labelColour)
              {
                  MapUtility::debug('Artificial Icon type ' . $this->iconfile . " for $this->name\n");
                  // this is an artificial icon - we don't load a file for it
          
          
          Severity: Minor
          Found in lib/Weathermap/Core/MapNode.php - About 1 hr to fix

            Method drawBandwidthLabels has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function drawBandwidthLabels($gdImage)
                {
                    MapUtility::debug('Link ' . $this->name . ": Drawing bwlabels.\n");
            
                    $directions = $this->getDirectionList();
            Severity: Minor
            Found in lib/Weathermap/Core/MapLink.php - About 1 hr to fix

              Method mapReadOnlySettings has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function mapReadOnlySettings(
                      $id,
                      $title = ''
                  ) {
                      if ($title == '') {

                Method addNode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addNode($x, $y, $nodeName = "", $template = "DEFAULT")
                    {
                        if (!$this->isLoaded()) {
                            throw new WeathermapInternalFail("Map must be loaded before editing API called.");
                        }
                Severity: Minor
                Found in lib/Weathermap/Editor/Editor.php - About 1 hr to fix

                  Method cloneNode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function cloneNode($sourceNodeName, $targetName = "", $orFail = false)
                      {
                          if (!$this->isLoaded()) {
                              throw new WeathermapInternalFail("Map must be loaded before editing API called.");
                          }
                  Severity: Minor
                  Found in lib/Weathermap/Editor/Editor.php - About 1 hr to fix

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

                        public function readData($targetString, &$map, &$mapItem)
                        {
                            $this->data[IN] = null;
                            $this->data[OUT] = null;
                    
                    
                    Severity: Minor
                    Found in lib/Weathermap/Plugins/Datasources/Time.php - About 1 hr to fix

                      Function render has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          render() {
                      
                              const groups = Object.keys(this.props.groups).map((key, index) => {
                                  const group = this.props.groups[key];
                      
                      
                      Severity: Minor
                      Found in websrc/cacti-mgmt/src/components/MapList.js - About 1 hr to fix

                        Function updateView has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          updateView() {
                            if (this.state.redirect === true) {
                              this.setState({
                                redirect: false
                              });
                        Severity: Minor
                        Found in websrc/cacti-user/src/components/SingleMap.js - About 1 hr to fix

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

                              public function draw($gdImage)
                              {
                                  if (is_null($this->curvePoints)) {
                                      throw new WeathermapInternalFail('DrawingEmptySpline');
                                  }
                          Severity: Minor
                          Found in lib/Weathermap/Core/LinkGeometry.php - About 1 hr to fix

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

                                public function generateFontSampleImage($map)
                                {
                                    $keyFontNumber = 2;
                                    $keyFont = $map->fonts->getFont($keyFontNumber);
                                    $keyHeight = imagefontheight($keyFontNumber) + 2;
                            Severity: Minor
                            Found in lib/Weathermap/Editor/EditorUI.php - About 1 hr to fix

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

                                  public function handleSettingsAPI($request, $appObject)
                                  {
                                      header('Content-type: application/json');
                              
                                      $styleTextOptions = array("thumbs", "full", "full-first-only");
                              Severity: Minor
                              Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php - About 1 hr to fix

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

                                    private function drawOneFullMap($map)
                                    {
                                        $htmlFileName = $this->outputDirectory . DIRECTORY_SEPARATOR . $map->filehash . ".html";
                                        $mapTitle = $this->getMapTitle($map);
                                        print '<div class="weathermapholder" id="mapholder_' . $map->filehash . '">';
                                Severity: Minor
                                Found in lib/Weathermap/Integrations/Cacti/WeatherMapCactiUserPlugin.php - About 1 hr to fix

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

                                  const MapCollection = (props) => {
                                  
                                    if (props.group_id === 'default' && props.maps[0]) {
                                      return (
                                          <Redirect to={`/group/${props.maps[0].group_id}`}/>
                                  Severity: Minor
                                  Found in websrc/cacti-user/src/components/MapCollection.js - 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 processStringFindReferredObject has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function processStringFindReferredObject(&$context, $itemname, $type)
                                      {
                                          if (($itemname == "this") && ($type == strtolower($context->myType()))) {
                                              return $context;
                                          }
                                  Severity: Minor
                                  Found in lib/Weathermap/Core/Map.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 updateView has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    updateView() {
                                      if (this.state.redirect === true) {
                                        this.setState({
                                          redirect: false
                                        });
                                  Severity: Minor
                                  Found in websrc/cacti-user/src/components/SingleMap.js - 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 checkPaths has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function checkPaths()
                                      {
                                          $version = explode('.', PHP_VERSION);
                                          self::$phpTag = "php-" . $version[0] . "." . $version[1];
                                  
                                  
                                  Severity: Minor
                                  Found in lib/Weathermap/Tests/ConfigTest.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