howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (obtype === 'LINK') {
                      matches = Object.keys(mapdata.Links).filter(function (item) {
                          return mapdata.Links[item].id === required_id
                      });
                      // console.log(matches);
              Severity: Major
              Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
              editor-resources/editor.js on lines 170..175

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  if (obtype === 'NODE') {
                      matches = Object.keys(mapdata.Nodes).filter(function (item) {
                          return mapdata.Nodes[item].id === required_id
                      });
                      // console.log(matches);
              Severity: Major
              Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
              editor-resources/editor.js on lines 163..168

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                            export function unregister() {
                              if ('serviceWorker' in navigator) {
                                navigator.serviceWorker.ready.then(registration => {
                                  registration.unregister();
                                });
                            Severity: Major
                            Found in websrc/cacti-mgmt/src/registerServiceWorker.js and 1 other location - About 1 hr to fix
                            websrc/cacti-user/src/registerServiceWorker.js on lines 102..108

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 57.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Identical blocks of code found in 2 locations. Consider refactoring.
                            Open

                            export function unregister() {
                              if ('serviceWorker' in navigator) {
                                navigator.serviceWorker.ready.then(registration => {
                                  registration.unregister();
                                });
                            Severity: Major
                            Found in websrc/cacti-user/src/registerServiceWorker.js and 1 other location - About 1 hr to fix
                            websrc/cacti-mgmt/src/registerServiceWorker.js on lines 102..108

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 57.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                    if (comment_pos_out.val() !== mylink.commentposout) {
                                        comment_pos_out.prepend("<option selected value='" + mylink.commentposout + "'>" + mylink.commentposout + "%</option>");
                                    }
                            Severity: Major
                            Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
                            editor-resources/editor.js on lines 580..582

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 57.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                                    if (comment_pos_in.val() !== mylink.commentposin) {
                                        comment_pos_in.prepend("<option selected value='" + mylink.commentposin + "'>" + mylink.commentposin + "%</option>");
                                    }
                            Severity: Major
                            Found in editor-resources/editor.js and 1 other location - About 1 hr to fix
                            editor-resources/editor.js on lines 575..577

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 57.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language