BabylonJS/Spector.js

View on GitHub

Showing 266 of 572 total issues

Function constructor has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    constructor(private readonly rootPlaceHolder: Element = null) {
        this.onSourceCodeChanged = new Observable();

        this.rootPlaceHolder = this.rootPlaceHolder || document.body;
        this.mvx = new MVX(this.rootPlaceHolder);
Severity: Major
Found in src/embeddedFrontend/resultView/resultView.ts - About 4 hrs to fix

    ResultView has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class ResultView {
        public readonly onSourceCodeChanged: Observable<ISourceCodeChangeEvent>;
    
        private readonly mvx: MVX;
    
    
    Severity: Minor
    Found in src/embeddedFrontend/resultView/resultView.ts - About 4 hrs to fix

      Function displayJSON has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          private displayJSON(parentGroupId: number, json: any) {
              if (json.VisualState) {
                  this.mvx.addChildState(parentGroupId, json.VisualState, this.jsonVisualStateItemComponent);
              }
      
      
      Severity: Minor
      Found in src/embeddedFrontend/resultView/resultView.ts - About 3 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 parseMTL has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          MTLFileLoader.prototype.parseMTL = function (scene, data, rootUrl) {
              if (data instanceof ArrayBuffer) {
                  return;
              }
              //Split the lines from the file
      Severity: Major
      Found in sample/assets/js/babylon.objFileLoader.js - About 3 hrs to fix

        Function init has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            private init(): void {
                if (!navigator.xr) {
                    return;
                }
        
        
        Severity: Minor
        Found in src/backend/spies/xrSpy.ts - About 3 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 getJSONAsString has a Cognitive Complexity of 23 (exceeds 5 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 3 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 78 lines of code (exceeds 25 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: Major
        Found in src/backend/comparators/commandComparator.ts - About 3 hrs to fix

          Function readFromContext has 77 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected readFromContext(): void {
                  const program = this.context.getParameter(WebGlConstants.CURRENT_PROGRAM.value);
                  if (!program) {
                      return;
                  }
          Severity: Major
          Found in src/backend/states/drawCalls/drawCallState.ts - About 3 hrs to fix

            File sourceCodeComponent.ts has 289 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import preprocess from "@shaderfrog/glsl-parser/preprocessor"; // tslint:disable-line:no-submodule-imports
            import { BaseComponent, IStateEvent } from "../../mvx/baseComponent";
            import { ISourceCodeChangeEvent } from "../resultView";
            import { Logger } from "../../../shared/utils/logger";
            
            
            Severity: Minor
            Found in src/embeddedFrontend/resultView/sourceCode/sourceCodeComponent.ts - About 2 hrs to fix

              Function createCommands has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private createCommands(capture: ICapture): void {
                      this.mvx.removeChildrenStates(this.commandListStateId);
                      let tempVisualStateId = this.initVisualStateId;
                      let visualStateSet = false;
              
              
              Severity: Major
              Found in src/embeddedFrontend/resultView/resultView.ts - About 2 hrs to fix

                Function refreshCanvases has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                var refreshCanvases = function() {
                    if (captureOffScreen) {
                        // List is retrieved from all the ever created canvases.
                        var myEvent = new CustomEvent("SpectorRequestCanvasListEvent");
                        document.dispatchEvent(myEvent);
                Severity: Minor
                Found in extensions/contentScript.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 render has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    public render(state: ISourceCodeState, stateId: number): Element {
                        const source = state.fragment ? state.sourceFragment : state.sourceVertex;
                        let originalShader: string;
                        let preprocessed = state.preprocessed;
                
                
                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 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private init(): void {
                        if (!navigator.xr) {
                            return;
                        }
                
                
                Severity: Major
                Found in src/backend/spies/xrSpy.ts - About 2 hrs to fix

                  Function render has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public render(state: ICommandListItemState, stateId: number): Element {
                          const liHolder = document.createElement("li");
                          let status: string = "unknown";
                          switch (state.capture.status) {
                              case CommandCaptureStatus.Deprecated:

                    Function readUniformFromContext has a Cognitive Complexity of 20 (exceeds 5 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

                    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 a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected getTextureVisualState(target: WebGlConstant, storage: WebGLTexture, info: ITextureRecorderData, pixelated: boolean): any {
                            try {
                                const gl = this.context;
                                const visual: any = {};
                    
                    
                    Severity: Minor
                    Found in src/backend/states/drawCalls/drawCallTextureInputState.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 constructor has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        constructor(private readonly options: ICaptureMenuOptions = {}) {
                            this.rootPlaceHolder = options.rootPlaceHolder || document.body;
                            this.mvx = new MVX(this.rootPlaceHolder);
                    
                            this.isTrackingCanvas = false;
                    Severity: Major
                    Found in src/embeddedFrontend/captureMenu/captureMenu.ts - About 2 hrs to fix

                      Function getStackTrace has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static getStackTrace(removeFirstNCalls = 0, removeLastNCalls = 0): string[] {
                              const callstack: string[] = [];
                      
                              try {
                                  throw new Error("Errorator.");
                      Severity: Major
                      Found in src/shared/utils/stackTrace.ts - About 2 hrs to fix

                        Function update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected update(functionInformation: IFunctionInformation, target: string, instance: WebGLTexture): number {
                                const customData = this.getCustomData(functionInformation, target, instance);
                                if (!customData) {
                                    return 0;
                                }
                        Severity: Minor
                        Found in src/backend/recorders/texture2DRecorder.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 createScene has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var createScene = function (engine, canvas) {
                            var scene = new BABYLON.Scene(engine);
                        
                            var camera = new BABYLON.ArcRotateCamera("camera1", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
                        
                        
                        Severity: Major
                        Found in sample/js/renderTargetTexture.js - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language