ivaynberg/select2

View on GitHub
docs/plugins/simplesearch/simplesearch.php

Summary

Maintainability
F
3 days
Test Coverage

Function onPagesInitialized has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

    public function onPagesInitialized()
    {
        $page = $this->grav['page'];

        $route = null;
Severity: Minor
Found in docs/plugins/simplesearch/simplesearch.php - About 1 day 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 checkForPermissions has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkForPermissions($collection)
    {
        $user = $this->grav['user'];
        $returnCollection = new Collection();
        foreach ($collection as $page) {
Severity: Minor
Found in docs/plugins/simplesearch/simplesearch.php - About 5 hrs 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 notFound has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    private function notFound($query, $page, $taxonomies)
    {
        $searchable_types = ['title', 'content', 'taxonomy'];
        $results = true;
        $search_content = $this->config->get('plugins.simplesearch.search_content');
Severity: Minor
Found in docs/plugins/simplesearch/simplesearch.php - About 4 hrs 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 onPagesInitialized has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function onPagesInitialized()
    {
        $page = $this->grav['page'];

        $route = null;
Severity: Major
Found in docs/plugins/simplesearch/simplesearch.php - About 4 hrs to fix

    File simplesearch.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    namespace Grav\Plugin;
    
    use Grav\Common\Page\Collection;
    use Grav\Common\Plugin;
    Severity: Minor
    Found in docs/plugins/simplesearch/simplesearch.php - About 2 hrs to fix

      Method notFound has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function notFound($query, $page, $taxonomies)
          {
              $searchable_types = ['title', 'content', 'taxonomy'];
              $results = true;
              $search_content = $this->config->get('plugins.simplesearch.search_content');
      Severity: Minor
      Found in docs/plugins/simplesearch/simplesearch.php - About 1 hr to fix

        Method checkForPermissions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function checkForPermissions($collection)
            {
                $user = $this->grav['user'];
                $returnCollection = new Collection();
                foreach ($collection as $page) {
        Severity: Minor
        Found in docs/plugins/simplesearch/simplesearch.php - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status