madbob/GASdottoNG

View on GitHub

Showing 494 of 494 total issues

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

    public static function orders()
    {
        static $ret = null;

        if (is_null($ret)) {
Severity: Minor
Found in code/app/Helpers/Status.php - About 1 hr to fix

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

        public function ensureAuth($permissions = [], $or = true)
        {
            $user = Auth::user();
    
            if (is_null($user)) {
    Severity: Minor
    Found in code/app/Services/BaseService.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 store has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function store(Request $request)
        {
            DB::beginTransaction();
    
            $data = $request->input('data');
    Severity: Minor
    Found in code/app/Http/Controllers/AggregatesController.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 show has a Cognitive Complexity of 14 (exceeds 5 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

    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 calculateModifiers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function calculateModifiers($aggregate_data = null, $real = true)
        {
            $values = new Collection();
    
            $modifiers = $this->involvedModifiers();
    Severity: Minor
    Found in code/app/Booking.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 getSupplier has a Cognitive Complexity of 14 (exceeds 5 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

    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 updateRecursive has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function updateRecursive($data, $parent, &$accumulator)
        {
            foreach ($data as $category) {
                $c = null;
    
    
    Severity: Minor
    Found in code/app/Http/Controllers/CategoriesController.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 appliesCache has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function appliesCache()
        {
            if (is_null($this->applies_cache)) {
                $applies_cache = [];
                $applies_only_cache = [];
    Severity: Minor
    Found in code/app/Role.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 doPayment has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function doPayment(Request $request)
        {
            $type = $request->input('type');
    
            if ($type == 'satispay') {
    Severity: Minor
    Found in code/app/Http/Controllers/PaymentController.php - About 1 hr to fix

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

          public function run($request)
          {
              $imports = $request->input('import', []);
              $dates = $request->input('date', []);
              $senders = $request->input('sender_id', []);
      Severity: Minor
      Found in code/app/Importers/CSV/Movements.php - About 1 hr to fix

        Method calculateInvoicingSummary has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function calculateInvoicingSummary()
            {
                $summary = (object) [
                    'order' => $this->id,
                    'total' => 0,
        Severity: Minor
        Found in code/app/Order.php - About 1 hr to fix

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  Schema::create('invoice_movement', function (Blueprint $table) {
                      $table->increments('id');
                      $table->timestamps();
          
                      $table->string('invoice_id');
          code/database/migrations/2015_11_21_011220_create_aggregates_table.php on lines 16..25
          code/database/migrations/2016_03_02_035043_create_attachments_table.php on lines 22..31
          code/database/migrations/2017_04_14_230230_create_roles_table.php on lines 19..28

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  Schema::create('aggregate_gas', function (Blueprint $table) {
                      $table->increments('id');
                      $table->timestamps();
          
                      $table->string('gas_id');
          code/database/migrations/2016_03_02_035043_create_attachments_table.php on lines 22..31
          code/database/migrations/2017_04_14_230230_create_roles_table.php on lines 19..28
          code/database/migrations/2018_01_27_204523_create_invoices_table.php on lines 38..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  Schema::create('role_user', function (Blueprint $table) {
                      $table->increments('id');
                      $table->timestamps();
          
                      $table->string('user_id');
          code/database/migrations/2015_11_21_011220_create_aggregates_table.php on lines 16..25
          code/database/migrations/2016_03_02_035043_create_attachments_table.php on lines 22..31
          code/database/migrations/2018_01_27_204523_create_invoices_table.php on lines 38..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

                  Schema::create('attachments_access', function (Blueprint $table) {
                      $table->increments('id');
                      $table->timestamps();
          
                      $table->string('user_id');
          code/database/migrations/2015_11_21_011220_create_aggregates_table.php on lines 16..25
          code/database/migrations/2017_04_14_230230_create_roles_table.php on lines 19..28
          code/database/migrations/2018_01_27_204523_create_invoices_table.php on lines 38..47

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 114.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function movementTypeEditor has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static movementTypeEditor(container)
              {
                  $('select[name=sender_type], select[name=target_type]', container).change(function(e) {
                      var editor = $(this).closest('.movement-type-editor');
                      var sender = editor.find('select[name=sender_type] option:selected').val();
          Severity: Minor
          Found in code/resources/assets/js/movements.js - About 1 hr to fix

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

                public static function formattableColumns($type = null)
                {
                    $ret = [
                        'lastname' => (object) [
                            'name' => _i('Cognome'),
            Severity: Minor
            Found in code/app/Formatters/User.php - About 1 hr to fix

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

                  public function getOrderDatesAttribute()
                  {
                      $ret = [];
              
                      if ($this->type != 'order') {
              Severity: Minor
              Found in code/app/Date.php - About 1 hr to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                <?php
                
                use Illuminate\Database\Migrations\Migration;
                use Illuminate\Database\Schema\Blueprint;
                
                
                code/database/migrations/2015_11_21_015301_create_variant_values_table.php on lines 1..25

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 113.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                <?php
                
                use Illuminate\Database\Migrations\Migration;
                use Illuminate\Database\Schema\Blueprint;
                
                
                code/database/migrations/2015_11_21_011239_create_variants_table.php on lines 1..25

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 113.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language