luyadev/luya-module-admin

View on GitHub

Showing 331 of 503 total issues

Function getUrlRules has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUrlRules()
    {
        $rules = [];
        // get all rules from the urlManager
        foreach ($this->urlManager->rules as $rule) {
Severity: Minor
Found in src/openapi/Generator.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 controller has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        controller: ['$scope', function ($scope) {

            $scope.input = { showWindow: true };

            $scope.content = null;
Severity: Minor
Found in src/resources/js/directives.js - About 1 hr to fix

    Function template has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            template: function () {
                return '' +
                    '<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
                    '<div class="form-side form-side-label">' +
                    '<label>{{label}}</label>' +
    Severity: Minor
    Found in src/resources/js/formdirectives.js - About 1 hr to fix

      Function link has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              link: function ($scope, $element, $attrs) {
      
                  $scope.$watch('trigger', function (n, o) {
                      if (n == 0) {
                          $($attrs.resizerLeft).removeAttr('style');
      Severity: Minor
      Found in src/resources/js/directives.js - About 1 hr to fix

        Method safeUp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function safeUp()
            {
                $this->createTable("{{%admin_queue}}", [
                    'id' => $this->primaryKey(),
                    'channel' => $this->string()->notNull(),
        Severity: Minor
        Found in src/migrations/m181023_135132_scheduler.php - About 1 hr to fix

          Method log has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function log($type, $message, $trace, $groupIdentifier)
              {
                  $hashArray = static::getHashArray($message, $groupIdentifier);
          
                  $file = 'unknown';
          Severity: Minor
          Found in src/models/Logger.php - About 1 hr to fix

            Function alignModal has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        scope.alignModal = function() {
                            var documentSize = {width: $(document).width(), height: element.parents('.luya-content')[0].scrollHeight || $(document).height()};
                            var buttonBcr = button[0].getBoundingClientRect();
            
                            var buttonSpaceRight = documentSize.width - (buttonBcr.left + buttonBcr.width + (modalMargin * 2));
            Severity: Minor
            Found in src/resources/js/scheduler.js - About 1 hr to fix

              Method actionIndex has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function actionIndex()
                  {
                      $userId = Yii::$app->adminuser->id;
              
                      // clear user online list
              Severity: Minor
              Found in src/apis/TimestampController.php - About 1 hr to fix

                Method actionIndex has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function actionIndex()
                    {
                        $tempName = null;
                        if ($this->identifier === null) {
                            $this->identifier = Inflector::variablize($this->prompt('Enter the filter identifier: (e.g. profilePicture)', ['required' => true, 'pattern' => '/^[a-zA-Z0-9]+$/i', 'error' => 'The filter identifer can only contain a-z,A-Z,0-9']));
                Severity: Minor
                Found in src/commands/FilterController.php - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                    "pluralCat": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) {    return PLURAL_CATEGORY.ONE;  }  if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) {    return PLURAL_CATEGORY.FEW;  }  if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) {    return PLURAL_CATEGORY.MANY;  }  return PLURAL_CATEGORY.OTHER;}
                  Severity: Critical
                  Found in src/resources/angular-i18n/angular-locale_ru.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                                    if ( (!scope.pop || lastValue != scope.tooltipText)
                                      && (typeof scope.tooltipDisabled === 'undefined' || scope.tooltipDisabled === false)
                                      && (scope.tooltipText || scope.tooltipImageUrl || scope.tooltipPreviewUrl) ) {
                    
                                        lastValue = scope.tooltipText
                    Severity: Critical
                    Found in src/resources/js/directives.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                        "pluralCat": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (vf.v == 0 && i % 10 == 1 && i % 100 != 11) {    return PLURAL_CATEGORY.ONE;  }  if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) {    return PLURAL_CATEGORY.FEW;  }  if (vf.v == 0 && i % 10 == 0 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 11 && i % 100 <= 14) {    return PLURAL_CATEGORY.MANY;  }  return PLURAL_CATEGORY.OTHER;}
                      Severity: Critical
                      Found in src/resources/angular-i18n/angular-locale_ua.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                              if (navigator.userAgent &&
                                (navigator.userAgent.match(/Android/i) ||
                                navigator.userAgent.match(/webOS/i) ||
                                navigator.userAgent.match(/iPhone/i) ||
                                navigator.userAgent.match(/iPad/i) ||
                        Severity: Critical
                        Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

                          Method prepareDataProvider has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function prepareDataProvider()
                              {
                                  $requestParams = Yii::$app->getRequest()->getBodyParams();
                                  if (empty($requestParams)) {
                                      $requestParams = Yii::$app->getRequest()->getQueryParams();
                          Severity: Minor
                          Found in src/ngrest/base/actions/IndexAction.php - About 1 hr to fix

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

                                      , showCalendar = function showCalendar() {
                                        //lets hide all the latest instances of datepicker
                                        pageDatepickers = $window.document.getElementsByClassName('_720kb-datepicker-calendar');
                            
                                        angular.forEach(pageDatepickers, function forEachDatepickerPages(value, key) {
                            Severity: Minor
                            Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

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

                                      var update = function () {
                                          if ($shadow == null) {
                                              $shadow = angular.element('<div></div>').css({
                                                  position: 'absolute',
                                                  top: -10000,
                              Severity: Minor
                              Found in src/resources/js/directives.js - About 1 hr to fix

                                Method getAvailableApiEndpoints has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function getAvailableApiEndpoints()
                                    {
                                        $data = [];
                                        $generic = [];
                                        $userId = $this->model->id;
                                Severity: Minor
                                Found in src/aws/ApiOverviewActiveWindow.php - About 1 hr to fix

                                  Method addImage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function addImage($fileId, $filterId = 0, $throwException = false)
                                      {
                                          try {
                                              // if the filterId is provded as a string the filter will be looked up by its name in the get filters array list.
                                              if (is_string($filterId) && !is_numeric($filterId)) {
                                  Severity: Minor
                                  Found in src/storage/BaseFileSystemStorage.php - About 1 hr to fix

                                    Function searchDetailClick has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            $scope.searchDetailClick = function(itemConfig, itemData) {
                                                if (itemConfig.type === 'custom') {
                                                    $scope.click(itemConfig.menuItem, true).then(function() {
                                                        if (itemConfig.stateProvider) {
                                                            var params = {};
                                    Severity: Minor
                                    Found in src/resources/js/controllers.js - About 1 hr to fix

                                      Function template has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              template: function () {
                                                  return '' +
                                                      '<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
                                                      '<div class="form-side form-side-label">' +
                                                      '<label>{{label}}</label>' +
                                      Severity: Minor
                                      Found in src/resources/js/formdirectives.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language