AthensFramework/core

View on GitHub

Showing 104 of 104 total issues

Method build has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function build()
    {
        if ($this->type === null) {
            throw new \Exception("You must set a page type using ::setType before calling this function.");
        }
Severity: Minor
Found in src/page/PageBuilder.php - About 1 hr to fix

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

            $type,
            $subject,
            $message,
            $to,
            $from,
    Severity: Major
    Found in src/email/Email.php - About 1 hr to fix

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

              $id,
              array $classes,
              array $data,
              $type,
              $method,
      Severity: Major
      Found in src/form/Form.php - About 1 hr to fix

        Function setupPaginationFilter has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var setupPaginationFilter = function (handle) {
                // If we have already created this filter, return.
                $(
                    function () {
                        var page, ajaxSectionName, inactiveControls, activeControls;
        Severity: Minor
        Found in assets/js/pagination.js - About 1 hr to fix

          Function select_a_section has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          athens.select_a_section = (function () {
              var revealSelectASection = function (selectASection, targetSelectionName) {
                  var selectedOption = selectASection.find("div.option.selectable[data-section-for=" + targetSelectionName + "]");
                  var selectedSelection = selectASection.find("div.selection[data-selection-name=" + targetSelectionName +"]");
          
          
          Severity: Minor
          Found in assets/js/select-a-section.js - About 1 hr to fix

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

                    $id,
                    $type,
                    array $classes,
                    array $data,
                    $title,
            Severity: Major
            Found in src/admin/Admin.php - About 1 hr to fix

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

                      array $classes,
                      array $data,
                      $type,
                      $label = "",
                      $initial = "",
              Severity: Major
              Found in src/field/Field.php - About 1 hr to fix

                Method validate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function validate()
                    {
                        $this->isValid = true;
                
                        foreach ($this->getWritableBearer()->getWritables() as $name => $writable) {
                Severity: Minor
                Found in src/form/Form.php - About 1 hr to fix

                  Method __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct(
                          $id,
                          array $classes,
                          array $data,
                          QueryWrapperInterface $query,
                  Severity: Minor
                  Found in src/filter/RelationFilter.php - About 1 hr to fix

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                    if (activeControls.length) {
                                        // replace the active controls with the new, inactive controls
                                        activeControls.replaceWith(inactiveControls);
                                    } else {
                                        // else just append the new controls to the label.
                    Severity: Major
                    Found in assets/js/soft-pagination.js and 1 other location - About 1 hr to fix
                    assets/js/pagination.js on lines 81..87

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 59.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                                    if (activeControls.length) {
                                        // replace the active controls with the new, inactive controls
                                        activeControls.replaceWith(inactiveControls);
                                    } else {
                                        // else just append the new controls to the label.
                    Severity: Major
                    Found in assets/js/pagination.js and 1 other location - About 1 hr to fix
                    assets/js/soft-pagination.js on lines 132..138

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 59.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                            $id,
                            $type,
                            array $classes,
                            array $data,
                            $title,
                    Severity: Major
                    Found in src/page/Page.php - About 1 hr to fix

                      Function build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function build()
                          {
                              $this->validateId();
                      
                              $type = $this->retrieveOrException("type", __METHOD__);
                      Severity: Minor
                      Found in src/filter/FilterBuilder.php - About 1 hr 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 validateOnInvalidFunc has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function validateOnInvalidFunc()
                          {
                              $this->onInvalidFunctions[] = function (FormInterface $thisForm) {
                                  foreach ($thisForm->getWritableBearer()->getWritables() as $writable) {
                                      if ($writable instanceof FieldInterface) {
                      Severity: Minor
                      Found in src/form/FormBuilderTrait.php - About 1 hr 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 alert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      athens.alert = (function () {
                      
                          /**
                           * Creates an alert div, appends it to the notification area, and schedules it for removal.
                           *
                      Severity: Minor
                      Found in assets/js/alert.js - About 1 hr 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 sort has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      athens.sort = (function () {
                          
                          var setupSortFilter = function (handle) {
                      
                              var filterSection = $("div.sort-container[data-handle-for=" + handle + "]").closest('.table-container');
                      Severity: Minor
                      Found in assets/js/sort.js - About 1 hr to fix

                        Function done has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                var done = function (data, textStatus, jqXHR) {
                                    try {
                                        var formPOSTResult = $("<div>" + data + "</div>").find("#" + formId);
                        
                                        var formHasErrors = formPOSTResult.hasClass("has-errors");
                        Severity: Minor
                        Found in assets/js/ajax.js - About 1 hr to fix

                          Function buildTopMatter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              protected function buildTopMatter()
                              {
                                  $topMatterBuilder = SectionBuilder::begin()
                                      ->setType(SectionBuilder::TYPE_SPAN);
                          
                          
                          Severity: Minor
                          Found in src/page/PageBuilder.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function queryFilter(QueryWrapperInterface $query)
                              {
                                  $this->canQueryFilter = true;
                                  if ($this->getNextFilter()->canQueryFilter === false) {
                                      $this->canQueryFilter = false;
                          Severity: Minor
                          Found in src/filter/RelationFilter.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                          Open

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