detain/myadmin-plugin-installer

View on GitHub

Showing 8 of 54 total issues

Method execute has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln([ // outputs multiple lines to the console (adding "\n" at the end of each line)
            'MyAdmin DocBlock Parser',
            '=======================',
Severity: Major
Found in src/Command/Parse.php - About 2 hrs to fix

    Function get_module_db has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_module_db($module)
    {
        if ($module == 'powerdns') {
            if (!isset($GLOBALS['powerdns_dbh'])) {
                $GLOBALS['powerdns_dbh'] = new \MyDb\Mdb2\Db(POWERDNS_DB, POWERDNS_USER, POWERDNS_PASSWORD, POWERDNS_HOST);
    Severity: Minor
    Found in src/modules.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 get_module_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function get_module_name($module = 'default')
    {
        if ($module != 'default') {
            if (isset($GLOBALS[$module.'_dbh'])) {
                return $module;
    Severity: Minor
    Found in src/modules.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 add_route_requirement has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function add_route_requirement($type, $function, $source = '', $path = false, $methods = false)
    Severity: Minor
    Found in src/Loader.php - About 35 mins to fix

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

          public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
      Severity: Minor
      Found in src/Installer.php - About 35 mins to fix

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

                function do_call($parent, $call, $calls)
                {
                    echo "Running \$parent->$call();".PHP_EOL;
                    $response = $parent->$call();
                    if (isset($calls[$call])) {
        Severity: Minor
        Found in src/Command/Parse.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 'default';
        Severity: Major
        Found in src/modules.php - About 30 mins to fix

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

          function get_module_settings($module = 'default', $setting = false)
          {
              if (!isset($GLOBALS['modules'][$module])) {
                  $keys = array_keys($GLOBALS['modules']);
                  $module = $keys[0];
          Severity: Minor
          Found in src/modules.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