AthensFramework/core

View on GitHub

Showing 94 of 104 total issues

Method applyToRows has 48 lines of code (exceeds 25 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 1 hr to fix

    Function pagination has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    athens.pagination = (function () {
    
        var getPaginationContainer = function (handle) {
            return $("div.pagination-container[data-handle-for=" + handle +"]");
        };
    Severity: Minor
    Found in assets/js/pagination.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

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

        public function build()
        {
            $this->validateInitializer();
            $this->validateRenderer();
            
    Severity: Minor
    Found in src/admin/AdminBuilder.php - About 1 hr to fix

      Function setupSoftPaginationFilter has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var setupSoftPaginationFilter = function (handle) {
              $(
                  function () {
                      var inactiveControls = getInactiveControls(handle);
                      var activeControls = getActiveControls(handle);
      Severity: Minor
      Found in assets/js/soft-pagination.js - About 1 hr to fix

        Method queryFilter has 43 lines of code (exceeds 25 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 1 hr to fix

          Function alert has 43 lines of code (exceeds 25 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

            Method buildTopMatter has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function buildTopMatter()
                {
                    $topMatterBuilder = SectionBuilder::begin()
                        ->setType(SectionBuilder::TYPE_SPAN);
            
            
            Severity: Minor
            Found in src/page/PageBuilder.php - About 1 hr to fix

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

                  public function __construct(
                      $id,
                      $type,
                      array $classes,
                      array $data,
              Severity: Minor
              Found in src/admin/Admin.php - About 1 hr to fix

                Method queryFilter has 40 lines of code (exceeds 25 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 1 hr to fix

                  Function suffixFormFieldsFixed has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function suffixFormFieldsFixed(FormInterface $form, $suffix)
                      {
                          foreach ($form->getWritableBearer()->getWritables() as $writable) {
                              if ($writable instanceof FieldInterface) {
                                  $writable->addSuffix($suffix);
                  Severity: Minor
                  Found in src/initializer/Initializer.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 submitForm has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function submitForm(form, success)
                      {
                          athens.alert.makeAlert("Submitting form.", "info");
                  
                          if (typeof(success) === 'undefined') {
                  Severity: Minor
                  Found in assets/js/ajax.js - About 1 hr to fix

                    Function select has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    athens.select = (function () {
                        var getVar = athens.ajax_section.getVar;
                    
                        var getActiveControls = function (handle) {
                            return $("#top-filters select[data-handle-for=" + handle + "]");
                    Severity: Minor
                    Found in assets/js/select.js - About 1 hr to fix

                      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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language