BabylonJS/Spector.js

View on GitHub

Showing 266 of 572 total issues

Function _beautify has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private _beautify(glsl: string, level: number = 0): string {
        let spaces = "";
        for (let i = 0; i < level; i++) {
            spaces += "    "; // 4 spaces
        }
Severity: Minor
Found in src/embeddedFrontend/resultView/sourceCode/sourceCodeComponent.ts - 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 init has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private init(): void {
        // Needs both this.
        // tslint:disable-next-line
        const self = this;

Severity: Minor
Found in src/backend/spies/canvasSpy.ts - 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 getTextureVisualState has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected getTextureVisualState(target: WebGlConstant, storage: WebGLTexture, info: ITextureRecorderData, pixelated: boolean): any {
        try {
            const gl = this.context;
            const visual: any = {};

Severity: Major
Found in src/backend/states/drawCalls/drawCallTextureInputState.ts - About 2 hrs to fix

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

        protected getCapture(gl: WebGLRenderingContext, name: string, x: number, y: number, width: number, height: number,
            textureCubeMapFace: number, textureLayer: number, type: number) {
            width = Math.floor(width);
            height = Math.floor(height);
    
    
    Severity: Major
    Found in src/backend/states/context/visualState.ts - About 2 hrs to fix

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

          protected static initializeByteSizeFormat(): void {
              if (this.byteSizePerInternalFormat) {
                  return;
              }
      
      
      Severity: Major
      Found in src/backend/recorders/baseRecorder.ts - About 2 hrs to fix

        Function Loader has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var Loader = (function () {
                var useDist;
                var queue;
                var callback;
        
        
        Severity: Major
        Found in tools/loader.js - About 2 hrs to fix

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

              protected readFrameBufferAttachmentFromContext(attachment: number): any {
                  const target = WebGlConstants.FRAMEBUFFER.value;
                  const type = this.context.getFramebufferAttachmentParameter(target, attachment, WebGlConstants.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE.value);
                  if (type === WebGlConstants.NONE.value) {
                      return undefined;
          Severity: Minor
          Found in src/backend/states/drawCalls/drawCallState.ts - 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 ensure4x4 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          Matrix.prototype.ensure4x4 = function()
          {
              if (this.elements.length == 4 &&
                  this.elements[0].length == 4)
                  return this;
          Severity: Minor
          Found in sample/assets/js/glUtils.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 getChangeCommandsByState has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              protected getChangeCommandsByState(): { [key: string]: string[] } {
                  this.parameters = [];
                  this.parameters.push(this.getWebgl1Parameters());
                  if (this.contextVersion > 1) {
                      this.parameters.push(this.getWebgl2Parameters());
          Severity: Minor
          Found in src/backend/states/parameterState.ts - 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 getCapture has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              protected getCapture(gl: WebGLRenderingContext, name: string, x: number, y: number, width: number, height: number,
                  textureCubeMapFace: number, textureLayer: number, type: number) {
                  width = Math.floor(width);
                  height = Math.floor(height);
          
          
          Severity: Minor
          Found in src/backend/states/context/visualState.ts - 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 getCapture has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected getCapture(gl: WebGLRenderingContext, x: number, y: number, width: number, height: number, type: number, pixelated: boolean): string {
                  width = Math.floor(width);
                  height = Math.floor(height);
          
                  try {
          Severity: Major
          Found in src/backend/states/drawCalls/drawCallTextureInputState.ts - About 2 hrs to fix

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

            var createScene = function (engine, canvas) {
                var scene = new BABYLON.Scene(engine);
            
                //Create a light
                var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(-60, 60, 80), scene);
            Severity: Minor
            Found in sample/js/texturePixellated.js - About 2 hrs to fix

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

              var createScene = function (engine, canvas) {
                  var scene = new BABYLON.Scene(engine);
              
                  //Create a light
                  var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(-60, 60, 80), scene);
              Severity: Minor
              Found in sample/js/texture2d.js - About 2 hrs to fix

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

                    protected readUniformFromContext(program: WebGLProgram, activeUniformIndex: number): {} {
                        const info = this.context.getActiveUniform(program, activeUniformIndex);
                        const location = this.context.getUniformLocation(program, info.name);
                        if (location) {
                
                
                Severity: Minor
                Found in src/backend/states/drawCalls/drawCallState.ts - About 2 hrs to fix

                  Consider simplifying this complex logical expression.
                  Open

                          if (internalFormat !== WebGlConstants.RGB.value &&
                              internalFormat !== WebGlConstants.RGBA.value &&
                              internalFormat !== WebGlConstants.RGBA8.value &&
                              internalFormat !== WebGlConstants.RGBA16F.value &&
                              internalFormat !== WebGlConstants.RGBA32F.value &&
                  Severity: Critical
                  Found in src/backend/utils/readPixelsHelper.ts - About 2 hrs to fix

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

                        protected readFrameBufferAttachmentFromRenderBuffer(gl: WebGLRenderingContext | WebGL2RenderingContext,
                            frameBuffer: WebGLFramebuffer, webglConstant: WebGlConstant,
                            x: number, y: number, width: number, height: number,
                            target: number, componentType: number, storage: any): void {
                    
                    
                    Severity: Minor
                    Found in src/backend/states/context/visualState.ts - About 2 hrs to fix

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

                          private _beautify(glsl: string, level: number = 0): string {
                              let spaces = "";
                              for (let i = 0; i < level; i++) {
                                  spaces += "    "; // 4 spaces
                              }
                      Severity: Minor
                      Found in src/embeddedFrontend/resultView/sourceCode/sourceCodeComponent.ts - About 1 hr to fix

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

                            private getJSONAsString(parentGroupId: number, key: string, json: any): string {
                                if (json === null) {
                                    return "null";
                                }
                        
                        
                        Severity: Minor
                        Found in src/embeddedFrontend/resultView/resultView.ts - About 1 hr to fix

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

                              private static executeFunction(object: any, functionName: string, args: IArguments) {
                                  const a = args;
                                  if (a === undefined || a.length === 0) {
                                      return object[functionName]();
                                  }
                          Severity: Minor
                          Found in src/backend/utils/originFunctionHelper.ts - About 1 hr to fix

                            Function serializeCapture has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                            Open

                                function serializeCapture(capture) {
                                    var commands = capture.commands;
                                    capture.commands = [];
                            
                                    var serializedCapture;
                            Severity: Minor
                            Found in extensions/contentScript.js - 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

                            Severity
                            Category
                            Status
                            Source
                            Language