Rafalsky/HomeFinance

View on GitHub

Showing 71 of 530 total issues

File Generator.php has 616 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 *  This file is part of the HomeFinanceV2 project.
 *
 *  (c) Rafalsky.com <http://github.com/Rafalsky/>
Severity: Major
Found in backend/modules/gii/models/Generator.php - About 1 day to fix

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

        public function safeUp()
        {
            $this->insert('{{%user}}', [
                'id' => 1,
                'username' => 'webmaster',
    Severity: Major
    Found in common/migrations/db/m150725_192740_seed_data.php - About 4 hrs to fix

      Function generateRules has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          public function generateRules($table)
          {
              $types = [];
              $lengths = [];
              foreach ($table->columns as $column) {
      Severity: Minor
      Found in backend/modules/gii/models/Generator.php - About 4 hrs 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

      Generator has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Generator extends \yii\gii\generators\model\Generator
      {
          const RELATIONS_NONE = 'none';
          const RELATIONS_ALL = 'all';
          const RELATIONS_ALL_INVERSE = 'all-inverse';
      Severity: Minor
      Found in backend/modules/gii/models/Generator.php - About 3 hrs to fix

        File common.php has 311 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /*
         *  This file is part of the HomeFinanceV2 project.
         *
        Severity: Minor
        Found in wallet/views/layouts/common.php - About 3 hrs to fix

          Method generateRules has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function generateRules($table)
              {
                  $types = [];
                  $lengths = [];
                  foreach ($table->columns as $column) {
          Severity: Major
          Found in backend/modules/gii/models/Generator.php - About 3 hrs to fix

            Method successOAuthCallback has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function successOAuthCallback($client)
                {
                    // use BaseClient::normalizeUserAttributeMap to provide consistency for user attribute`s names
                    $attributes = $client->getUserAttributes();
                    $user = User::find()->where([
            Severity: Major
            Found in frontend/modules/user/controllers/SignInController.php - About 2 hrs to fix

              Method actionReplaceSourceLanguage has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function actionReplaceSourceLanguage($configFile, $newSourceLanguage = false)
                  {
                      $config = [
                          'translator' => 'Yii::t',
                          'overwrite' => false,
              Severity: Major
              Found in console/controllers/ExtendedMessageController.php - About 2 hrs to fix

                Function generateRelations has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function generateRelations()
                    {
                        if ($this->generateRelations === self::RELATIONS_NONE) {
                            return [];
                        }
                Severity: Minor
                Found in backend/modules/gii/models/Generator.php - About 2 hrs 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 successOAuthCallback has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function successOAuthCallback($client)
                    {
                        // use BaseClient::normalizeUserAttributeMap to provide consistency for user attribute`s names
                        $attributes = $client->getUserAttributes();
                        $user = User::find()->where([
                Severity: Minor
                Found in frontend/modules/user/controllers/SignInController.php - About 2 hrs 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

                File index.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Author: Eugine Terentev <eugine@terentev.net>
                 * @var $this \yii\web\View
                 * @var $provider \probe\provider\ProviderInterface
                Severity: Minor
                Found in backend/views/system-information/index.php - About 2 hrs to fix

                  User has 21 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class User extends ActiveRecord implements IdentityInterface
                  {
                      const STATUS_NOT_ACTIVE = 1;
                      const STATUS_ACTIVE = 2;
                      const STATUS_DELETED = 3;
                  Severity: Minor
                  Found in common/models/User.php - About 2 hrs to fix

                    File SignInController.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    /*
                     * This file is part of the HomeFinanceV2 project.
                     *
                    Severity: Minor
                    Found in frontend/modules/user/controllers/SignInController.php - About 2 hrs to fix

                      Method actionMigrate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function actionMigrate($inputConfigFile, $outputConfigFile)
                          {
                              $inputConfigFile = \Yii::getAlias($inputConfigFile);
                              if (!is_file($inputConfigFile)) {
                                  throw new \Exception("The configuration file does not exist: $inputConfigFile");
                      Severity: Minor
                      Found in console/controllers/ExtendedMessageController.php - About 2 hrs to fix

                        Function update has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function update(){
                                    $.ajax({
                                        data:{data:"cpu_usage"},
                                        dataType: "json",
                                        success: function(result){
                        Severity: Minor
                        Found in backend/web/js/system-information/index.js - About 1 hr to fix

                          Function update has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function update(){
                                      $.ajax({
                                          data:{data:"cpu_usage"},
                                          dataType: "json",
                                          success: function(result){
                          Severity: Minor
                          Found in wallet/web/js/system-information/index.js - About 1 hr to fix

                            Function actionReplaceSourceLanguage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function actionReplaceSourceLanguage($configFile, $newSourceLanguage = false)
                                {
                                    $config = [
                                        'translator' => 'Yii::t',
                                        'overwrite' => false,
                            Severity: Minor
                            Found in console/controllers/ExtendedMessageController.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 update has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    function update(){
                                        $.ajax({
                                            data:{data:"memory_usage"},
                                            success: function(result){
                                                if(!data){
                            Severity: Minor
                            Found in wallet/web/js/system-information/index.js - About 1 hr to fix

                              Function update has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      function update(){
                                          $.ajax({
                                              data:{data:"memory_usage"},
                                              success: function(result){
                                                  if(!data){
                              Severity: Minor
                              Found in backend/web/js/system-information/index.js - About 1 hr to fix

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

                                    public function safeUp()
                                    {
                                        $tableOptions = null;
                                        if ($this->db->driverName === 'mysql') {
                                            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
                                Severity: Minor
                                Found in common/migrations/db/m140703_123803_article.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language