mariuz/firebirdwebadmin

View on GitHub
inc/indices.inc.php

Summary

Maintainability
D
1 day
Test Coverage

Function modify_index has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

function modify_index($iname)
{
    global $dbhandle, $indices, $fb_error, $lsql;

    // alter the active/inactive status if the change was selected
Severity: Minor
Found in inc/indices.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 index_definition has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function index_definition($indexname, $title)
{
    global $indices, $acc_strings;

    if ($indexname != null  &&  !isset($_POST['acc_modind_doit'])) {
Severity: Major
Found in inc/indices.inc.php - About 2 hrs to fix

    Method modify_index has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function modify_index($iname)
    {
        global $dbhandle, $indices, $fb_error, $lsql;
    
        // alter the active/inactive status if the change was selected
    Severity: Major
    Found in inc/indices.inc.php - About 2 hrs to fix

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

      function get_index_table($indices, $order, $dir)
      {
          global $acc_strings;
      
          $name_url = url_session($_SERVER['PHP_SELF'].'?idxorder=1&order=name');
      Severity: Minor
      Found in inc/indices.inc.php - About 1 hr to fix

        Method create_index has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function create_index()
        {
            global $dbhandle, $indices, $fb_error, $lsql;
        
            $lsql = 'CREATE ';
        Severity: Minor
        Found in inc/indices.inc.php - About 1 hr to fix

          Method get_indices has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function get_indices($order, $dir)
          {
              global $dbhandle;
          
              $order_field = ($order == 'name') ? 'I.RDB$INDEX_NAME' : 'I.RDB$RELATION_NAME';
          Severity: Minor
          Found in inc/indices.inc.php - About 1 hr to fix

            Function create_index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            function create_index()
            {
                global $dbhandle, $indices, $fb_error, $lsql;
            
                $lsql = 'CREATE ';
            Severity: Minor
            Found in inc/indices.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

            Consider simplifying this complex logical expression.
            Open

                if ($indices[$iname]['table'] != $_POST['def_index_table']
                ||  $iname != $_POST['def_index_name']
                ||  $indices[$iname]['dir']   != $_POST['def_index_dir']
                ||  $indices[$iname]['uniq']  != $uniq_flag
                ||  $indices[$iname]['active'] != $acti_flag
            Severity: Major
            Found in inc/indices.inc.php - About 40 mins to fix

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

              function index_definition($indexname, $title)
              {
                  global $indices, $acc_strings;
              
                  if ($indexname != null  &&  !isset($_POST['acc_modind_doit'])) {
              Severity: Minor
              Found in inc/indices.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

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in inc/indices.inc.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return true;
                Severity: Major
                Found in inc/indices.inc.php - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status