kylekatarnls/nodejs-php-fallback

View on GitHub

Showing 7 of 42 total issues

NodejsPhpFallback has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class NodejsPhpFallback
{
    protected $nodePath;

    protected static $modulePaths = array();
Severity: Minor
Found in src/NodejsPhpFallback/NodejsPhpFallback.php - About 2 hrs to fix

    File NodejsPhpFallback.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace NodejsPhpFallback;
    
    use Composer\Composer;
    Severity: Minor
    Found in src/NodejsPhpFallback/NodejsPhpFallback.php - About 2 hrs to fix

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

          protected static function getNpmConfig(Composer $composer, $key = null)
          {
              $vendorDir = $composer->getConfig()->get('vendor-dir');
      
              $npm = array();
      Severity: Minor
      Found in src/NodejsPhpFallback/NodejsPhpFallback.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 askForInstall has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function askForInstall(Event $event, $npmConfirm, $npm)
          {
              $io = $event->getIO();
      
              if (!$io->isInteractive()) {
      Severity: Minor
      Found in src/NodejsPhpFallback/NodejsPhpFallback.php - About 1 hr to fix

        Method installPackages has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function installPackages($npm, $onFound = null)
            {
                if (!count($npm)) {
                    return true;
                }
        Severity: Minor
        Found in src/NodejsPhpFallback/NodejsPhpFallback.php - About 1 hr to fix

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

              public static function installPackages($npm, $onFound = null)
              {
                  if (!count($npm)) {
                      return true;
                  }
          Severity: Minor
          Found in src/NodejsPhpFallback/NodejsPhpFallback.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 askForInstall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function askForInstall(Event $event, $npmConfirm, $npm)
              {
                  $io = $event->getIO();
          
                  if (!$io->isInteractive()) {
          Severity: Minor
          Found in src/NodejsPhpFallback/NodejsPhpFallback.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