mariuz/firebirdwebadmin

View on GitHub
inc/panel_elements.inc.php

Summary

Maintainability
F
4 days
Test Coverage

File panel_elements.inc.php has 579 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
// File           panel_elements.inc.php / FirebirdWebAdmin
// Purpose        functions for generating html-code that is needed in various panels
// Author         Lutz Brueckner <irie@gmx.de>
// Copyright      (c) 2000, 2001, 2002, 2003, 2004, 2005 by Lutz Brueckner,
Severity: Major
Found in inc/panel_elements.inc.php - About 1 day to fix

    Method get_column_constraint_definition has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function get_column_constraint_definition($coldefs, $idx)
    {
        global $fk_actions, $tb_strings;
    
        $fk_name = isset($coldefs['fk_name'])   ? $coldefs['fk_name']   : '';
    Severity: Major
    Found in inc/panel_elements.inc.php - About 3 hrs to fix

      Function get_tables_names has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      function get_tables_names($restrictions = array())
      {
          global $s_tables, $s_login;
      
          $rights = array('S' => 'select',
      Severity: Minor
      Found in inc/panel_elements.inc.php - About 3 hrs 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 get_datatype_definition has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function get_datatype_definition($idx, $title, $rowspan = 1, $collate = false)
      {
          global $s_coldefs, $tb_strings;
      
          // preselect values for the form elements
      Severity: Major
      Found in inc/panel_elements.inc.php - About 3 hrs to fix

        Method get_opened_table has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function get_opened_table($name, $title, $url, $curl = '', $cdiv = '')
        {
            global $s_fields, $tb_strings, $ptitle_strings;
        
            $html = <<<EOT
        Severity: Major
        Found in inc/panel_elements.inc.php - About 2 hrs to fix

          Method get_coldef_definition has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function get_coldef_definition($idx, $title, $rowspan, $collate = false)
          {
              global $s_coldefs, $tb_strings, $s_domains;
          
              $coldefs = isset($s_coldefs[$idx]) ? $s_coldefs[$idx] : array();
          Severity: Minor
          Found in inc/panel_elements.inc.php - About 1 hr to fix

            Function get_column_constraint_definition has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function get_column_constraint_definition($coldefs, $idx)
            {
                global $fk_actions, $tb_strings;
            
                $fk_name = isset($coldefs['fk_name'])   ? $coldefs['fk_name']   : '';
            Severity: Minor
            Found in inc/panel_elements.inc.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 get_tables_names has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function get_tables_names($restrictions = array())
            {
                global $s_tables, $s_login;
            
                $rights = array('S' => 'select',
            Severity: Minor
            Found in inc/panel_elements.inc.php - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if ($idx == 'mod' &&
                      ((isset($coldefs['primary'])  &&  $coldefs['primary_cols'] == 1) ||
                       (isset($coldefs['unique'])   &&  $coldefs['unique_cols']  == 1) ||
                       (isset($coldefs['foreign'])  &&  $coldefs['foreign_cols'] == 1)
                       )
              Severity: Major
              Found in inc/panel_elements.inc.php - About 1 hr to fix

                Method get_textfield has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function get_textfield($name, $size, $maxlength = null, $value = null, $type = 'text', $tags = array())
                Severity: Minor
                Found in inc/panel_elements.inc.php - About 45 mins to fix

                  Method get_table_selectlist has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function get_table_selectlist($name, $restrictions = array(), $sel = null, $empty = false, $tags = array(), $size = 1)
                  Severity: Minor
                  Found in inc/panel_elements.inc.php - About 45 mins to fix

                    Method get_selectlist has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    function get_selectlist($name, $arr, $sel = null, $empty = false, $tags = array(), $size = 1)
                    Severity: Minor
                    Found in inc/panel_elements.inc.php - About 45 mins to fix

                      Method get_indexed_selectlist has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      function get_indexed_selectlist($name, $arr, $sel = null, $empty = false, $tags = array(), $size = 1)
                      Severity: Minor
                      Found in inc/panel_elements.inc.php - About 45 mins to fix

                        Method get_opened_table has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function get_opened_table($name, $title, $url, $curl = '', $cdiv = '')
                        Severity: Minor
                        Found in inc/panel_elements.inc.php - About 35 mins to fix

                          Function get_indexed_selectlist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function get_indexed_selectlist($name, $arr, $sel = null, $empty = false, $tags = array(), $size = 1)
                          {
                              $sel = is_array($sel) ? array_map('htmlspecialchars', $sel) : htmlspecialchars($sel);
                          
                              $html = '<select class="form-control" id="'.$name.'" name="'.$name.'" size="'.$size.'"'.get_tags_string($tags).">\n";
                          Severity: Minor
                          Found in inc/panel_elements.inc.php - About 35 mins 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 get_sysdba_pw has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function get_sysdba_pw()
                          {
                              if ($GLOBALS['s_login']['user'] == 'SYSDBA') {
                                  return $GLOBALS['s_login']['password'];
                              }
                          Severity: Minor
                          Found in inc/panel_elements.inc.php - About 25 mins 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 table_column_detail_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function table_column_detail_string($haveit, $source, $showit)
                          {
                              $str = '';
                              if ($haveit == true) {
                                  if ($showit == true  &&  !empty($source)) {
                          Severity: Minor
                          Found in inc/panel_elements.inc.php - About 25 mins 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

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

                                  if (isset($coldefs['unique'])  &&  $coldefs['unique_cols'] == 1) {
                                      $checked_str = $coldefs['uq_del'] == true ? ' checked' : '';
                                      $drop_element .= "                <td>\n"
                                                      .'                  <label><input type="checkbox" name="cd_def_uq_del_'.$idx.'"'.$checked_str.'> <b>'.$tb_strings['DropUq']."</b>\n</label>"
                                                      ."                </td>\n";
                          Severity: Minor
                          Found in inc/panel_elements.inc.php and 2 other locations - About 30 mins to fix
                          inc/panel_elements.inc.php on lines 215..220
                          inc/panel_elements.inc.php on lines 227..232

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

                          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 3 locations. Consider refactoring.
                          Open

                                  if (isset($coldefs['foreign'])  &&  $coldefs['foreign_cols'] == 1) {
                                      $checked_str = $coldefs['fk_del'] == true ? ' checked' : '';
                                      $drop_element .= "                <td>\n"
                                                      .'                  <label><input type="checkbox" name="cd_def_fk_del_'.$idx.'"'.$checked_str.'> <b>'.$tb_strings['DropFK']."</b>\n</label>"
                                                      ."                </td>\n";
                          Severity: Minor
                          Found in inc/panel_elements.inc.php and 2 other locations - About 30 mins to fix
                          inc/panel_elements.inc.php on lines 215..220
                          inc/panel_elements.inc.php on lines 221..226

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

                          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 3 locations. Consider refactoring.
                          Open

                                  if (isset($coldefs['primary'])  &&  $coldefs['primary_cols'] == 1) {
                                      $checked_str = $coldefs['pk_del'] == true ? ' checked' : '';
                                      $drop_element .= "                <td>\n"
                                                      .'                  <label><input type="checkbox" name="cd_def_pk_del_'.$idx.'"'.$checked_str.'> <b>'.$tb_strings['DropPK']."</b>\n</label>"
                                                      ."                </td>\n";
                          Severity: Minor
                          Found in inc/panel_elements.inc.php and 2 other locations - About 30 mins to fix
                          inc/panel_elements.inc.php on lines 221..226
                          inc/panel_elements.inc.php on lines 227..232

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

                          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

                          There are no issues that match your filters.

                          Category
                          Status