RamzyVirani/laravel-boilerplate

View on GitHub

Showing 46 of 93 total issues

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

    public function run()
    {
        DB::table('locales')->insert([
            [
                'code'        => 'en',
Severity: Major
Found in database/seeds/LocalesSeeder.php - About 6 days to fix

    File LocalesSeeder.php has 1286 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    use Carbon\Carbon;
    use Illuminate\Database\Seeder;
    use Illuminate\Support\Facades\DB;
    Severity: Major
    Found in database/seeds/LocalesSeeder.php - About 3 days to fix

      File step1.blade.php has 763 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      @push('scripts')
          <script src="{{ asset('public/js/admin/module/step1.js') }}"></script>
          <script src="{{ asset('public/js/admin/pluralize.js') }}"></script>
      @endpush
      <div class="tab-pane active" id="tab_1">
      Severity: Major
      Found in resources/views/admin/module/step1.blade.php - About 1 day to fix

        File step3.blade.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        @push('css')
            <style>
                .table-form tbody tr td {
                    position: relative;
                }
        Severity: Minor
        Found in resources/views/admin/module/step3.blade.php - About 4 hrs to fix

          Function handle has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle($request, Closure $next)
              {
                  $routeName      = str_replace([$request->route()->action['prefix'] . '.', 'store', 'update'], ['', 'create', 'edit'], $request->route()->action['as']);
                  $permissionName = ($routeName == "") ? "dashboard" : $routeName;
          
          
          Severity: Minor
          Found in app/Http/Middleware/CheckAdminPermission.php - About 3 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 pluralize.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* global define */
          
          (function (root, pluralize) {
              /* istanbul ignore else */
              if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
          Severity: Minor
          Found in public/js/admin/pluralize.js - About 3 hrs to fix

            File step2.blade.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            @push('css')
                <style>
                    .table-display tbody tr td {
                        position: relative;
                    }
            Severity: Minor
            Found in resources/views/admin/module/step2.blade.php - About 2 hrs to fix

              Method postStep3 has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function postStep3(UpdateModuleConfigRequest $request)
                  {
                      $this->data['id'] = $request->id;
                      $tablename        = Module::where('id', $request->id)->get()->first();
              //        $this->data['tableFields'] = DB::select('SHOW FULL FIELDS FROM '.$tablename->table_name);
              Severity: Major
              Found in app/Http/Controllers/Admin/ModuleController.php - About 2 hrs to fix

                Method up has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function up()
                    {
                        Schema::create('users', function (Blueprint $table) {
                            $table->increments('id');
                            $table->string('name');
                Severity: Major
                Found in database/migrations/2014_10_12_000000_create_users_table.php - About 2 hrs to fix

                  Method index has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function index()
                      {
                          //echo '<script>alert("add authentication pram in API swagger doc")</script>';
                          if (App::environment() == 'staging') {
                              $this->menuRepository->update(['status' => 0], 5);
                  Severity: Major
                  Found in app/Http/Controllers/Admin/HomeController.php - About 2 hrs to fix

                    Function customLoad has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        $.fn.customLoad = function () {
                            //Timepicker
                            // $('.timepicker').timepicker({
                            //     showInputs: false,
                            //     containerClass: 'bootstrap-timepicker',
                    Severity: Minor
                    Found in public/js/admin/custom.js - About 2 hrs to fix

                      Method sendPushNotifications has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function sendPushNotifications($msg = '', $deviceObject = [], $extraPayLoadData = [])
                          {
                              $androidDeviceToken = [];
                              $iosDeviceToken = [];
                      
                      
                      Severity: Minor
                      Found in app/Helper/NotificationsHelper.php - About 1 hr to fix

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

                            public function run()
                            {
                                DB::table('users')->insert([
                                    [
                                        'name'     => "Super Admin",
                        Severity: Minor
                        Found in database/seeds/UserSeeder.php - About 1 hr to fix

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

                              public function apply($model, RepositoryInterface $repository)
                              {
                                  // Check if Role Property is set
                                  if ($this->isset('role')) {
                                      // If Role Property is set, add a condition to include only those users who have this role
                          Severity: Minor
                          Found in app/Criteria/UserCriteria.php - About 1 hr to fix

                            Function apply has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function apply($model, RepositoryInterface $repository)
                                {
                                    // Check if Role Property is set
                                    if ($this->isset('role')) {
                                        // If Role Property is set, add a condition to include only those users who have this role
                            Severity: Minor
                            Found in app/Criteria/UserCriteria.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

                            Method up has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function up()
                                {
                                    DB::beginTransaction();
                            
                                    // Create table for storing roles
                            Severity: Minor
                            Found in database/migrations/2018_04_06_081644_entrust_setup_tables.php - About 1 hr to fix

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

                                  public static function Register($modelName = null, $BreadCrumbName = null, $model = null, $profile = false)
                                  {
                                      $prefixes = config('infyom.laravel_generator.prefixes.route');
                                      $routeName = $prefixes . '.' . $modelName;
                              
                              
                              Severity: Minor
                              Found in app/Helper/BreadcrumbsRegister.php - About 1 hr to fix

                                Function readCSV has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function readCSV($file, $colName = 0)
                                    {
                                        $row             = 0;
                                        $rows            = $columns = [];
                                        $autoLineEndings = ini_get('auto_detect_line_endings');
                                Severity: Minor
                                Found in app/Helper/Util.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

                                Method socialLogin has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function socialLogin(SocialLoginAPIRequest $request)
                                    {
                                        $user    = false;
                                        $input   = $request->all();
                                        $account = $this->socialAccountRepository->findWhere(['platform' => $input['platform'], 'client_id' => $input['client_id'], 'deleted_at' => null])->first();
                                Severity: Minor
                                Found in app/Http/Controllers/Api/AuthAPIController.php - About 1 hr to fix

                                  Method updated has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function updated(Module $module)
                                      {
                                          if ($module->getOriginal('status') != $module->status && $module->status == 1) {
                                              $util = new Util();
                                              //$pieces = preg_split('/(?=[A-Z])/', $module->name);
                                  Severity: Minor
                                  Found in app/Observers/ModuleObserver.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language