luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

Function getOptionsData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function getOptionsData($event)
    {
        $items = [];
        $targetModel = new $this->model();
        foreach ($this->model->find()->asArray($this->asArray)->all() as $item) {
Severity: Minor
Found in src/ngrest/plugins/CheckboxRelation.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 onAfterListFind has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function onAfterListFind($event)
    {
        if (!$this->assignAfterFind) {
            return parent::onAfterListFind($event);
        }
Severity: Minor
Found in src/ngrest/plugins/Select.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 actionReset has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionReset()
    {
        if (!$this->module->resetPassword) {
            throw new ForbiddenHttpException();
        }
Severity: Minor
Found in src/controllers/LoginController.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 run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function run()
    {
        $modules = Yii::$app->getModules();
        $ids = [];
        foreach ($modules as $id => $moduleObject) {
Severity: Minor
Found in src/importers/AuthImporter.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 actionIndex has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionIndex()
    {
        try {
            Image::getImagine();
        } catch (\Exception $e) {
Severity: Minor
Found in src/commands/SetupController.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 getPathsFromControllerMap has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getPathsFromControllerMap()
    {
        foreach ($this->controllerMap as $key => $map) {
            if (is_array($map)) {
                $controller = Yii::createObject($map['class'], [$key, $map['module']]);
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 getUseClasses has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUseClasses()
    {
        $file = $this->reflection->getFileName();
        $tokens = \PhpToken::tokenize(file_get_contents($file));

Severity: Minor
Found in src/openapi/phpdoc/PhpDocParser.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

Method filter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function filter()
    {
        $containerData = $this->getDataProvider();
        $whereExpression = $this->_where;

Severity: Minor
Found in src/storage/QueryTrait.php - About 1 hr to fix

    Method getResponseContent has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getResponseContent()
        {
            $modelClass = $this->extractModelClassFromObject($this->getActionObject());
    
            if ($modelClass) {
    Severity: Minor
    Found in src/openapi/specs/BaseSpecs.php - About 1 hr to fix

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

                  $scope.$watch(function () {
                      return $scope.date
                  }, function (n, o) {
                      if (n !== o && n !== undefined && n !== null) {
                          $scope.refactor(n);
      Severity: Major
      Found in src/resources/js/formdirectives.js and 1 other location - About 1 hr to fix
      src/resources/js/formdirectives.js on lines 2248..2254

      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 69.

      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

                  $scope.$watch(function () {
                      return $scope.date
                  }, function (n, o) {
                      if (n !== o && n !== undefined && n !== null) {
                          $scope.refactor(n);
      Severity: Major
      Found in src/resources/js/formdirectives.js and 1 other location - About 1 hr to fix
      src/resources/js/formdirectives.js on lines 2372..2378

      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 69.

      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

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

              $scope.loadTags = function() {
                  $http.get($scope.crud.getActiveWindowCallbackUrl('LoadTags')).then(function(transport) {
                      $scope.tags = transport.data;
                  });
              };
      Severity: Major
      Found in src/resources/js/controllers.js and 1 other location - About 1 hr to fix
      src/resources/js/controllers.js on lines 915..919

      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 68.

      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

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

              $scope.loadImages = function() {
                  $http.get($scope.crud.getActiveWindowCallbackUrl('loadAllImages')).then(function(response) {
                      $scope.files = response.data;
                  })
              };
      Severity: Major
      Found in src/resources/js/controllers.js and 1 other location - About 1 hr to fix
      src/resources/js/controllers.js on lines 842..846

      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 68.

      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

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

              link: function (scope, element, attrs) {
                  scope.elementWidth = 0;
      
                  var getElementOriginalWidth = function () {
                      var elementClone = element.clone().insertAfter(element);
      Severity: Minor
      Found in src/resources/js/directives.js - About 1 hr to fix

        Method updateItemIndex has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false)
            {
                $attributeName = self::sortableField();
                $oldPosition = array_key_exists($attributeName, $event->changedAttributes) ? $event->changedAttributes[$attributeName] : false;
                $newPosition = $event->sender[$attributeName];
        Severity: Minor
        Found in src/traits/SortableTrait.php - About 1 hr to fix

          Function controller has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  controller: ['$scope', '$timeout', function ($scope, $timeout) {
                      $scope.pageNumberInputVal = $scope.currentPage;
          
                      $scope.$watch('currentPage', function(newVal) {
                          $scope.pageNumberInputVal = newVal;
          Severity: Minor
          Found in src/resources/js/directives.js - About 1 hr to fix

            Function controller has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    controller: ['$scope', '$filter', function ($scope, $filter) {
            
                        if ($scope.model === undefined) {
                            $scope.model = [];
                        }
            Severity: Minor
            Found in src/resources/js/formdirectives.js - About 1 hr to fix

              Method addFile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function addFile($fileSource, $fileName, $folderId = 0, $isHidden = false)
                  {
                      // ensure the file upload
                      $fileData = $this->ensureFileUpload($fileSource, $fileName);
                      // generate md5 hash from file source
              Severity: Minor
              Found in src/storage/BaseFileSystemStorage.php - About 1 hr to fix

                Method ensureFileUpload has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function ensureFileUpload($fileSource, $fileName)
                    {
                        // throw exception if source or name is empty
                        if (empty($fileSource) || empty($fileName)) {
                            throw new Exception("Filename and source can not be empty.");
                Severity: Minor
                Found in src/storage/BaseFileSystemStorage.php - About 1 hr to fix

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

                      public function safeUp()
                      {
                          // admin_auth
                          $this->createIndex('index_route', '{{%admin_auth}}', ['route']);
                          $this->createIndex('index_api', '{{%admin_auth}}', ['api']);
                  Severity: Minor
                  Found in src/migrations/m180723_120432_indexes.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language