Rafalsky/HomeFinance

View on GitHub

Showing 71 of 530 total issues

Method getTableNames has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getTableNames()
    {
        if ($this->tableNames !== null) {
            return $this->tableNames;
        }
Severity: Minor
Found in backend/modules/gii/models/Generator.php - About 1 hr to fix

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

        public function saveProducts($products)
        {
            foreach ($products as $product) {
                if (!$product['name']) {
                    continue;
    Severity: Minor
    Found in common/models/Receipt.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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get($key, $default = null, $cache = true, $cachingDuration = false)
        {
            if ($cache) {
                $cacheKey = $this->getCacheKey($key);
                $value = ArrayHelper::getValue($this->values, $key, false) ?: \Yii::$app->cache->get($cacheKey);
    Severity: Minor
    Found in common/components/keyStorage/KeyStorage.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 generateString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function generateString($string = '', $placeholders = [])
        {
            $string = addslashes($string);
            if ($this->enableI18N) {
                // If there are placeholders, use them
    Severity: Minor
    Found in backend/modules/gii/models/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

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

    function activeTextinput($form, $model, $attribute, $inputOptions = [], $fieldOptions = [])
    Severity: Minor
    Found in common/helpers.php - About 35 mins to fix

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

          protected function getSchemaNames()
          {
              $db = $this->getDbConnection();
              $schema = $db->getSchema();
              if ($schema->hasMethod('getSchemaNames')) { // keep BC to Yii versions < 2.0.4
      Severity: Minor
      Found in backend/modules/gii/models/Generator.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 rules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function rules()
          {
              $rules = [];
              foreach ($this->keys as $attribute => $data) {
                  $attributeRules = ArrayHelper::getValue($data, 'rules', []);
      Severity: Minor
      Found in common/components/keyStorage/FormModel.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 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function beforeAction($action)
          {
              $modelPk = \Yii::$app->request->getQueryParam($this->modelPkParam);
              if ($modelPk) {
                  $model = call_user_func($this->modelClass.'::findOne', $modelPk);
      Severity: Minor
      Found in common/filters/OwnModelAccessFilter.php - About 25 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 saveToPhpOutput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function saveToPhpOutput($messages, $config)
          {
              foreach ($messages as $language => $categories) {
                  $dirName = FileHelper::normalizePath(\Yii::getAlias($config['messagePath'].'/'.$language));
                  FileHelper::createDśirectory($dirName);
      Severity: Minor
      Found in console/controllers/ExtendedMessageController.php - About 25 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 bootstrap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function bootstrap($app)
          {
              if ($this->enabled instanceof \Closure) {
                  $enabled = call_user_func($this->enabled, $app);
              } else {
      Severity: Minor
      Found in common/components/maintenance/Maintenance.php - About 25 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 addInverseRelations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function addInverseRelations($relations)
          {
              $relationNames = [];
              foreach ($this->getSchemaNames() as $schemaName) {
                  foreach ($this->getDbConnection()->getSchema()->getTableSchemas($schemaName) as $table) {
      Severity: Minor
      Found in backend/modules/gii/models/Generator.php - About 25 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

      Severity
      Category
      Status
      Source
      Language