howardjones/network-weathermap

View on GitHub

Showing 380 of 1,093 total issues

Function getConfigSimple has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getConfigSimple($simpleParameters, $comparison)
    {
        $output = '';

        # TEMPLATE must come first. DEFAULT
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

Function findIndexNearDistance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function findIndexNearDistance($targetDistance)
    {
        $left = 0;
        $right = count($this->elements) - 1;

Severity: Minor
Found in lib/Weathermap/Core/Spine.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 weathermap_poller_bottom has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

function weathermap_poller_bottom()
{
    global $config;
    global $weathermapPollerStartTime;

Severity: Minor
Found in lib/Weathermap/Integrations/Cacti/cacti-plugin-poller.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 processStringToken has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function processStringToken($includeNotes, $keyContents, $key, $context)
    {
        $value = '[UNKNOWN]';
        $format = "";
        $theItem = null;
Severity: Minor
Found in lib/Weathermap/Core/Map.php - About 1 hr to fix

    Function click_handler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function click_handler(e) {
        var alt, objectname, objecttype, objectid, map_object;
    
        alt = jQuery(this).attr("id");
    
    
    Severity: Minor
    Found in editor-resources/editor.js - About 1 hr to fix

      Method testTidyAll has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function show_node has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function show_node(name) {
            mapmode('existing');
        
            hide_all_dialogs();
        
        
        Severity: Minor
        Found in editor-resources/editor.js - About 1 hr to fix

          Method getAvailableImages has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAvailableImages($imageDirectory, $map)
              {
                  $imageList = array();
          
                  if (is_dir($imageDirectory)) {
          Severity: Minor
          Found in lib/Weathermap/Editor/EditorUI.php - About 1 hr to fix

            Method getExistingConfigs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getExistingConfigs($mapDirectory)
                {
                    $titles = array();
                    $notes = array();
            
            
            Severity: Minor
            Found in lib/Weathermap/Editor/EditorUI.php - About 1 hr to fix

              Method weathermap_show_tab has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function weathermap_show_tab()
              {
                  global $config, $user_auth_realm_filenames;
                  $realmID = 0;
              
              
              Severity: Minor
              Found in lib/Weathermap/Integrations/Cacti/cacti88-plugin-hooks.php - About 1 hr to fix

                Method handleLinkStep1 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function handleLinkStep1($request, $context = null)
                    {
                        global $config;
                
                //        $pdo = weathermap_get_pdo();
                Severity: Minor
                Found in lib/Weathermap/Integrations/Cacti/EditorDataPicker.php - About 1 hr to fix

                  Method has_transparency has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function has_transparency($imageRef)
                  {
                      $width = imagesx($imageRef);
                      $height = imagesy($imageRef);
                      $im2 = imagecreate($width, $height);
                  Severity: Minor
                  Found in test-multipass.php - About 1 hr to fix

                    Method ReadData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function ReadData($targetString, &$map, &$mapItem)
                        {
                            // By default, fail.
                            // Remove these 4 lines ONLY if you understand the risks, and have taken appropriate measures
                            // so that users (or the public) can't access your map editor! Otherwise they can run
                    Severity: Minor
                    Found in lib/Weathermap/Plugins/Datasources/ExternalScript.php - About 1 hr to fix

                      Method compareImages has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function compareImages($src, $copy, $type)
                          {
                              $this->assertEquals(imagesx($src), imagesx($copy));
                              $this->assertEquals(imagesy($src), imagesy($copy));
                              $this->assertEquals(imageistruecolor($src), imageistruecolor($copy));
                      Severity: Minor
                      Found in lib/Weathermap/Tests/ImageLoaderTest.php - About 1 hr to fix

                        Method testKeywordCoverage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function testKeywordCoverage()
                            {
                        
                                $docsIndex = $this->docsRoot . "/index.xml";
                        
                        
                        Severity: Minor
                        Found in lib/Weathermap/Tests/DocsTest.php - About 1 hr to fix

                          Method handleSCALE has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function handleSCALE($fullcommand, $args, $matches)
                              {
                          
                                  // The default scale name is DEFAULT
                                  if ($matches[1] == '') {
                          Severity: Minor
                          Found in lib/Weathermap/Core/ConfigReader.php - About 1 hr to fix

                            Method handleMapSettingsSave has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function handleMapSettingsSave(
                                    $request,
                                    $appObject
                                ) {
                                    $mapid = null;

                              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 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language