tapestry-cloud/tapestry

View on GitHub

Showing 282 of 291 total issues

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

    private function executeContentRenderers(ContentRendererFactory $contentRenderers)
    {
        while (! $this->allFilesRendered()) {
            foreach ($this->files as &$file) {
                if ($file->isRendered()) {
Severity: Minor
Found in src/Modules/Content/Compile.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

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

    public function addFile(File $file)
    {
        $file->setData(['contentType' => $this->name]);
        $this->itemsOrderCache = null;
        $this->items->set($file->getUid(), $file->getData('date')->getTimestamp());
Severity: Minor
Found in src/Entities/ContentType.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

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

    public function boot()
    {
        $container = $this->getContainer();

        /** @var Tapestry $tapestry */
Severity: Minor
Found in src/Providers/ProjectKernelServiceProvider.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

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

    public function generate(Project $project)
    {
        $generated = [];

        if (! $uses = $this->file->getData('use')) {
Severity: Minor
Found in src/Entities/Generators/TaxonomyArchiveGenerator.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

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

    public function generate(Project $project, OutputInterface $output)
    {
        $output->writeln('Generating site from <comment>'.$project->sourceDirectory.'</comment> to <comment>'.$project->destinationDirectory.'</comment>');
        $stopwatch = $project->get('cmd_options.stopwatch', false);
        $eventEmitter = $this->tapestry->getEventEmitter();
Severity: Minor
Found in src/Generator.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

Missing class import via use statement (line '123', column '48').
Open

                if ($file->getData('date', new \DateTime()) > $this->now) {

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

Source http://phpmd.org/rules/cleancode.html#MissingImport

Avoid too many return statements within this method.
Open

        return $this->itemsOrderCache[$order];
Severity: Major
Found in src/Entities/ContentType.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $pe[0].'/#'.rawurlencode($pe[1]);
    Severity: Major
    Found in src/Entities/Url.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return rawurlencode($part);
      Severity: Major
      Found in src/Entities/Url.php - About 30 mins to fix

        The method add has a boolean flag argument $overWrite, which is a certain sign of a Single Responsibility Principle violation.
        Open

            public function add(ContentType $contentType, $overWrite = false)

        BooleanArgumentFlag

        Since: 1.4.0

        A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

        Example

        class Foo {
            public function bar($flag = true) {
            }
        }

        Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

        Avoid too many return statements within this method.
        Open

                return $value;
        Severity: Major
        Found in src/ArrayContainer.php - About 30 mins to fix

          Missing class import via use statement (line '58', column '26').
          Open

                  $this->now = new \DateTime();

          MissingImport

          Since: 2.7.0

          Importing all external classes in a file through use statements makes them clearly visible.

          Example

          function make() {
              return new \stdClass();
          }

          Source http://phpmd.org/rules/cleancode.html#MissingImport

          Avoid too many return statements within this method.
          Open

                                  return $value !== '{filename}';
          Severity: Major
          Found in src/Entities/Generators/PaginationGenerator.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $newFile;
            Severity: Major
            Found in src/Entities/Generators/PaginationGenerator.php - About 30 mins to fix

              Missing class import via use statement (line '253', column '19').
              Open

                      throw new \Exception("The container doesn't support removal of registered containers.");
              Severity: Minor
              Found in src/Tapestry.php by phpmd

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '112', column '23').
              Open

                          throw new \Exception('There is no collection that collects for the path ['.$path.']');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              The method add has a boolean flag argument $overWrite, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  public function add(RendererInterface $item, $overWrite = false)

              BooleanArgumentFlag

              Since: 1.4.0

              A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

              Example

              class Foo {
                  public function bar($flag = true) {
                  }
              }

              Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

              Missing class import via use statement (line '53', column '23').
              Open

                          throw new \Exception('Configuration can only be either PHP or YAML based, not both.');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '23', column '27').
              Open

                      $reflection = new \ReflectionClass($class);

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Missing class import via use statement (line '53', column '23').
              Open

                          throw new \Exception('The collection ['.$this->pathLookupTable[$contentType->getPath()].'] already collects for the path ['.$contentType->getPath().']');

              MissingImport

              Since: 2.7.0

              Importing all external classes in a file through use statements makes them clearly visible.

              Example

              function make() {
                  return new \stdClass();
              }

              Source http://phpmd.org/rules/cleancode.html#MissingImport

              Severity
              Category
              Status
              Source
              Language