AthensFramework/core

View on GitHub

Showing 94 of 104 total issues

Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($id, array $classes, array $data, array $rows, FilterInterface $filter)
Severity: Minor
Found in src/table/Table.php - About 35 mins to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($id, array $classes, array $data, WritableBearerInterface $writableBearer, $type)
    Severity: Minor
    Found in src/section/Section.php - About 35 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct(array $classes, array $data, $type, $label, $target)
      Severity: Minor
      Found in src/form-action/FormAction.php - About 35 mins to fix

        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $id,
                array $classes,
                array $data,
                $value,
                $alias
        Severity: Minor
        Found in src/choice/Choice.php - About 35 mins to fix

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

              public function applyToRows(array $rows)
              {
                  $fieldName = $this->getFieldName();
                  $condition = $this->getCondition();
                  $criterion = $this->getCriterion();
          Severity: Minor
          Found in src/filter-statement/ExcludingFilterStatement.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 getSubmitted has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getSubmitted()
              {
                  $fieldType = $this->getType();
          
                  $data = array_key_exists($this->getSlug(), $_POST) === true ? $_POST[$this->getSlug()]: "";
          Severity: Minor
          Found in src/field/Field.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 search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          athens.search = (function () {
          
              var searchDiv = $(".search-div");
          
              /**
          Severity: Minor
          Found in assets/js/search.js - 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 parseChoiceSlugs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function parseChoiceSlugs($slugs)
              {
                  if ($this->getType() === static::TYPE_CHOICE || (bool)($slugs) === false) {
                      $slugs = [$slugs];
                  }
          Severity: Minor
          Found in src/field/Field.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 validateRenderer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function validateRenderer()
              {
                  if ($this->renderer === null) {
                      $settingsInstance = $this->getSettingsInstance();
          
          
          Severity: Minor
          Found in src/page/PageBuilder.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 toTitleCase has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function toTitleCase($string)
              {
          
                  // Replace underscores, dashes with spaces
                  $string = str_replace(["_", "-"], " ", $string);
          Severity: Minor
          Found in src/etc/StringUtils.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 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
                            Severity
                            Category
                            Status
                            Source
                            Language