luyadev/luya-module-admin

View on GitHub

Showing 331 of 503 total issues

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

    public function where(array $args)
    {
        foreach ($args as $key => $value) {
            if (in_array($value, $this->_whereOperators, true)) {
                if (count($args) !== 3) {
Severity: Minor
Found in src/storage/QueryTrait.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 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 getConfigButtonCondition has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function getConfigButtonCondition($scope)
    {
        $buttonConditionConfigOption = $this->config->getOption('buttonCondition');

        // return empty string of no condition is defined
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 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 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

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

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

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

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

                  private function sendArray($refresh, array $errors = [], $enterSecureToken = false, $message = null, $enterTwoFaToken = false)
              Severity: Minor
              Found in src/controllers/LoginController.php - 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
                  Severity
                  Category
                  Status
                  Source
                  Language