Aerendir/console-styles-bundle

View on GitHub

Showing 34 of 34 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
    {
        $indentLength = 0;
        $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
        $lines        = [];
Severity: Major
Found in src/Console/Style/SF4/SerendipityHQStyleSF4.php and 1 other location - About 2 days to fix
src/Console/Style/SerendipityHQStyleSF5.php on lines 690..737

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 479.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function createBlock($messages, $type = null, $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
    {
        $indentLength = 0;
        $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
        $lines        = [];
Severity: Major
Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 2 days to fix
src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 717..764

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 479.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

SerendipityHQStyleSF4 has 51 functions (exceeds 20 allowed). Consider refactoring.
Open

class SerendipityHQStyleSF4 extends OutputStyle
{
    /**
     * @var int
     */
Severity: Major
Found in src/Console/Style/SF4/SerendipityHQStyleSF4.php - About 7 hrs to fix

    SerendipityHQStyleSF5 has 50 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SerendipityHQStyleSF5 extends OutputStyle
    {
        /** @var int */
        private const MAX_LINE_LENGTH = 120;
    
    
    Severity: Minor
    Found in src/Console/Style/SerendipityHQStyleSF5.php - About 7 hrs to fix

      File SerendipityHQStyleSF4.php has 412 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /*
       * This file is part of the Serendipity HQ Console Styles Component.
       *
      Severity: Minor
      Found in src/Console/Style/SF4/SerendipityHQStyleSF4.php - About 5 hrs to fix

        File SerendipityHQStyleSF5.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /*
         * This file is part of the Serendipity HQ Console Styles Component.
         *
        Severity: Minor
        Found in src/Console/Style/SerendipityHQStyleSF5.php - About 5 hrs to fix

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              protected function createLine(string $message, $type = null, $style = null, string $prefix = '', bool $escape = false): string
              {
                  if ($escape) {
                      $message = OutputFormatter::escape($message);
                  }
          Severity: Major
          Found in src/Console/Style/SF4/SerendipityHQStyleSF4.php and 1 other location - About 5 hrs to fix
          src/Console/Style/SerendipityHQStyleSF5.php on lines 746..768

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 183.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              protected function createLine(string $message, $type = null, $style = null, string $prefix = '', bool $escape = false): string
              {
                  if ($escape) {
                      $message = OutputFormatter::escape($message);
                  }
          Severity: Major
          Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 5 hrs to fix
          src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 773..795

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 183.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ($input->getOption('show-ansi')) {
                      // Print out the available ANSI colors
                      $ioWriter->section('Those are the available ANSI colors');
                      $ioWriter->block('black', null, 'fg=black');
                      $ioWriter->block('red', null, 'fg=red');
          Severity: Major
          Found in src/Command/SerendipityHQStylesCommand.php and 1 other location - About 4 hrs to fix
          src/Command/SymfonyStylesCommand.php on lines 48..60

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 182.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                  if ($input->getOption('show-ansi')) {
                      // Print out the available ANSI colors
                      $ioWriter->section('Those are the available ANSI colors');
                      $ioWriter->block('black', null, 'fg=black');
                      $ioWriter->block('red', null, 'fg=red');
          Severity: Major
          Found in src/Command/SymfonyStylesCommand.php and 1 other location - About 4 hrs to fix
          src/Command/SerendipityHQStylesCommand.php on lines 53..65

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 182.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              protected function execute(InputInterface $input, OutputInterface $output): int
              {
                  $outputFormatter = new SerendipityHQOutputFormatter(true);
                  $ioWriter        = new SerendipityHQStyle($input, $output);
                  $ioWriter->setFormatter($outputFormatter);
          Severity: Major
          Found in src/Command/SerendipityHQStylesCommand.php - About 2 hrs to fix

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                public function askQuestion(Question $question): string
                {
                    trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                    if ($this->input->isInteractive()) {
                        $this->autoPrependBlock();
            Severity: Major
            Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 1 hr to fix
            src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 557..576

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 118.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                public function askQuestion(Question $question): string
                {
                    trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                    if ($this->input->isInteractive()) {
                        $this->autoPrependBlock();
            Severity: Major
            Found in src/Console/Style/SF4/SerendipityHQStyleSF4.php and 1 other location - About 1 hr to fix
            src/Console/Style/SerendipityHQStyleSF5.php on lines 547..566

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 118.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                protected function createBlock($messages, $type = null, $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
                {
                    $indentLength = 0;
                    $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
                    $lines        = [];
            Severity: Minor
            Found in src/Console/Style/SerendipityHQStyleSF5.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 createBlock has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
                {
                    $indentLength = 0;
                    $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
                    $lines        = [];
            Severity: Minor
            Found in src/Console/Style/SF4/SerendipityHQStyleSF4.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 createBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function createBlock($messages, $type = null, $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
                {
                    $indentLength = 0;
                    $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
                    $lines        = [];
            Severity: Minor
            Found in src/Console/Style/SerendipityHQStyleSF5.php - About 1 hr to fix

              Method createBlock has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
                  {
                      $indentLength = 0;
                      $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
                      $lines        = [];
              Severity: Minor
              Found in src/Console/Style/SF4/SerendipityHQStyleSF4.php - About 1 hr to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function table(array $headers, array $rows): void
                    {
                        trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                        $style = clone Table::getStyleDefinition('symfony-style-guide');
                        $style->setCellHeaderFormat('<fg=green>%s</>');
                Severity: Major
                Found in src/Console/Style/SerendipityHQStyleSF5.php and 1 other location - About 1 hr to fix
                src/Console/Style/SF4/SerendipityHQStyleSF4.php on lines 425..438

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 106.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function table(array $headers, array $rows)
                    {
                        trigger_error('Use Symfony\Component\Console\Style\SymfonyStyle corresponding method instead.', E_USER_DEPRECATED);
                        $style = clone Table::getStyleDefinition('symfony-style-guide');
                        $style->setCellHeaderFormat('<fg=green>%s</>');
                Severity: Major
                Found in src/Console/Style/SF4/SerendipityHQStyleSF4.php and 1 other location - About 1 hr to fix
                src/Console/Style/SerendipityHQStyleSF5.php on lines 415..428

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 106.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

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

                    protected function execute(InputInterface $input, OutputInterface $output): int
                    {
                        $ioWriter = new SymfonyStyle($input, $output);
                
                        if ($input->getOption('show-ansi')) {
                Severity: Minor
                Found in src/Command/SymfonyStylesCommand.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language