roenw/PiPass

View on GitHub

Showing 6 of 6 total issues

Method install has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function install() {
    echo "DR check succeeded, now installing PiPass... \n";
    $GLOBALS['phpuser'] = get_current_user();
    $localPU = $GLOBALS['phpuser'];
    echo "Current php user is " .$GLOBALS['phpuser'] .".\n";
Severity: Major
Found in setup/setup.php - About 2 hrs to fix

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

    function install() {
        echo "DR check succeeded, now installing PiPass... \n";
        $GLOBALS['phpuser'] = get_current_user();
        $localPU = $GLOBALS['phpuser'];
        echo "Current php user is " .$GLOBALS['phpuser'] .".\n";
    Severity: Minor
    Found in setup/setup.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 uninstall has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function uninstall() {
        echo "You are about to fully remove PiPass and its integration from your system. Are you sure you want to continue? [y/n]";
    
        $handle = fopen ("php://stdin","r");
        $line = fgets($handle);
    Severity: Minor
    Found in setup/uninstall.php - About 1 hr to fix

      Function uninstall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function uninstall() {
          echo "You are about to fully remove PiPass and its integration from your system. Are you sure you want to continue? [y/n]";
      
          $handle = fopen ("php://stdin","r");
          $line = fgets($handle);
      Severity: Minor
      Found in setup/uninstall.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 preInstall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function preInstall() {
          echo "Please enter your web document root. (e.g. /var/www/html)\n";
          $handle = fopen ("php://stdin","r");
          $line = fgets($handle);
          if(trim($line)) {
      Severity: Minor
      Found in setup/uninstall.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 preInstall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function preInstall() {
          exec("sudo rm setup.php.*");
          $cfm = __FILE__;
          exec("sudo mv $cfm setup.php");
          echo "Please enter your web document root. (e.g. /var/www/html)\n";
      Severity: Minor
      Found in setup/setup.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

      Severity
      Category
      Status
      Source
      Language