Showing 136 of 282 total issues

Function nextShape has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        nextShape: function(_set_next_only) {
          var next = this.next,
            func, shape, result;

          if (info.mode == 'nice' || info.mode == 'evil') {
Severity: Minor
Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 1 hr to fix

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

    module.exports = function (config) {
        config.set({
            basePath: '',
            frameworks: ['jasmine'],
            files: [{ pattern: './tests/unit/spec-bundle.js', watched: false }],
    Severity: Minor
    Found in karma.conf.js - About 1 hr to fix

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

      export function arrayPolyfills() {
          if (!Array.prototype.find) {
              Object.defineProperty(Array.prototype, 'find', {
                  value: function (predicate) {
                      // 1. Let O be ? ToObject(this value).
      Severity: Minor
      Found in src/libs/run-polyfills.ts - 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 ajax has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      }, e.ajax = function (r) {
                          var o, g, y = e.extend({}, r || {}), b = e.Deferred && e.Deferred();
                          for (n in e.ajaxSettings) void 0 === y[n] && (y[n] = e.ajaxSettings[n]);
                          !function (t) {
                              t.global && 0 == e.active++ && h(t, null, "ajaxStart")
      Severity: Minor
      Found in src/assets/js/games/tower/main.js - About 1 hr to fix

        Function rotate has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  rotate: function(direction) {
                    var orientation =
                      (this.orientation + (direction === "left" ? 1 : -1) + 4) % 4;
        
                    if (!game._checkCollisions(
        Severity: Minor
        Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                                          if (E = E || function (t) {
                                              return t && (t = t.split(";", 2)[0]), t && ("text/html" == t ? "html" : "application/json" == t ? "json" : s.test(t) ? "script" : u.test(t) && "xml") || "text"
                                          }(y.mimeType || k.getResponseHeader("content-type")), "arraybuffer" == k.responseType || "blob" == k.responseType) t = k.response; else {
                                              t = k.responseText;
                                              try {
          Severity: Critical
          Found in src/assets/js/games/tower/main.js - About 1 hr to fix

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

                getCompileVar: function getCompileVar(name, ctx, data) {
                  if ( data === void 0 ) data = 'data_1';
            
                  var variable = ctx;
                  var parts;
            Severity: Minor
            Found in src/_helpers/template7.js - About 1 hr to fix

              Function move has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              GameManager.prototype.move = function (direction) {
                // 0: up, 1: right, 2: down, 3: left
                var self = this;
              
                if (this.isGameTerminated()) return; // Don't do anything if the game's over
              Severity: Minor
              Found in src/assets/js/games/2048/game_manager.js - About 1 hr to fix

                Function t has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function t() {
                            var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
                            if (g(this, t), document.createElement("canvas").getContext) {
                                var n = e.canvasId, r = e.debug, a = e.width, o = e.height, s = e.highResolution, u = e.loadLimit, c = e.soundOn, l = a || window.innerWidth, h = o || window.innerHeight;
                                this.canvas = document.getElementById(n), s && (this.canvas.style.width = "".concat(l, "px"), this.canvas.style.height = "".concat(h, "px"), l *= 2, h *= 2), this.highResolution = s, this.canvas.width = l, this.canvas.height = h, this.width = this.canvas.width, this.height = this.canvas.height, this.calWidth = .5 * this.width, this.calHeight = .5 * this.height, this.debug = !!r, this.ctx = this.canvas.getContext("2d"), this.defaultLayer = "default", this.layerArr = [this.defaultLayer], this.instancesObj = {}, this.instancesObj[this.defaultLayer] = [], this.instancesReactionArr = [], this.utils = i, this.customVariable = {};
                Severity: Minor
                Found in src/assets/js/games/tower/main.js - About 1 hr to fix

                  Function hotkeys has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function hotkeys(key, option, method, data) {
                          var keys = getKeys(key); // List of shortcut keys to process
                          var mods = [];
                          var scope = 'all'; // Scope defaults to all, all ranges are valid
                          var element = document; // Shortcut event binding node
                  Severity: Minor
                  Found in src/_helpers/hotkeys.js - About 1 hr to fix

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

                        public load(callback?: any) {
                            const self = this;
                            let id: string = null;
                            let service = 'getByCategory';
                    
                    
                    Severity: Minor
                    Found in src/modules/news/news.module.ts - About 1 hr to fix

                      Function polyfillConsole has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          polyfillConsole() {
                              const scope = this;
                      
                              if (typeof window.console === 'undefined') {
                                  (<any>window).console = <Console>({
                      Severity: Minor
                      Found in src/_helpers/developer.ts - 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 _createUI has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _createUI: function() {
                      
                            var game = this;
                      
                            // Score
                      Severity: Minor
                      Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 1 hr to fix

                        Function preFlight has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private preFlight(callback): void {
                                const self = this;
                                window.onload = (function () {
                                    const $$video: any = self.broadcastVideo = document.getElementById("broadcastvideo");
                                    const $$appManager: any = self.appManager = document.getElementById("appmgr");
                        Severity: Minor
                        Found in src/app/bootstrap.ts - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                              if (x && (E = "jsonp"), !1 !== y.cache && (r && !0 === r.cache || "script" != E && "jsonp" != E) || (y.url = m(y.url, "_=" + Date.now())), "jsonp" == E) return x || (y.url = m(y.url, y.jsonp ? y.jsonp + "=?" : !1 === y.jsonp ? "" : "callback=?")), e.ajaxJSONP(y, b);
                          Severity: Critical
                          Found in src/assets/js/games/tower/main.js - About 1 hr to fix

                            Function getBlockColor has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    getBlockColor: function(blockType, blockVariation, blockIndex, falling) {
                                      /**
                                       * The theme allows us to do many things:
                                       * - Use a specific color for the falling block (primary), regardless of the proper color.
                                       * - Use another color for the placed blocks (secondary).
                            Severity: Minor
                            Found in src/assets/js/games/blockrain/blockrain.jquery.js - About 1 hr to fix

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

                                  private launch(): void {
                                      const self = this;
                                      const ratio = 1.5;
                                      let loadFinish, loadError, gameStart, game, score, successCount;
                                      let domReady = true;
                              Severity: Minor
                              Found in src/modules/games/tower/tower.game.ts - 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 toConsole has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  toConsole(type, args) {
                                      let line, t;
                              
                                      args = Array.prototype.slice.apply(args);
                              
                              
                              Severity: Minor
                              Found in src/_helpers/developer.ts - 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 onload has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      window.onload = (function () {
                                          const $$video: any = self.broadcastVideo = document.getElementById("broadcastvideo");
                                          const $$appManager: any = self.appManager = document.getElementById("appmgr");
                                          self.configObject = document.getElementById("oipfcfg");
                              
                              
                              Severity: Minor
                              Found in src/app/bootstrap.ts - About 1 hr to fix

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

                                    js_if: function js_if(expression, options) {
                                      var data = options.data;
                                      var func;
                                      var execute = expression;
                                      ('index first last key').split(' ').forEach(function (prop) {
                                Severity: Minor
                                Found in src/_helpers/template7.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language