tapestry-cloud/tapestry

View on GitHub

Showing 64 of 291 total issues

Function iterateProjectContentTypes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    private function iterateProjectContentTypes(ContentTypeFactory $contentTypes, Project $project, OutputInterface $output)
    {
        /** @var ContentType $contentType */
        foreach ($contentTypes->all() as $contentType) {
            $output->writeln('[+] Compiling content within ['.$contentType->getName().']');
Severity: Minor
Found in src/Modules/Content/Compile.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 render has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method __invoke has 30 lines of code (exceeds 25 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 1 hr to fix

      Method getNestedValueByKey has 30 lines of code (exceeds 25 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 1 hr to fix

        Method fire has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function fire()
            {
                try {
                    $this->tapestry->setInput($this->input);
                    $this->tapestry->setOutput($this->output);
        Severity: Minor
        Found in src/Console/Commands/ServeCommand.php - About 1 hr to fix

          Function checkForFileGeneratorError has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function checkForFileGeneratorError(OutputInterface $output)
              {
                  if (! $this->allFilesGenerated()) {
                      foreach ($this->files as &$file) {
                          if ($uses = $file->getData('generator')) {
          Severity: Minor
          Found in src/Modules/Content/Compile.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 collectProjectFilesUseData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function collectProjectFilesUseData(Project $project)
              {
                  /** @var File $file */
                  foreach ($project['compiled'] as $file) {
                      if (! $uses = $file->getData('use')) {
          Severity: Minor
          Found in src/Modules/Content/Compile.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 mutateFilesToFilesystemInterfaces has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function mutateFilesToFilesystemInterfaces(Project $project, Cache $cache)
              {
                  foreach ($this->files as &$file) {
                      /** @var CachedFile $cachedFile */
                      if ($cachedFile = $cache->getItem($file->getUid())) {
          Severity: Minor
          Found in src/Modules/Content/Compile.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 __invoke has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __invoke(Project $project, OutputInterface $output)
              {
                  $stopwatch = $project->get('cmd_options.stopwatch', false);
          
                  /** @var ContentTypeFactory $contentTypes */
          Severity: Minor
          Found in src/Modules/Content/Compile.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 mutateProjectFiles has 26 lines of code (exceeds 25 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 1 hr to fix

            Method generate has 26 lines of code (exceeds 25 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 1 hr to fix

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

                  protected function fire()
                  {
                      if (! $this->canExecute) {
                          return 0;
                      }
              Severity: Minor
              Found in src/Console/Commands/SelfUpdateCommand.php - About 1 hr to fix

                Function checkShortOption has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function checkShortOption($token)
                    {
                        $name = substr($token, 1);
                
                        if (strlen($name) > 1) {
                Severity: Minor
                Found in src/Console/Input.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 filter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function filter(array $input)
                    {
                        $parseOptions = true;
                        while (null !== $token = array_shift($input)) {
                            if ($parseOptions && '' == $token) {
                Severity: Minor
                Found in src/Console/Input.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 renderFile has a Cognitive Complexity of 9 (exceeds 5 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 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 load has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function load()
                    {
                        if (file_exists($this->path)) {
                            $this->store = unserialize(file_get_contents($this->path));
                            $this->store->validate($this->hash);
                Severity: Minor
                Found in src/Entities/Cache.php - About 45 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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function render(array $data = [])
                    {
                        $this->data($data);
                        unset($data);
                        extract($this->data);
                Severity: Minor
                Found in src/Plates/Template.php - About 45 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 fire has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function fire()
                    {
                        if (! $this->canExecute) {
                            return 0;
                        }
                Severity: Minor
                Found in src/Console/Commands/SelfUpdateCommand.php - About 45 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 setData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function setData(array $data)
                    {
                        if (isset($data['date']) && ! ($data['date'] instanceof DateTime)) {
                            $date = new DateTime();
                            if (! $unix = strtotime($data['date'])) {
                Severity: Minor
                Found in src/Entities/File.php - About 45 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

                Consider simplifying this complex logical expression.
                Open

                            if ($parseOptions && '' == $token) {
                                $this->checkArgument($token);
                            } elseif ($parseOptions && '--' == $token) {
                                $parseOptions = false;
                            } elseif ($parseOptions && 0 === strpos($token, '--')) {
                Severity: Major
                Found in src/Console/Input.php - About 40 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language