tflori/hugga

View on GitHub

Showing 20 of 29 total issues

Console has 39 functions (exceeds 20 allowed). Consider refactoring.
Open

class Console
{
    const WEIGHT_HIGH = 300;
    const WEIGHT_HIGHER = 250;
    const WEIGHT_NORMAL = 200;
Severity: Minor
Found in src/Console.php - About 5 hrs to fix

    File Table.php has 381 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Hugga\Output\Drawing;
    
    use Hugga\Console;
    Severity: Minor
    Found in src/Output/Drawing/Table.php - About 5 hrs to fix

      File Console.php has 341 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Hugga;
      
      use Hugga\Input\Editline;
      Severity: Minor
      Found in src/Console.php - About 4 hrs to fix

        Function getRows has a Cognitive Complexity of 28 (exceeds 9 allowed). Consider refactoring.
        Open

            protected function getRows(iterable $data): array
            {
                $rows = [];
                list($left, $right, $spacer) = $this->getDivider();
        
        
        Severity: Minor
        Found in src/Output/Drawing/Table.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

        Table has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Table implements DrawingInterface
        {
            const CORNER_TOP_LEFT = 'ctl';
            const CORNER_TOP_RIGHT = 'ctr';
            const CORNER_BOTTOM_LEFT = 'cbl';
        Severity: Minor
        Found in src/Output/Drawing/Table.php - About 2 hrs to fix

          ProgressBar has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ProgressBar implements DrawingInterface
          {
              protected static $formatDefinitions = [
                  'percentage' => '{percentage%3.0f}%',
                  'steps' => '{done}/{max}',
          Severity: Minor
          Found in src/Output/Drawing/ProgressBar.php - About 2 hrs to fix

            Method askInteractive has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function askInteractive(Console $console, Observer $observer)
                {
                    /** @var InteractiveOutputInterface $output */
                    $output = $console->getOutput();
                    $maxVisible = $output->getSize()[0] - 2;
            Severity: Minor
            Found in src/Input/Question/Choice.php - About 2 hrs to fix

              Method getRows has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getRows(iterable $data): array
                  {
                      $rows = [];
                      list($left, $right, $spacer) = $this->getDivider();
              
              
              Severity: Minor
              Found in src/Output/Drawing/Table.php - About 1 hr to fix

                Method prepareColumns has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function prepareColumns()
                    {
                        if ($this->columns) {
                            return;
                        }
                Severity: Minor
                Found in src/Output/Drawing/Table.php - About 1 hr to fix

                  Function prepareColumns has a Cognitive Complexity of 16 (exceeds 9 allowed). Consider refactoring.
                  Open

                      protected function prepareColumns()
                      {
                          if ($this->columns) {
                              return;
                          }
                  Severity: Minor
                  Found in src/Output/Drawing/Table.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 getText has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getText(): string
                      {
                          $this->prepareColumns();
                          $rows = [];
                  
                  
                  Severity: Minor
                  Found in src/Output/Drawing/Table.php - About 1 hr to fix

                    Method replaceFormatting has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function replaceFormatting(string $message, $strip = false)
                        {
                            $offset = 0;
                            $regEx = '/' . str_replace('()', '(' . $this->regexDefinition . ')', $this->regexTag) . '/';
                            $buffer = $message;
                    Severity: Minor
                    Found in src/Formatter.php - About 1 hr to fix

                      Function getEscapeSequence has a Cognitive Complexity of 13 (exceeds 9 allowed). Consider refactoring.
                      Open

                          protected function getEscapeSequence(string $def): string
                          {
                              if (strpos($def, ';') !== false) {
                                  return implode('', array_map([$this, 'getEscapeSequence'], explode(';', $def)));
                              }
                      Severity: Minor
                      Found in src/Formatter.php - About 55 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 getText has a Cognitive Complexity of 11 (exceeds 9 allowed). Consider refactoring.
                      Open

                          public function getText(): string
                          {
                              $this->prepareColumns();
                              $rows = [];
                      
                      
                      Severity: Minor
                      Found in src/Output/Drawing/Table.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 $this->escape("48;5;" . $color);
                      Severity: Major
                      Found in src/Formatter.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $this->escape(static::$fgColors[$color]);
                        Severity: Major
                        Found in src/Formatter.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $this->escape(static::$fgColors[$def]);
                          Severity: Major
                          Found in src/Formatter.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return $this->escape(static::$bgColors[$color]);
                            Severity: Major
                            Found in src/Formatter.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return '';
                              Severity: Major
                              Found in src/Formatter.php - About 30 mins to fix

                                Function replaceFormatting has a Cognitive Complexity of 10 (exceeds 9 allowed). Consider refactoring.
                                Open

                                    protected function replaceFormatting(string $message, $strip = false)
                                    {
                                        $offset = 0;
                                        $regEx = '/' . str_replace('()', '(' . $this->regexDefinition . ')', $this->regexTag) . '/';
                                        $buffer = $message;
                                Severity: Minor
                                Found in src/Formatter.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