scholarslab/ivanhoe

View on GitHub
includes/post_form/BasePostForm.php

Summary

Maintainability
C
1 day
Test Coverage

BasePostForm has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class BasePostForm
{
    /**
     * The post to edit.
     */
Severity: Minor
Found in includes/post_form/BasePostForm.php - About 3 hrs to fix

    File BasePostForm.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * This has the default implementation of the POST form for all of the post types.
     */
    Severity: Minor
    Found in includes/post_form/BasePostForm.php - About 3 hrs to fix

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

          public function add_rationale($post)
          {
              $journal_entry = null;
      
              if ($this->rationale) {
      Severity: Minor
      Found in includes/post_form/BasePostForm.php - About 1 hr to fix

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

            public function notify_responses($post_id)
            {
        
                $post = get_post($post_id);
        
        
        Severity: Minor
        Found in includes/post_form/BasePostForm.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

        There are no issues that match your filters.

        Category
        Status