luyadev/luya-module-admin

View on GitHub

Showing 331 of 503 total issues

Function setRelation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setRelation(array $value, $viaTableName, $localTableId, $foreignTableId, $activeRecordId)
    {
        Yii::$app->db->createCommand()->delete($viaTableName, [$localTableId => $activeRecordId])->execute();
        $batch = [];
        foreach ($value as $k => $v) {
Severity: Minor
Found in src/ngrest/plugins/CheckboxRelation.php - About 45 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 checkInputLabels has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

var checkInputLabels = function () {
    var $loginInput = $('.login-input');

    var check = function($element) {
        var val = $element.val() ? $element.val() : '';
Severity: Minor
Found in src/resources/js/login.js - About 45 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 evalGroupFields has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function evalGroupFields($pointerElements)
    {
        $groups = [];
        if (!$pointerElements) {
            return [];
Severity: Minor
Found in src/ngrest/render/RenderCrud.php - About 45 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 sessionBruteForceLock has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private function sessionBruteForceLock($userId)
    {
        if (empty($userId)) {
            // block all request from this IP
            $userId = 0;
Severity: Minor
Found in src/controllers/LoginController.php - About 45 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 remove has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function remove($key)
    {
        $lastArray = [];
        if ($this->has($key)) {
            $array = &$this->data;
Severity: Minor
Found in src/models/UserSetting.php - About 45 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

Method itemPoolApi has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function itemPoolApi($name, $route, $icon, $apiEndpoint, $pool, array $options = [])
Severity: Minor
Found in src/components/AdminMenuBuilder.php - About 45 mins to fix

    Function actionFilesUpload has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function actionFilesUpload()
        {
            foreach ($_FILES as $k => $file) {
                if ($file['error'] !== UPLOAD_ERR_OK) {
                    Yii::$app->response->setStatusCode(422, 'Data Validation Failed.');
    Severity: Minor
    Found in src/apis/StorageController.php - About 45 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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function run()
        {
            $ids = [];
    
            foreach ($this->getImporter()->getDirectoryFiles('properties') as $file) {
    Severity: Minor
    Found in src/importers/PropertyImporter.php - About 45 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 removeImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function removeImage($imageId, $cleanup = false)
        {
            Yii::$app->storage->flushArrays();
            $image = Yii::$app->storage->getImage($imageId);
            if ($cleanup && $image) {
    Severity: Minor
    Found in src/helpers/Storage.php - About 45 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 actionUser has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function actionUser()
        {
            while (true) {
                $email = $this->prompt('User Email:');
                if (!empty(User::findByEmail($email))) {
    Severity: Minor
    Found in src/commands/SetupController.php - About 45 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 getLongDescription has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getLongDescription()
        {
            $content = [];
            foreach ($this->rows['texts'] as $key => $row) {
                if ($key == 0) {
    Severity: Minor
    Found in src/openapi/phpdoc/PhpDocParser.php - About 45 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 addPath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function addPath(BasePathParser $pathParser)
        {
            if ($pathParser->isValid()) {
                if (!empty($this->filterPaths)) {
                    if (StringHelper::filterMatch($pathParser->getPath(), $this->filterPaths)) {
    Severity: Minor
    Found in src/openapi/Generator.php - About 45 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 getClassName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getClassName()
        {
            if ($this->_className !== null) {
                return $this->_className;
            }
    Severity: Minor
    Found in src/openapi/phpdoc/PhpDocType.php - About 45 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

    Method setRelation has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        protected function setRelation(array $value, $viaTableName, $localTableId, $foreignTableId, $activeRecordId)
    Severity: Minor
    Found in src/ngrest/plugins/CheckboxRelation.php - About 35 mins to fix

      Method createPluginObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static function createPluginObject($className, $name, $alias, $i18n, $args = [])
      Severity: Minor
      Found in src/ngrest/NgRest.php - About 35 mins to fix

        Function addAndswitchToTab has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                $scope.addAndswitchToTab = function(pk, route, index, label, model) {
        Severity: Minor
        Found in src/resources/js/controllers.js - About 35 mins to fix

          Method actionIndex has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function actionIndex($inline = false, $relation = false, $arrayIndex = false, $modelClass = false, $modelSelection = false)
          Severity: Minor
          Found in src/ngrest/base/Controller.php - About 35 mins to fix

            Function addTab has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                service.addTab = function(id, api, arrayIndex, name, modelClass) {
            Severity: Minor
            Found in src/resources/js/services.js - About 35 mins to fix

              Method itemApi has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function itemApi($name, $route, $icon, $apiEndpoint, array $options = [])
              Severity: Minor
              Found in src/components/AdminMenuBuilder.php - About 35 mins to fix

                Method asyncRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static function asyncRequest($ngModel, $label, $api, $fields, array $options = [])
                Severity: Minor
                Found in src/helpers/Angular.php - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language