tapestry-cloud/tapestry

View on GitHub

Showing 282 of 291 total issues

Function getNestedValueByKey has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    private function getNestedValueByKey($key)
    {
        if (isset($this->nestedKeyCache[$key])) {
            return $this->nestedKeyCache[$key];
        }
Severity: Minor
Found in src/ArrayContainer.php - About 4 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

Function __invoke has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function __invoke(Project $project, OutputInterface $output)
    {
        //
        // Loop over all project files, those that have a data source via the `use` method should have the relevant
        // content type data source passed to them. Those that have generators associated with them (such as those using
Severity: Minor
Found in src/Modules/ContentTypes/ParseContentTypes.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

Function getCompiled has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCompiled(File $file, $pretty = true)
    {
        $output = $this->template;
        $output = str_replace('{ext}', $file->getExt(), $output);
        $output = str_replace('{filename}', $this->sluggify($file->getFilename()), $output);
Severity: Minor
Found in src/Entities/Permalink.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

ArrayContainer has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class ArrayContainer implements ArrayAccess, Iterator
{
    /**
     * Current array key pointer for foreach.
     *
Severity: Minor
Found in src/ArrayContainer.php - About 3 hrs to fix

    The class ArrayContainer has an overall complexity of 64 which is very high. The configured complexity threshold is 50.
    Open

    class ArrayContainer implements ArrayAccess, Iterator
    {
        /**
         * Current array key pointer for foreach.
         *
    Severity: Minor
    Found in src/ArrayContainer.php by phpmd

    The class ArrayContainer has 20 public methods. Consider refactoring ArrayContainer to keep number of public methods under 10.
    Open

    class ArrayContainer implements ArrayAccess, Iterator
    {
        /**
         * Current array key pointer for foreach.
         *
    Severity: Minor
    Found in src/ArrayContainer.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

    Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

    The class Compile has an overall complexity of 50 which is very high. The configured complexity threshold is 50.
    Confirmed

    class Compile implements Step
    {
        /**
         * @var Filesystem
         */
    Severity: Minor
    Found in src/Modules/Content/Compile.php by phpmd

    File has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class File implements ProjectFileInterface
    {
        /**
         * Unique Identifier for this File.
         *
    Severity: Minor
    Found in src/Entities/File.php - About 3 hrs to fix

      Function __invoke has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __invoke(Project $project, OutputInterface $output)
          {
              if (! file_exists($project->sourceDirectory)) {
                  $output->writeln('[!] The project source path could not be opened at ['.$project->sourceDirectory.']');
      
      
      Severity: Minor
      Found in src/Modules/Content/LoadSourceFiles.php - About 2 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

      Method generate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function generate(Project $project)
          {
              $newFile = clone $this->file;
              $newFile->setData([
                  'generator' => array_filter($this->file->getData('generator'), function ($value) {
      Severity: Major
      Found in src/Entities/Generators/PaginationGenerator.php - About 2 hrs to fix

        Function encodePart has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            private function encodePart($part)
            {
                if (strpos($part, '?') !== false) {
                    if (strpos($part, '?') === 0) {
                        $output = '?';
        Severity: Minor
        Found in src/Entities/Url.php - About 2 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

        Function generate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public function generate(Project $project)
            {
                $newFile = clone $this->file;
                $newFile->setData([
                    'generator' => array_filter($this->file->getData('generator'), function ($value) {
        Severity: Minor
        Found in src/Entities/Generators/PaginationGenerator.php - About 2 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

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

            public function getCompiled(File $file, $pretty = true)
            {
                $output = $this->template;
                $output = str_replace('{ext}', $file->getExt(), $output);
                $output = str_replace('{filename}', $this->sluggify($file->getFilename()), $output);
        Severity: Major
        Found in src/Entities/Permalink.php - About 2 hrs to fix

          Function mutateProjectFiles has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function mutateProjectFiles(Project $project)
              {
                  /** @var ContentRendererFactory $contentRenderers */
                  $contentRenderers = $project->get('content_renderers');
          
          
          Severity: Minor
          Found in src/Entities/ContentType.php - About 2 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

          Method __invoke has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function __invoke(Project $project, OutputInterface $output)
              {
                  if (! file_exists($project->sourceDirectory)) {
                      $output->writeln('[!] The project source path could not be opened at ['.$project->sourceDirectory.']');
          
          
          Severity: Major
          Found in src/Modules/Content/LoadSourceFiles.php - About 2 hrs to fix

            Method renderFile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function renderFile(File $file, array $data = [])
                {
                    $this->data($data);
                    unset($data);
            
            
            Severity: Minor
            Found in src/Plates/Template.php - About 1 hr to fix

              Avoid excessively long variable names like $contentRendererFactory. Keep variable name length under 20.
              Open

                      $contentRendererFactory = new ContentRendererFactory();

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Avoid excessively long variable names like $currentWorkingDirectory. Keep variable name length under 20.
              Open

                      $currentWorkingDirectory = $this->input->getOption('site-dir');
              Severity: Minor
              Found in src/Console/Commands/InitCommand.php by phpmd

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Avoid excessively long variable names like $latestVersionDownloadUrl. Keep variable name length under 20.
              Open

                  private function replacePhar($latestVersionDownloadUrl)

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Avoid excessively long variable names like $hasUnderscoreExceptions. Keep variable name length under 20.
              Open

                      $hasUnderscoreExceptions = (count($this->underscoreExceptions) > 0);

              LongVariable

              Since: 0.2

              Detects when a field, formal or local variable is declared with a long name.

              Example

              class Something {
                  protected $reallyLongIntName = -3; // VIOLATION - Field
                  public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                      $otherReallyLongName = -5; // VIOLATION - Local
                      for ($interestingIntIndex = 0; // VIOLATION - For
                           $interestingIntIndex < 10;
                           $interestingIntIndex++ ) {
                      }
                  }
              }

              Source https://phpmd.org/rules/naming.html#longvariable

              Severity
              Category
              Status
              Source
              Language