howardjones/network-weathermap

View on GitHub

Showing 1,091 of 1,093 total issues

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

    public function permissionsList(
        $id
    ) {
        $map = $this->manager->getMap($id);
        $title = $map->titlecache;

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

    public function __construct()
    {
        $this->alpha = 255;

        // a set of 3 colours
Severity: Minor
Found in lib/Weathermap/Core/Colour.php - About 1 hr to fix

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

                <span className="wm-footer-element"><a href={this.props.settings.editor_url}><FormattedMessage id="editor"
                                                                                                               defaultMessage="Editor"/></a></span>
    Severity: Major
    Found in websrc/cacti-mgmt/src/components/Footer.js and 1 other location - About 1 hr to fix
    websrc/cacti-mgmt/src/components/Footer.js on lines 12..13

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

    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

                <span className="wm-footer-element"><a href={this.props.settings.docs_url}><FormattedMessage id="manual"
                                                                                                             defaultMessage="Manual"/></a></span>
    Severity: Major
    Found in websrc/cacti-mgmt/src/components/Footer.js and 1 other location - About 1 hr to fix
    websrc/cacti-mgmt/src/components/Footer.js on lines 10..11

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

    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

    Method getMapFileList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getMapFileList()
        {
            $files = array();
            $valid_files = array();
    
    

      Method renameNode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function renameNode($oldName, $newName)
          {
              if (!$this->map->nodeExists($oldName)) {
                  return $oldName;
              }
      Severity: Minor
      Found in lib/Weathermap/Editor/Editor.php - About 1 hr to fix

        Method getConfig has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getConfig()
            {
                assert(isset($this->owner));
        
                $output = '';
        Severity: Minor
        Found in lib/Weathermap/Core/Legend.php - About 1 hr to fix

          Method outputHTML has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function outputHTML()
              {
                  if ($this->htmlFile != '') {
                      MapUtility::debug("Writing HTML to $this->htmlFile\n");
          
          
          Severity: Minor
          Found in lib/Weathermap/CLI/Runner.php - About 1 hr to fix

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

                render() {
            
                    let higher = <div/>
            
                    if (this.props.scope === 'map') {
            Severity: Minor
            Found in websrc/cacti-mgmt/src/components/SetEditor.js - About 1 hr to fix

              Method testMapSettings has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testMapSettings()
                  {
              
                      $settings = $this->manager->getMapSettings(0);
                      $this->assertEquals(1, count($settings));
              Severity: Minor
              Found in lib/Weathermap/Tests/MapManagerTest.php - About 1 hr to fix

                Method generateSortedImagemap has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function generateSortedImagemap($imagemapname)
                    {
                        $html = "\n<map name=\"" . $imagemapname . '" id="' . $imagemapname . "\">\n";
                
                        $allLayers = array_keys($this->seenZLayers);
                Severity: Minor
                Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

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

                      protected function handleMapEnableAPI(
                          $request,
                          $appObject
                      ) {
                          $data = array("success" => false);
                  lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php on lines 364..376

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

                  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

                      protected function handleMapDisableAPI(
                          $request,
                          $appObject
                      ) {
                          $data = array("success" => false);
                  lib/Weathermap/Integrations/Cacti/WeatherMapCactiManagementPlugin.php on lines 350..362

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

                  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

                  Method calculateCommentPosition has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function calculateCommentPosition($fontObject, $comment, $direction, $widthList)
                      {
                          list($textWidth, $textHeight) = $fontObject->calculateImageStringSize($comment);
                  
                          // nudge pushes the comment out along the link arrow a little bit
                  Severity: Minor
                  Found in lib/Weathermap/Core/MapLink.php - About 1 hr to fix

                    Method outputTestHTML has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function outputTestHTML($htmlfile, &$map)
                        {
                            $fd = fopen($htmlfile, 'w');
                            fwrite(
                                $fd,
                    Severity: Minor
                    Found in lib/Weathermap/Core/MapUtility.php - About 1 hr to fix

                      Method resolveRelativePositions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function resolveRelativePositions()
                          {
                              // calculate any relative positions here - that way, nothing else
                              // really needs to know about them
                      
                      
                      Severity: Minor
                      Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

                        Method testScaleManagement has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function testScaleManagement()
                            {
                                $this->object->populateDefaultsIfNecessary();
                                $this->assertEquals(9, $this->object->spanCount());
                        
                        
                        Severity: Minor
                        Found in lib/Weathermap/Tests/MapScaleTest.php - About 1 hr to fix

                          Method resolveRelativePosition has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function resolveRelativePosition($anchorNode)
                              {
                                  $anchorPosition = $anchorNode->getPosition();
                          
                                  if ($this->polar) {
                          Severity: Minor
                          Found in lib/Weathermap/Core/MapNode.php - About 1 hr to fix

                            Method selfValidate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function selfValidate()
                                {
                                    $classes = array(
                                        'GLOBAL' => 'Weathermap\\Core\\Map',
                                        'LINK' => 'Weathermap\\Core\\MapLink',
                            Severity: Minor
                            Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

                              Method testTidy has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function testTidy()
                                  {
                                      $editor = new Editor();
                                      $editor->newConfig();
                              
                              
                              Severity: Minor
                              Found in lib/Weathermap/Tests/EditorTest.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language