Showing 50 of 99 total issues
File card.js
has 1709 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
var card =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
CartService
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class CartService
{
use CartHtmlGenerator;
public function __construct(ProductService $service)
Method cancel
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function cancel($id)
{
try {
$orderItem = $this->find($id);
Function equal
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
is.equal = function equal(value, other) {
if (value === other) {
return true;
}
Method purchase
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function purchase($stripeToken, $cart)
{
$user = auth()->user();
if (is_null($user->meta->stripe_id) && $stripeToken) {
Function extend
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var extend = function extend() {
var target = arguments[0] || {};
var i = 1;
var length = arguments.length;
var deep = false;
Function render
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
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) {
Function addStyle
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addStyle(obj, options) {
var styleElement, update, remove;
if (options.singleton) {
var styleIndex = singletonCounter++;
Function attachHandlers
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Card.prototype.attachHandlers = function() {
var expiryFilters, numberInputFilters;
numberInputFilters = [this.validToggler('cardNumber')];
if (this.options.masks.cardNumber) {
numberInputFilters.push(this.maskCardNumber);
Function update
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
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);
}
- Read upRead up
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
Open
module.exports = function() {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
Function weightVariants
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function weightVariants($item, $product)
{
$variants = json_decode($item->product_variants);
if (!is_null($variants)) {
- Read upRead up
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
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) {
Function validToggler
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Card.prototype.validToggler = function(validatorName) {
var isValid;
if (validatorName === "cardExpiry") {
isValid = function(val) {
var objVal;
Method createOrder
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function createOrder($user, $transaction, $items)
{
$customerService = app(CustomerProfileService::class);
$shippingAddress = json_encode([
Method cancel
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function cancel($orderId)
{
$order = $this->repo->find($orderId);
if ($order->status != 'complete') {
Method addToCart
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addToCart($id, $type, $quantity, $variables)
{
$cart = Session::get('cart');
$variableArray = null;
Function exports
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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");
}
Function addToCart
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addToCart: function(_id, _quantity, _type) {
var _variants = [];
var _store = this;
$('.product_variants').each(function(){
Function on
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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];