Wonder-Technology/Wonder.js

View on GitHub

Showing 43 of 43 total issues

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

function _buildAndSetSceneDescBufferData(device, allRenderGameObjects, allRenderGeometries, allRenderBSDFMaterials) {
  var gameObjectCount = ListSt$Wonderjs.length(allRenderGameObjects);
  var bufferData = new Float32Array((gameObjectCount << 5));
  var bufferSize = bufferData.byteLength;
  var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined);

    Function _buildWebGPUObjects has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function _buildWebGPUObjects(device, param) {
      var layerCount = param[2];
      var format = "rgba8unorm";
      var textureArray = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createTexture, {
            size: {

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

      function buildPerspective(resultFloat32Arr, param) {
        var far = param[3];
        var near = param[2];
        var aspect = param[1];
        var fovy = param[0];

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

        function _buildAndSetPointIndexBufferData(device, allRenderGeometries) {
          var geometryCount = ListSt$Wonderjs.length(allRenderGeometries);
          var bufferData = new Uint32Array((geometryCount << 1));
          var bufferSize = bufferData.byteLength;
          var buffer = StorageBufferVO$Wonderjs.createFromDevice(device, bufferSize, WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.copy_dst | WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).bufferUsage.storage, undefined);

          Function _createAndSetPipeline has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function _createAndSetPipeline(device, swapChainFormat, bindGroupLayout) {
            var baseShaderPath = "src/domain_layer/domain/shader/accumulation";
            var vertexShaderModule = Curry._2(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).device.createShaderModule, {
                  code: Curry._1(WebGPUCoreDpRunAPI$Wonderjs.unsafeGet(undefined).loadGLSL, "" + baseShaderPath + "/accumulation.vert")
                }, device);

            Function getEulerAngles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getEulerAngles(matTypeArr) {
              var match = getScaleTuple(matTypeArr);
              var sy = match[1];
              var sx = match[0];
              var a00 = matTypeArr[0];

              Function _buildDirectionLightBufferData has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function _buildDirectionLightBufferData(device, sceneGameObject) {
                return Result$Wonderjs.bind(Contract$Wonderjs.requireCheck((function (param) {
                                  return Contract$Wonderjs.test(Log$Wonderjs.buildAssertMessage("only has one direction light", "not"), (function (param) {
                                                return Contract$Wonderjs.Operators.$eq(DirectionLightRunAPI$Wonderjs.getLightCount(sceneGameObject), 1);
                                              }));

                Function _getRenderPipelineJobs has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function _getRenderPipelineJobs(param) {
                  return {
                          hd: [
                            RenderPathTracingCPJobEntity$Wonderjs.create(undefined),
                            RenderPathTracingCPJobEntity$Wonderjs.exec

                  Function _computeMapScale has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function _computeMapScale(mapImageIdOpt) {
                    var defaultScale = [
                      1.0,
                      1.0
                    ];

                    Function exec has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function exec(param) {
                      return Most.just(Result$Wonderjs.bind(Tuple3$Wonderjs.collectOption(WebGPUCPRepo$Wonderjs.getWindow(undefined), WebGPUCPRepo$Wonderjs.getDevice(undefined), WebGPUCPRepo$Wonderjs.getSwapChainFormat(undefined)), (function (param) {
                                        var swapChainFormat = param[2];
                                        var device = param[1];
                                        AccumulationPassCPRepo$Wonderjs.setAccumulationPixelBufferData(_buildAccumulationPixelBufferData(param[0], device));

                      Function _createInstances has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function _createInstances(geometryContainerMap) {
                        return Result$Wonderjs.mapSuccess(Result$Wonderjs.mapSuccess(ListSt$Wonderjs.traverseResultM(GameObjectRunAPI$Wonderjs.getAllRenderGameObjects(SceneRoot$Wonderjs.getSceneGameObject(undefined)), (function (gameObject) {
                                              return Tuple2$Wonderjs.collectOption(GameObjectRunAPI$Wonderjs.getTransform(gameObject), OptionSt$Wonderjs.flatMap(GameObjectRunAPI$Wonderjs.getGeometry(gameObject), (function (geometry) {
                                                                return ImmutableSparseMap$Wonderjs.get(geometryContainerMap, OperateGeometryDoService$Wonderjs.getId(geometry));
                                                              })));

                        Function setFromMatrix has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        var setFromMatrix = ((matrixTypeArray) => {
                                    var m00, m01, m02, m10, m11, m12, m20, m21, m22,
                                        tr, s, rs, lx, ly, lz, m;
                                        var x,y,z,w;
                        
                        

                        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 _updateCameraBuffer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function _updateCameraBuffer(param) {
                          var far = param[3];
                          var near = param[2];
                          var projectionInverse = param[1];
                          var viewInverse = param[0];

                          Consider simplifying this complex logical expression.
                          Open

                            if (optionData1 !== undefined && optionData2 !== undefined && optionData3 !== undefined && optionData4 !== undefined && optionData5 !== undefined && optionData6 !== undefined && optionData7 !== undefined) {
                              return Result$Wonderjs.succeed([
                                          Caml_option.valFromOption(optionData1),
                                          Caml_option.valFromOption(optionData2),
                                          Caml_option.valFromOption(optionData3),

                            Function collectOption has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            function collectOption(optionData1, optionData2, optionData3, optionData4, optionData5, optionData6, optionData7) {
                            Severity: Major
                            Found in lib/js/src/construct/domain_layer/library/structure/tuple/Tuple7.bs.js - About 50 mins to fix

                              Function collectResult has 7 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function collectResult(resultData1, resultData2, resultData3, resultData4, resultData5, resultData6, resultData7) {
                              Severity: Major
                              Found in lib/js/src/construct/domain_layer/library/structure/tuple/Tuple7.bs.js - About 50 mins to fix

                                Function collectOption has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                function collectOption(optionData1, optionData2, optionData3, optionData4, optionData5, optionData6) {
                                Severity: Minor
                                Found in lib/js/src/construct/domain_layer/library/structure/tuple/Tuple6.bs.js - About 45 mins to fix

                                  Function collectResult has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                  function collectResult(resultData1, resultData2, resultData3, resultData4, resultData5, resultData6) {
                                  Severity: Minor
                                  Found in lib/js/src/construct/domain_layer/library/structure/tuple/Tuple6.bs.js - About 45 mins to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                      if (optionData1 !== undefined && optionData2 !== undefined && optionData3 !== undefined && optionData4 !== undefined && optionData5 !== undefined && optionData6 !== undefined) {
                                        return Result$Wonderjs.succeed([
                                                    Caml_option.valFromOption(optionData1),
                                                    Caml_option.valFromOption(optionData2),
                                                    Caml_option.valFromOption(optionData3),
                                    Severity: Major
                                    Found in lib/js/src/construct/domain_layer/library/structure/tuple/Tuple6.bs.js - About 40 mins to fix

                                      Function collectResult has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                      function collectResult(resultData1, resultData2, resultData3, resultData4, resultData5) {
                                      Severity: Minor
                                      Found in lib/js/src/construct/domain_layer/library/structure/tuple/Tuple5.bs.js - About 35 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language