BabylonJS/Spector.js

View on GitHub

Showing 266 of 572 total issues

Function ./OBJ/objFileLoader.ts has 488 lines of code (exceeds 25 allowed). Consider refactoring.
Open

/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OBJFileLoader", function() { return OBJFileLoader; });
Severity: Major
Found in sample/assets/js/babylon.objFileLoader.js - About 2 days to fix

    Function OBJFileLoader has 483 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var OBJFileLoader = /** @class */ (function () {
        /**
         * Creates loader for .OBJ files
         *
         * @param meshLoadOptions options for loading and parsing OBJ/MTL files.
    Severity: Major
    Found in sample/assets/js/babylon.objFileLoader.js - About 2 days to fix

      Function _parseSolid has 381 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          OBJFileLoader.prototype._parseSolid = function (meshesNames, scene, data, rootUrl) {
              var _this = this;
              var positions = []; //values for the positions of vertices
              var normals = []; //Values for the normals
              var uvs = []; //Values for the textures
      Severity: Major
      Found in sample/assets/js/babylon.objFileLoader.js - About 1 day to fix

        File webglConstants.ts has 716 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // tslint:disable:max-file-line-count
        // tslint:disable:interface-name
        // tslint:disable:max-line-length
        // tslint:disable:variable-name
        
        
        Severity: Major
        Found in src/backend/types/webglConstants.ts - About 1 day to fix

          File resultView.ts has 708 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Import application Styles.
          import "../styles/resultView.scss";
          
          import { Observable } from "../../shared/utils/observable";
          import { ICapture } from "../../shared/capture/capture";
          Severity: Major
          Found in src/embeddedFrontend/resultView/resultView.ts - About 1 day to fix

            File babylon.objFileLoader.js has 644 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            (function webpackUniversalModuleDefinition(root, factory) {
                if(typeof exports === 'object' && typeof module === 'object')
                    module.exports = factory(require("babylonjs"));
                else if(typeof define === 'function' && define.amd)
                    define("babylonjs-loaders", ["babylonjs"], factory);
            Severity: Major
            Found in sample/assets/js/babylon.objFileLoader.js - About 1 day to fix

              File contentScript.js has 514 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              var debug = false;
              
              //_______________________________EXTENSION POLYFILL_____________________________________
              window.browser = (function () {
                  return window.msBrowser ||
              Severity: Major
              Found in extensions/contentScript.js - About 1 day to fix

                File ace-ext-searchbox.js has 482 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
                "use strict";
                
                var dom = require("../lib/dom");
                var lang = require("../lib/lang");
                Severity: Minor
                Found in vendors/ace-ext-searchbox.js - About 7 hrs to fix

                  File ace-mode-glsl.js has 478 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
                  "use strict";
                  
                  var oop = require("../lib/oop");
                  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
                  Severity: Minor
                  Found in vendors/ace-mode-glsl.js - About 7 hrs to fix

                    File drawCallState.ts has 456 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { BaseState } from "../baseState";
                    import { WebGlConstants, WebGlConstantsByName, WebGlConstant, WebGlConstantsByValue } from "../../types/webglConstants";
                    import { DrawCallTextureInputState } from "./drawCallTextureInputState";
                    import { DrawCallUboInputState } from "./drawCallUboInputState";
                    import { ProgramRecompilerHelper } from "../../utils/programRecompilerHelper";
                    Severity: Minor
                    Found in src/backend/states/drawCalls/drawCallState.ts - About 6 hrs to fix

                      File spector.ts has 450 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { WebGLRenderingContexts, IContextInformation } from "./backend/types/contextInformation";
                      
                      import { ICapture } from "./shared/capture/capture";
                      
                      import { ProgramRecompilerHelper } from "./backend/utils/programRecompilerHelper";
                      Severity: Minor
                      Found in src/spector.ts - About 6 hrs to fix

                        Function c_cppHighlightRules has 168 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var c_cppHighlightRules = function() {
                        
                            var keywordControls = (
                                "break|case|continue|default|do|else|for|goto|if|_Pragma|" +
                                "return|switch|while|catch|operator|try|throw|using"
                        Severity: Major
                        Found in vendors/ace-mode-glsl.js - About 6 hrs to fix

                          Function getStackTrace has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static getStackTrace(removeFirstNCalls = 0, removeLastNCalls = 0): string[] {
                                  const callstack: string[] = [];
                          
                                  try {
                                      throw new Error("Errorator.");
                          Severity: Minor
                          Found in src/shared/utils/stackTrace.ts - About 6 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 compareGroups has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private compareGroups(name: string, groupA: any, groupB: any): GroupComparisonResult {
                                  // Prepare cache and result.
                                  const processed: AlreadyProcessed = {};
                                  const groupResult: GroupComparisonResult = {
                                      name,
                          Severity: Minor
                          Found in src/backend/comparators/commandComparator.ts - About 5 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

                          Spector has 39 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          export class Spector {
                              public static getFirstAvailable3dContext(canvas: HTMLCanvasElement | OffscreenCanvas): WebGLRenderingContexts {
                                  // Custom detection to run in the extension.
                                  return this.tryGetContextFromHelperField(canvas) ||
                                      this.tryGetContextFromCanvas(canvas, "webgl") ||
                          Severity: Minor
                          Found in src/spector.ts - About 5 hrs to fix

                            Function readFromContext has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected readFromContext(): void {
                                    const program = this.context.getParameter(WebGlConstants.CURRENT_PROGRAM.value);
                                    if (!program) {
                                        return;
                                    }
                            Severity: Minor
                            Found in src/backend/states/drawCalls/drawCallState.ts - About 5 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 analyse has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected analyse(consumeCommand: ICommandCapture): void {
                                    for (const stateName in this.capturedCommandsByState) {
                                        if (this.capturedCommandsByState.hasOwnProperty(stateName)) {
                                            const commands = this.capturedCommandsByState[stateName];
                                            const lengthM1 = commands.length - 1;
                            Severity: Minor
                            Found in src/backend/states/baseState.ts - About 5 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 ./OBJ/mtlFileLoader.ts has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            /***/ (function(module, __webpack_exports__, __webpack_require__) {
                            
                            "use strict";
                            __webpack_require__.r(__webpack_exports__);
                            /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MTLFileLoader", function() { return MTLFileLoader; });
                            Severity: Major
                            Found in sample/assets/js/babylon.objFileLoader.js - About 4 hrs to fix

                              Function MTLFileLoader has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              var MTLFileLoader = /** @class */ (function () {
                                  function MTLFileLoader() {
                                      /**
                                       * All material loaded from the mtl will be set here
                                       */
                              Severity: Major
                              Found in sample/assets/js/babylon.objFileLoader.js - About 4 hrs to fix

                                Function _adaptComments has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private _adaptComments(str: string): string {
                                        let singleLineComment = false;
                                        let multiLineComment = false;
                                
                                        for (let index = 0; index < str.length; index++) {
                                Severity: Minor
                                Found in src/embeddedFrontend/resultView/sourceCode/sourceCodeComponent.ts - About 4 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

                                Severity
                                Category
                                Status
                                Source
                                Language