GrafiteInc/Commerce

View on GitHub

Showing 50 of 99 total issues

File card.js has 1709 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var card =
/******/ (function(modules) { // webpackBootstrap
/******/  // The module cache
/******/  var installedModules = {};

Severity: Major
Found in src/Publishes/public/js/card.js - About 4 days to fix

    CartService has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CartService
    {
        use CartHtmlGenerator;
    
        public function __construct(ProductService $service)
    Severity: Minor
    Found in src/Services/CartService.php - About 2 hrs to fix

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

          public function cancel($id)
          {
              try {
                  $orderItem = $this->find($id);
      
      
      Severity: Minor
      Found in src/Services/OrderItemService.php - About 1 hr to fix

        Function equal has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          is.equal = function equal(value, other) {
            if (value === other) {
              return true;
            }
        
        
        Severity: Minor
        Found in src/Publishes/public/js/card.js - About 1 hr to fix

          Method purchase has 40 lines of code (exceeds 25 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 1 hr to fix

            Function extend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              var extend = function extend() {
                var target = arguments[0] || {};
                var i = 1;
                var length = arguments.length;
                var deep = false;
            Severity: Minor
            Found in src/Publishes/public/js/card.js - About 1 hr to fix

              Function render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  Card.prototype.render = function() {
                    var $cardContainer, baseWidth, name, obj, selector, ua, _ref, _ref1;
                    QJ.append(this.$container, this.template(this.cardTemplate, extend({}, this.options.messages, this.options.placeholders)));
                    _ref = this.options.cardSelectors;
                    for (name in _ref) {
              Severity: Minor
              Found in src/Publishes/public/js/card.js - About 1 hr to fix

                Function addStyle has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function addStyle(obj, options) {
                    var styleElement, update, remove;
                
                    if (options.singleton) {
                      var styleIndex = singletonCounter++;
                Severity: Minor
                Found in src/Publishes/public/js/card.js - About 1 hr to fix

                  Function attachHandlers has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      Card.prototype.attachHandlers = function() {
                        var expiryFilters, numberInputFilters;
                        numberInputFilters = [this.validToggler('cardNumber')];
                        if (this.options.masks.cardNumber) {
                          numberInputFilters.push(this.maskCardNumber);
                  Severity: Minor
                  Found in src/Publishes/public/js/card.js - About 1 hr to fix

                    Function update has a Cognitive Complexity of 12 (exceeds 5 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

                    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 exports has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      module.exports = function() {
                        var list = [];
                    
                        // return the list of modules as css string
                        list.toString = function toString() {
                    Severity: Minor
                    Found in src/Publishes/public/js/card.js - About 1 hr to fix

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

                          public function weightVariants($item, $product)
                          {
                              $variants = json_decode($item->product_variants);
                      
                              if (!is_null($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 validateCardExpiry has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              validateCardExpiry: function(month, year) {
                                var currentTime, expiry, prefix, ref, ref1;
                                if (typeof month === 'object' && 'month' in month) {
                                  ref = month, month = ref.month, year = ref.year;
                                } else if (typeof month === 'string' && indexOf.call(month, '/') >= 0) {
                      Severity: Minor
                      Found in src/Publishes/public/js/card.js - About 1 hr to fix

                        Function validToggler has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            Card.prototype.validToggler = function(validatorName) {
                              var isValid;
                              if (validatorName === "cardExpiry") {
                                isValid = function(val) {
                                  var objVal;
                        Severity: Minor
                        Found in src/Publishes/public/js/card.js - About 1 hr to fix

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

                              public function createOrder($user, $transaction, $items)
                              {
                                  $customerService = app(CustomerProfileService::class);
                          
                                  $shippingAddress = json_encode([
                          Severity: Minor
                          Found in src/Services/PaymentService.php - About 1 hr to fix

                            Method cancel has 30 lines of code (exceeds 25 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

                              Method addToCart has 30 lines of code (exceeds 25 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 1 hr to fix

                                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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language