tapestry-cloud/tapestry

View on GitHub

Showing 64 of 291 total issues

Consider simplifying this complex logical expression.
Open

        if (
            strlen($e) > 0 &&
            strpos($e, '?') === false &&
            strpos($e, '=') === false &&
            strpos($e, '&') === false &&
Severity: Major
Found in src/Entities/Url.php - About 40 mins to fix

    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

    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 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 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

    Avoid too many return statements within this method.
    Open

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

      Avoid too many return statements within this method.
      Open

              return 0;
      Severity: Major
      Found in src/Console/Commands/SelfUpdateCommand.php - About 30 mins to fix

        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 $newFile;
          Severity: Major
          Found in src/Entities/Generators/PaginationGenerator.php - About 30 mins to fix

            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 $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 $value;
                Severity: Major
                Found in src/ArrayContainer.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

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

                        function str_contains($haystack, $needles)
                        {
                            foreach ((array) $needles as $needle) {
                                if ($needle != '' && strpos($haystack, $needle) !== false) {
                                    return true;
                    Severity: Minor
                    Found in src/helpers.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

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

                        function starts_with($haystack, $needles)
                        {
                            foreach ((array) $needles as $needle) {
                                if ($needle != '' && strpos($haystack, $needle) === 0) {
                                    return true;
                    Severity: Minor
                    Found in src/helpers.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

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

                        private function removeNestedValueByKey($key)
                        {
                            // Bust Cache
                            $this->removeKeyFromNestedCache($key);
                    
                    
                    Severity: Minor
                    Found in src/ArrayContainer.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

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

                        private function encode($uri = '')
                        {
                            $parts = explode('/', $uri);
                            foreach ($parts as &$part) {
                                if (strpos($part, 'index') !== false) {
                    Severity: Minor
                    Found in src/Entities/Url.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

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

                        private function allFilesGenerated()
                        {
                            foreach ($this->files as $file) {
                                if ($uses = $file->getData('generator')) {
                                    if (count($uses) > 0) {
                    Severity: Minor
                    Found in src/Modules/Content/Compile.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

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

                        public function report()
                        {
                            $report = [];
                            foreach ($this->items as $item) {
                                $name = explode('_', $item['name']);
                    Severity: Minor
                    Found in src/Profiler.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