GrafiteInc/Commerce

View on GitHub

Showing 99 of 99 total issues

Function exports has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  module.exports = function(list, options) {
    if(false) {
      if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
    }

Severity: Minor
Found in src/Publishes/public/js/card.js - About 1 hr to fix

    Function addToCart has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        addToCart: function(_id, _quantity, _type) {
            var _variants = [];
            var _store = this;
    
            $('.product_variants').each(function(){
    Severity: Minor
    Found in src/Publishes/public/js/store.js - About 1 hr to fix

      Function on has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          QJ.on = function(element, eventName, callback) {
            var el, i, j, len, len1, multEventName, originalCallback, ref;
            if (element.length) {
              for (i = 0, len = element.length; i < len; i++) {
                el = element[i];
      Severity: Minor
      Found in src/Publishes/public/js/card.js - About 1 hr to fix

        Function priceVariants has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function priceVariants($item, $product)
            {
                $variants = json_decode($item->product_variants);
        
                if ($variants) {
        Severity: Minor
        Found in src/Services/CartService.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 cancel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function cancel($orderId)
            {
                $order = $this->repo->find($orderId);
        
                if ($order->status != 'complete') {
        Severity: Minor
        Found in src/Services/OrderService.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function up()
            {
                Schema::create(config('cms.db-prefix', '').'products', function (Blueprint $table) {
                    $table->increments('id');
                    $table->string('name');
        Severity: Minor
        Found in src/Migrations/2015_10_03_021904_create_products_table.php - About 1 hr to fix

          Method update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function update($userId, $payload)
              {
                  if (isset($payload['meta']) && ! isset($payload['meta']['terms_and_cond'])) {
                      throw new Exception("You must agree to the terms and conditions.", 1);
                  }
          Severity: Minor
          Found in fixture/Services/UserService.php - About 1 hr to fix

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

                    for (i = 0, len = element.length; i < len; i++) {
                      el = element[i];
                      QJ.on(el, eventName, callback);
                    }
            Severity: Major
            Found in src/Publishes/public/js/card.js and 1 other location - About 1 hr to fix
            src/Publishes/public/js/card.js on lines 879..882

            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 56.

            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

                    for (j = 0, len1 = ref.length; j < len1; j++) {
                      multEventName = ref[j];
                      QJ.on(element, multEventName, callback);
                    }
            Severity: Major
            Found in src/Publishes/public/js/card.js and 1 other location - About 1 hr to fix
            src/Publishes/public/js/card.js on lines 871..874

            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 56.

            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

                      if (year.length === 2) {
                        prefix = (new Date).getFullYear();
                        prefix = prefix.toString().slice(0, 2);
                        year = prefix + year;
                      }
            Severity: Major
            Found in src/Publishes/public/js/card.js and 1 other location - About 1 hr to fix
            src/Publishes/public/js/card.js on lines 1462..1466

            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 55.

            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

                      if ((year != null ? year.length : void 0) === 2 && /^\d+$/.test(year)) {
                        prefix = (new Date).getFullYear();
                        prefix = prefix.toString().slice(0, 2);
                        year = prefix + year;
                      }
            Severity: Major
            Found in src/Publishes/public/js/card.js and 1 other location - About 1 hr to fix
            src/Publishes/public/js/card.js on lines 1508..1512

            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 55.

            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

                $('#deleteCouponBtn').click(function(e){
                    $('#deleteCouponForm')[0].submit();
                    $('#deleteCouponDialog').modal('hide');
                });
            Severity: Minor
            Found in src/Assets/js/coupons.js and 1 other location - About 55 mins to fix
            src/Assets/js/plans.js on lines 43..46

            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 54.

            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

                $('#deletePlanBtn').click(function(e){
                    $('#deletePlanForm')[0].submit();
                    $('#deletePlanDialog').modal('hide');
                });
            Severity: Minor
            Found in src/Assets/js/plans.js and 1 other location - About 55 mins to fix
            src/Assets/js/coupons.js on lines 9..12

            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 54.

            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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

                public function paginated()
                {
                    if (isset(request()->dir) && isset(request()->field)) {
                        $model = $this->model->orderBy(request()->field, request()->dir);
                    } else {
            Severity: Major
            Found in src/Repositories/TransactionRepository.php and 2 other locations - About 55 mins to fix
            src/Repositories/OrderRepository.php on lines 30..39
            src/Repositories/ProductRepository.php on lines 43..52

            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 99.

            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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

                public function paginated()
                {
                    if (isset(request()->dir) && isset(request()->field)) {
                        $model = $this->model->orderBy(request()->field, request()->dir);
                    } else {
            Severity: Major
            Found in src/Repositories/ProductRepository.php and 2 other locations - About 55 mins to fix
            src/Repositories/OrderRepository.php on lines 30..39
            src/Repositories/TransactionRepository.php on lines 45..54

            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 99.

            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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

                public function paginated()
                {
                    if (isset(request()->dir) && isset(request()->field)) {
                        $model = $this->model->orderBy(request()->field, request()->dir);
                    } else {
            Severity: Major
            Found in src/Repositories/OrderRepository.php and 2 other locations - About 55 mins to fix
            src/Repositories/ProductRepository.php on lines 43..52
            src/Repositories/TransactionRepository.php on lines 45..54

            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 99.

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

                public function addToCart($id, $type, $quantity, $variables)
                {
                    $cart = Session::get('cart');
                    $variableArray = null;
            
            
            Severity: Minor
            Found in src/Repositories/CartSessionRepository.php - About 55 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

            Function collectNewCoupons has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function collectNewCoupons()
                {
                    $stripeCoupons = $this->stripeService->collectStripeCoupons()->data;
            
                    foreach ($stripeCoupons as $coupon) {
            Severity: Minor
            Found in src/Services/CouponService.php - About 55 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

            Function purchase has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function purchase($stripeToken, $cart)
                {
                    $user = auth()->user();
            
                    if (is_null($user->meta->stripe_id) && $stripeToken) {
            Severity: Minor
            Found in src/Services/PaymentService.php - About 55 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

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

                            if (_response.data == 1) {
                                var _requestUrl = _url+"/"+_store.url+"/favorites/remove/"+_id;
                                $(_button).html(_content + ' ' + _isFavorite)
                            } else {
            Severity: Minor
            Found in src/Publishes/public/js/store.js and 1 other location - About 55 mins to fix
            src/Publishes/public/js/store.js on lines 63..66

            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 53.

            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