howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

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

    public function testObjects()
    {
        $table = new FontTable();
        $this->assertEquals(0, $table->count());

Severity: Minor
Found in lib/Weathermap/Tests/FontTableTest.php - About 1 hr to fix

    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 drawTimestamp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function drawTimestamp($imageRef, $font, $colour, $which = '')
            {
                // add a timestamp to the corner, so we can tell if it's all being updated
        
                $fontObject = $this->fonts->getFont($font);
        Severity: Minor
        Found in lib/Weathermap/Core/Map.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 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 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

                    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 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

                          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 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

                                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

                                  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 translateRuntimeOptionsToSettings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function translateRuntimeOptionsToSettings()
                                      {
                                          global $weathermap_error_suppress;
                                  
                                          $this->configFile = $this->getOpt->getOption('config');
                                  Severity: Minor
                                  Found in lib/Weathermap/CLI/Runner.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 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 copyFrom has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function copyFrom(&$source)
                                      {
                                          MapUtility::debug("Initialising %s $this->name from $source->name\n", $this->myType());
                                          assert(is_object($source));
                                  
                                  
                                  Severity: Minor
                                  Found in lib/Weathermap/Core/MapDataItem.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