luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

Function actionIndex has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionIndex($identifier, $token)
    {
        $machine = ProxyMachine::findOne(['identifier' => $identifier, 'is_deleted' => false]);

        if (!$machine) {
Severity: Minor
Found in src/apis/ProxyController.php - About 35 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 actionSessionUpdate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionSessionUpdate()
    {
        $identity = Yii::$app->adminuser->identity;
        $user = clone Yii::$app->adminuser->identity;
        $user->attributes = Yii::$app->request->bodyParams;
Severity: Minor
Found in src/apis/UserController.php - About 35 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 getItems has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getItems()
    {
        if ($this->_items !== null) {
            return $this->_items;
        }
Severity: Minor
Found in src/components/AdminMenu.php - About 35 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 beforeAction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function beforeAction($action)
    {
        if (parent::beforeAction($action)) {
            if ($this->isActionAuthOptional($action->id)) {
                return true;
Severity: Minor
Found in src/base/RestController.php - About 35 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 actionPasswordReset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionPasswordReset($token, $id)
    {
        if (!$this->module->resetPassword) {
            throw new ForbiddenHttpException();
        }
Severity: Minor
Found in src/controllers/LoginController.php - About 35 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

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

          angular.element(document.getElementById($scope.datepickerAppendTo.replace('#', ''))).append($compile(angular.element(htmlTemplate))($scope, function afterCompile(el) {

            theCalendar = angular.element(el)[0];
          }));
src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 919..922
src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 934..937

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

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 3 locations. Consider refactoring.
Open

          angular.element(document).find('body').append($compile(angular.element(htmlTemplate))($scope, function afterCompile(el) {

            theCalendar = angular.element(el)[0];
          }));
src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 919..922
src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 927..930

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

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 3 locations. Consider refactoring.
Open

          angular.element(document.getElementsByClassName($scope.datepickerAppendTo.replace('.', ''))[0]).append($compile(angular.element(htmlTemplate))($scope, function afterCompile(el) {

            theCalendar = angular.element(el)[0];
          }));
src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 927..930
src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 934..937

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

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

    public function renderUpdate($id, $ngModel)
    {
        if ($this->scheduling && $this->renderContext->canUpdate()) {
            return [
                '<div class="crud-loader-tag">' . $this->createSchedulerListTag($ngModel, $this->getData(), 'data.update', ['only-icon' => 1]) . '</div>',
Severity: Minor
Found in src/ngrest/plugins/Select.php and 1 other location - About 30 mins to fix
src/ngrest/plugins/ToggleStatus.php on lines 122..132

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

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

    public function renderUpdate($id, $ngModel)
    {
        if ($this->scheduling && $this->renderContext->canUpdate()) {
            return [
                '<div class="crud-loader-tag crud-loader-tag-for-checkbox">' . $this->createSchedulerListTag($ngModel, $this->getSchedulerValuesAsArray(), 'data.update', ['only-icon' => 1]) . '</div>',
Severity: Minor
Found in src/ngrest/plugins/ToggleStatus.php and 1 other location - About 30 mins to fix
src/ngrest/plugins/Select.php on lines 78..88

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

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

Avoid too many return statements within this method.
Open

            return false;
Severity: Major
Found in src/storage/BaseFileSystemStorage.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $image;
    Severity: Major
    Found in src/storage/BaseFileSystemStorage.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                              return ($value <= $expression['value']);
      Severity: Major
      Found in src/storage/QueryTrait.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $fieldValue;
        Severity: Major
        Found in src/ngrest/plugins/SelectRelationActiveQuery.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $this->writeAttribute($event, implode(" ", $row));
          Severity: Major
          Found in src/ngrest/plugins/SelectRelationActiveQuery.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return $image;
            Severity: Major
            Found in src/storage/BaseFileSystemStorage.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                      return ($value < $expression['value']);
              Severity: Major
              Found in src/storage/QueryTrait.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                        return in_array($value, $expression['value']);
                Severity: Major
                Found in src/storage/QueryTrait.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return;
                  Severity: Major
                  Found in src/ngrest/plugins/SelectRelationActiveQuery.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return false;
                    Severity: Major
                    Found in src/storage/BaseFileSystemStorage.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language