AthensFramework/core

View on GitHub

Showing 94 of 104 total issues

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

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

                public function __construct(
                    $id,
                    array $classes,
                    array $data,
                    QueryWrapperInterface $query,
            Severity: Minor
            Found in src/filter/RelationFilter.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 buildHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function buildHeaders(EmailInterface $email)
                {
                    $headers = ["From: " . $email->getFrom(), ];
            
                    if ($email->getReplyTo() !== null) {
            Severity: Minor
            Found in src/emailer/PhpEmailer.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,
                    $type,
                    array $classes,
                    array $data,
            Severity: Minor
            Found in src/admin/Admin.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 queryFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function queryFilter(QueryWrapperInterface $query)
                {
                    $query = $this->getNextFilter()->queryFilter($query);
            
                    $this->canQueryFilter = true;
            Severity: Minor
            Found in src/filter/Filter.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