madbob/GASdottoNG

View on GitHub

Showing 437 of 494 total issues

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

    public function up()
    {
        Schema::create('orders', function (Blueprint $table) {
            $table->string('id')->primary();
            $table->timestamps();
Severity: Minor
Found in code/database/migrations/2015_11_21_011221_create_orders_table.php - About 1 hr to fix

    Method roleInit has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function roleInit($gas)
        {
            $queue = systemParameters('Roles');
    
            while(true) {
    Severity: Minor
    Found in code/database/seeders/DatabaseSeeder.php - About 1 hr to fix

      Method dynamicModifiers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function dynamicModifiers(array $request, $aggregate, $target_user)
          {
              /*
                  Innanzitutto, qui sospendo l'esecuzione delle callback sui movimenti
                  contabili. Nella fase di revisione della prenotazione capita che i
      Severity: Minor
      Found in code/app/Services/DynamicBookingsService.php - About 1 hr to fix

        Method initCollectionMacros has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function initCollectionMacros()
            {
                /*
                    Questa va usata solo per una Collection di BookedProductVariant,
                    come ad esempio la relazione variants() di BookedProduct
        Severity: Minor
        Found in code/app/Providers/AppServiceProvider.php - About 1 hr to fix

          Method getSupplier has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getSupplier($start, $end, $type, $target, $supplier)
              {
                  $data = [];
                  $categories = [];
          
          
          Severity: Minor
          Found in code/app/Http/Controllers/StatisticsController.php - About 1 hr to fix

            Method closeBalance has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function closeBalance($request)
                {
                    $this->ensureAuth(['movements.admin' => 'gas']);
                    $hub = App::make('MovementsHub');
            
            
            Severity: Minor
            Found in code/app/Services/MovementsService.php - About 1 hr to fix

              Method distributionLabels has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function distributionLabels()
                  {
                      $currency = defaultCurrency()->symbol;
              
                      return [
              Severity: Minor
              Found in code/app/View/Texts/Modifier.php - About 1 hr to fix

                Method columnsByType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private static function columnsByType($ret, $type)
                    {
                        if ($type == 'export' || $type == 'all') {
                            $ret['last_login'] = (object) [
                                'name' => _i('Ultimo Accesso'),
                Severity: Minor
                Found in code/app/Formatters/User.php - About 1 hr to fix

                  Method iban_split has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function iban_split($iban, $field)
                  {
                      switch($field) {
                          case 'country':
                              $start = 0;
                  Severity: Minor
                  Found in code/app/Helpers/Formatters.php - About 1 hr to fix

                    Method otherFields has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function otherFields(&$ret)
                        {
                            $ret['birthplace'] = (object) [
                                'label' => _i('Luogo di Nascita'),
                            ];
                    Severity: Minor
                    Found in code/app/Importers/CSV/Users.php - About 1 hr to fix

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

                          public function up()
                          {
                              Schema::create('suppliers', function (Blueprint $table) {
                                  $table->string('id')->primary();
                                  $table->timestamps();

                        Method postCsv has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function postCsv(Request $request)
                            {
                                $type = $request->input('type');
                                $step = $request->input('step', 'guess');
                        
                        
                        Severity: Minor
                        Found in code/app/Http/Controllers/ImportController.php - About 1 hr to fix

                          Method postGdxp has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function postGdxp(Request $request)
                              {
                                  // try {
                                      $archivepath = '';
                                      $working_dir = sys_get_temp_dir();
                          Severity: Minor
                          Found in code/app/Http/Controllers/ImportController.php - About 1 hr to fix

                            Method handle has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function handle()
                                {
                                    $orders = Order::where('status', 'open')->where('end', '>', Carbon::today()->format('Y-m-d'))->get();
                                    $notifications = [];
                            
                            
                            Severity: Minor
                            Found in code/app/Console/Commands/RemindOrders.php - About 1 hr to fix

                              Method show has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function show(Request $request, $id)
                                  {
                                      $user = Auth::user();
                              
                                      $format = $request->input('format', 'html');
                              Severity: Minor
                              Found in code/app/Http/Controllers/ProductsController.php - About 1 hr to fix

                                Method show has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function show(Request $request, $id)
                                    {
                                        $dom_id = $request->input('dom_id', rand());
                                
                                        try {
                                Severity: Minor
                                Found in code/app/Http/Controllers/MovementsController.php - About 1 hr to fix

                                  Method getBookingsAttribute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function getBookingsAttribute()
                                      {
                                          $ret = [];
                                  
                                          foreach ($this->orders as $order) {
                                  Severity: Minor
                                  Found in code/app/Aggregate.php - About 1 hr to fix

                                    Method handleTable has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        protected function handleTable($obj, $request)
                                        {
                                            $action = $request['action'] ?? 'download';
                                            $status = $request['status'] ?? 'pending';
                                            $include_missing = $request['include_missing'] ?? 'no';
                                    Severity: Minor
                                    Found in code/app/Printers/Order.php - About 1 hr to fix

                                      Function filterBySupplier has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private function filterBySupplier($supplier, $user, $query, $own)
                                          {
                                              $type = 'all';
                                      
                                              if ($supplier) {
                                      Severity: Minor
                                      Found in code/app/Services/MovementsService.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 testAccess has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          protected function testAccess($target, $orders, $delivering)
                                          {
                                              $user = Auth::user();
                                              $valid = false;
                                      
                                      
                                      Severity: Minor
                                      Found in code/app/Services/BookingsService.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language