guilhermeslk/laravel-realtime-chat

View on GitHub

Showing 7 of 9 total issues

Method run has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run() {

        DB::table('messages_notifications')->delete();

        $user1 = DB::table('users')->where('username', 'heisenberg')->first();
Severity: Major
Found in app/database/seeds/MessagesNotificationsTableSeeder.php - About 3 hrs to fix

    Method run has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function run() {
            DB::table('users')->delete();
    
            $users = array(
                array(
    Severity: Minor
    Found in app/database/seeds/UsersTableSeeder.php - About 1 hr to fix

      Method run has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function run() {
      
              DB::table('messages')->delete();
      
              $user1 = DB::table('users')->where('username', 'heisenberg')->first();
      Severity: Minor
      Found in app/database/seeds/MessagesTableSeeder.php - About 1 hr to fix

        Method store has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function store() 
            {
        
                $rules = array(
                    'users' => 'required|array',
        Severity: Minor
        Found in app/controllers/ConversationController.php - About 1 hr to fix

          Method run has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function run() {
          
                  DB::table('conversations_users')->delete();
          
                  $user1 = DB::table('users')->where('username', 'heisenberg')->first();
          Severity: Minor
          Found in app/database/seeds/ConversationsUsersTableSeeder.php - About 1 hr to fix

            Method store has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function store() {
            
                    $rules     = array('body' => 'required');
                    $validator = Validator::make(Input::all(), $rules);
            
            
            Severity: Minor
            Found in app/controllers/MessageController.php - About 1 hr to fix

              Function index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function index() {
              
                      $viewData = array();
              
                      if(Input::has('conversation')) {
              Severity: Minor
              Found in app/controllers/ChatController.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