Showing 136 of 282 total issues

Consider simplifying this complex logical expression.
Open

                    if (b && b.promise(k), y.crossDomain || A("X-Requested-With", "XMLHttpRequest"), A("Accept", O || "*/*"), (O = y.mimeType || O) && (O.indexOf(",") > -1 && (O = O.split(",", 2)[0]), k.overrideMimeType && k.overrideMimeType(O)), (y.contentType || !1 !== y.contentType && y.data && "GET" != y.type.toUpperCase()) && A("Content-Type", y.contentType || "application/x-www-form-urlencoded"), y.headers) for (i in y.headers) A(i, y.headers[i]);
Severity: Critical
Found in src/assets/js/games/tower/main.js - About 3 hrs to fix

    Function appendUIStyles has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        appendUIStyles() {
            let s = document.createElement('style');
            let cssText = "\
    #developer-ui {\
    position: absolute;\
    Severity: Major
    Found in src/_helpers/developer.ts - About 2 hrs to fix

      Function listen has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      KeyboardInputManager.prototype.listen = function () {
        var self = this;
      
        var map = {
          38: 0, // Up
      Severity: Major
      Found in src/assets/js/games/2048/keyboard_input_manager.js - About 2 hrs to fix

        Function $ has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            }, $ = function (t, e, n) {
                var i = t, r = typeof e !== 'undefined' ? e.getVariable("ROPE_HEIGHT") : 0;
                if (i.visible) {
                    i.ready || (i.ready = !0, i.status = "SWING", t.updateWidth(e.getVariable("BLOCK_WIDTH")), t.updateHeight(e.getVariable("BLOCK_HEIGHT")), t.x = e.width / 2, t.y = -1.5 * r);
                    var a = e.getInstance("line");
        Severity: Major
        Found in src/assets/js/games/tower/main.js - About 2 hrs to fix

          File sepehr.module.ts has 281 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import * as moment from 'moment-jalaali';
          import { Module } from '../../libs';
          import template from './sepehr.template.html';
          import categoriesTemplate from './sepehr-categories.template.html';
          import channelsTemplate from './sepehr-channels.template.html';
          Severity: Minor
          Found in src/modules/sepehr/sepehr.module.ts - About 2 hrs to fix

            File hotkeys.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*!
             * hotkeys-js v3.3.8
             * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
             * 
             * Copyright (c) 2018 kenny wong <wowohoo@qq.com>
            Severity: Minor
            Found in src/_helpers/hotkeys.js - About 2 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                      if (i.visible) {
                          i.ready || (i.ready = !0, i.status = "SWING", t.updateWidth(e.getVariable("BLOCK_WIDTH")), t.updateHeight(e.getVariable("BLOCK_HEIGHT")), t.x = e.width / 2, t.y = -1.5 * r);
                          var a = e.getInstance("line");
                          switch (i.status) {
                              case"SWING":
              Severity: Critical
              Found in src/assets/js/games/tower/main.js - About 2 hrs to fix

                File player.helper.ts has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import TemplateHelper from './template.helper';
                import Inputs from '../app/inputs';
                import videojs from 'video.js';
                import { Event } from '../_models';
                
                
                Severity: Minor
                Found in src/_helpers/player.helper.ts - About 2 hrs to fix

                  Function animate has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          animate: function() {
                            var drop = false,
                                moved = false,
                                gameOver = false,
                                now = Date.now();
                  Severity: Major
                  Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 2 hrs to fix

                    Function _setupTouchControls has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        _setupTouchControls: function(enable) {
                    
                          var game = this;
                    
                          // Movements can be held for faster movement
                    Severity: Major
                    Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 2 hrs to fix

                      Function polyfillConsole has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          polyfillConsole() {
                              const scope = this;
                      
                              if (typeof window.console === 'undefined') {
                                  (<any>window).console = <Console>({
                      Severity: Major
                      Found in src/_helpers/developer.ts - About 2 hrs to fix

                        Function helperToSlices has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            helperToSlices: function helperToSlices(string) {
                              var quoteDoubleRexExp = Template7Utils.quoteDoubleRexExp;
                              var quoteSingleRexExp = Template7Utils.quoteSingleRexExp;
                              var helperParts = string.replace(/[{}#}]/g, '').trim().split(' ');
                              var slices = [];
                        Severity: Major
                        Found in src/_helpers/template7.js - About 2 hrs to fix

                          SepehrModule has 21 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          export default class SepehrModule extends Module {
                          
                              private readonly currentDate;
                              protected events = {
                                  'sepehr-categories.prev': { control: 'right', title: 'قبلی', icon: 'right' },
                          Severity: Minor
                          Found in src/modules/sepehr/sepehr.module.ts - About 2 hrs to fix

                            Developer has 21 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            export default class Developer {
                            
                                config = {
                                    debug: true,
                                    /**
                            Severity: Minor
                            Found in src/_helpers/developer.ts - About 2 hrs to fix

                              Function tileMatchesAvailable has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                              Open

                              GameManager.prototype.tileMatchesAvailable = function () {
                                var self = this;
                              
                                var tile;
                              
                              
                              Severity: Minor
                              Found in src/assets/js/games/2048/game_manager.js - About 2 hrs 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 _preloadThemeAssets has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  _preloadThemeAssets: function() {
                              
                                    var game = this;
                              
                                    var hexColorcheck = new RegExp('^#[A-F0-9+]{3,6}', 'i');
                              Severity: Major
                              Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 2 hrs to fix

                                Function onKeyDown has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    onKeyDown(keyCode, event, fromRC) {
                                        const scope = this;
                                        if (this.isActive) {
                                            if (document.activeElement && document.activeElement.nodeName === 'INPUT') {
                                                alert('000');
                                Severity: Minor
                                Found in src/_helpers/developer.ts - About 2 hrs to fix

                                  Function func has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        var func = function(filled, checkCollisions, width, height, mode, _one_shape) {
                                          if (!_one_shape) resetShapes();
                                  
                                          var possibles = new Array(width * height),
                                              evil = mode == 'evil',
                                  Severity: Minor
                                  Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 1 hr to fix

                                    Function cookie has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        static cookie(key: string, value?: string, options?: StoreOptions) {
                                            if (!key) {
                                                return false;
                                            }
                                            // Write
                                    Severity: Minor
                                    Found in src/_utilities/storage.utility.ts - About 1 hr to fix

                                      Function tt has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          }, tt = function (t) {
                                              if (t.getVariable("GAME_START_NOW")) {
                                                  var e = t.getInstance("block_".concat(t.getVariable("BLOCK_COUNT")));
                                                  if (!e || [w, A].indexOf(e.status) > -1) {
                                                      if (_(t) && k(t)) return;
                                      Severity: Minor
                                      Found in src/assets/js/games/tower/main.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language