AthensFramework/core

View on GitHub

Showing 104 of 104 total issues

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

    public function visitFilter(FilterInterface $filter)
    {
        if ($filter instanceof DummyFilter) {
            $type = 'dummy';
        } elseif ($filter instanceof SelectFilter) {
Severity: Minor
Found in src/writer/HTMLWriter.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 $this->environment;
Severity: Major
Found in src/writer/TwigTemplateWriter.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                            return new ExcludingFilterStatement($option[0], $option[1], $option[2], null);
    Severity: Major
    Found in src/filter/FilterBuilder.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return $val === $criterion;
      Severity: Major
      Found in src/filter-statement/ExcludingFilterStatement.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return true;
        Severity: Major
        Found in src/filter-statement/ExcludingFilterStatement.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                              return $string;
          Severity: Major
          Found in src/writer/TwigTemplateWriter.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return array_filter($rows, $filter);
            Severity: Major
            Found in src/filter-statement/ExcludingFilterStatement.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return $string;
              Severity: Major
              Found in src/writer/TwigTemplateWriter.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return new RelationFilter(
                                    $this->id,
                                    $this->classes,
                                    $this->data,
                                    $query,
                Severity: Major
                Found in src/filter/FilterBuilder.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $rows;
                  Severity: Major
                  Found in src/filter-statement/SortingFilterStatement.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                        return strripos($val, $criterion) !== false;
                    Severity: Major
                    Found in src/filter-statement/ExcludingFilterStatement.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return trim($string);
                      Severity: Major
                      Found in src/writer/TwigTemplateWriter.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return $val !== $criterion;
                        Severity: Major
                        Found in src/filter-statement/ExcludingFilterStatement.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $filterFunction($val);
                          Severity: Major
                          Found in src/filter-statement/ExcludingFilterStatement.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return new SelectFilter(
                                                $this->id,
                                                $this->classes,
                                                $this->data,
                                                $statements,
                            Severity: Major
                            Found in src/filter/FilterBuilder.php - About 30 mins to fix

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

                                  protected function modifyFields(WritableBearerInterface $writableBearer)
                                  {
                                      foreach ($this->initialFieldValues as $fieldName => $value) {
                                          $writableBearer->getWritableByHandle($fieldName)->setInitial($value);
                                      }
                              Severity: Minor
                              Found in src/form/FormBuilderTrait.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 build has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function build()
                                  {
                                      if ($this->type === null) {
                                          throw new \Exception("Must use ::setType to set a field type before building");
                                      }
                              Severity: Minor
                              Found in src/field/FieldBuilder.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 getEnvironment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function getEnvironment()
                                  {
                                      if ($this->environment === null) {
                                          $loader = new \Twig_Loader_Filesystem($this->getTemplatesDirectories());
                                          $this->environment = new \Twig_Environment($loader);
                              Severity: Minor
                              Found in src/writer/TwigTemplateWriter.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function __construct($id, array $classes, array $data, FilterInterface $nextFilter = null)
                                  {
                              
                                      $statements = [];
                                      for ($i=0; $i<=5; $i++) {
                              Severity: Minor
                              Found in src/filter/SearchFilter.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 suffixFormFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function suffixFormFields(FormInterface $form, $countBegin = 0)
                                  {
                                      foreach ($form->getWritableBearer()->getWritables() as $writable) {
                                          if ($writable instanceof FieldInterface) {
                                              $writable->addSuffix(0);
                              Severity: Minor
                              Found in src/initializer/Initializer.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