TyrealGray/Qin.js

View on GitHub

Showing 19 of 32 total issues

Function _update has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async _update(delta: number, tick: number): Promise<void> {
        const { terrainInfo, npcInfo, gameInfo, eventTimeInfo } = this._storeData;

        const rules = await this.getRules();

Severity: Major
Found in packages/qin.js/src/core/reactorCore/Reactor.js - About 2 hrs to fix

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

    export const checkCondition = (
        data: Object,
        conditions: Object,
        condition: string,
        checkCallback: (Object, Object) => boolean,
    Severity: Minor
    Found in packages/qin.js/src/core/reactorCore/conditionCheck.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

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

    const commonReact = (data: Object, reaction: Object, action:{type: string, triggerBy: any, triggerTo: any, stamp: { seed: string, time: number }}): void => {
        const { peeledPropArray } = peelPropsString(reaction.attribute);
    
        let value = data;
        let accessProp = null;
    Severity: Minor
    Found in packages/qin.js/src/core/reactorCore/processReaction.js - About 1 hr to fix

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

          static getCorrectNode(
              paths: Array<PathNode>,
          ): {
              node: PathNode | null,
              closedPaths: Array<PathNode>,

        Function getCorrectPath has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            getCorrectPath(startNode: PathNode): Array<Grid> {
                const pathNodes = startNode.getNeighbors();
                const scannedPaths: Array<PathNode> = [startNode];
                const correctPath = [];
        
        

          Function _initMouseEvent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _initMouseEvent() {
          
                  this._initControllerEvent();
          
                  this._renderer.stage.mousedown = (e) => {
          Severity: Minor
          Found in packages/qin-renderer.js/src/render/QinStageAgent.js - About 1 hr to fix

            Function getCorrectNode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                static getCorrectNode(
                    paths: Array<PathNode>,
                ): {
                    node: PathNode | null,
                    closedPaths: Array<PathNode>,

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

            const commonReact = (data: Object, reaction: Object, action:{type: string, triggerBy: any, triggerTo: any, stamp: { seed: string, time: number }}): void => {
                const { peeledPropArray } = peelPropsString(reaction.attribute);
            
                let value = data;
                let accessProp = null;
            Severity: Minor
            Found in packages/qin.js/src/core/reactorCore/processReaction.js - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                        if (
                                            trigger.triggerLimit &&
                                            !eventTimeInfo.dataSet[trigger.name]
                                        ) {
                                            await this._store.dispatch({
            Severity: Major
            Found in packages/qin.js/src/core/reactorCore/Reactor.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (trigger.triggerLimit) {
                                              await this._store.dispatch({
                                                  type: RECORD_EVENT_TIME,
                                                  name: trigger.name,
                                                  time: tick + trigger.triggerLimit,
              Severity: Major
              Found in packages/qin.js/src/core/reactorCore/Reactor.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                            if (!conditionInfo) {
                                                continue;
                                            }
                Severity: Major
                Found in packages/qin.js/src/core/reactorCore/Reactor.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if(trigger.rate && !checkChanceByTicker({seed: gameInfo.seed, time: tick}, trigger.rate)){
                                                  continue;
                                              }
                  Severity: Major
                  Found in packages/qin.js/src/core/reactorCore/Reactor.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (
                                                    eventTimeInfo.dataSet[trigger.name] &&
                                                    tick <
                                                    eventTimeInfo.dataSet[trigger.name].time
                                                ) {
                    Severity: Major
                    Found in packages/qin.js/src/core/reactorCore/Reactor.js - About 45 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                      if (
                                          (onlyDirect && triggerTo?.qinId !== data.qinId)
                                          || blockers.includes(triggerBy.qinId)
                                          || (!isAny && !types.includes(triggerBy.type) && !triggers.includes(triggerBy.qinId))
                                      ) {
                      Severity: Major
                      Found in packages/qin.js/src/core/reactorCore/reduxCore/reducers/terrainInfo.js - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                                        if (
                                            (onlyDirect && triggerTo?.qinId !== data.qinId)
                                            || blockers.includes(triggerBy.qinId)
                                            || (!isAny && !types.includes(triggerBy.type) && !triggers.includes(triggerBy.qinId))
                                        ) {
                        Severity: Major
                        Found in packages/qin.js/src/core/reactorCore/reduxCore/reducers/characterInfo.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                                          if (
                                              (onlyDirect && triggerTo?.qinId !== data.qinId)
                                              || blockers.includes(triggerBy.qinId)
                                              || (!isAny && !types.includes(triggerBy.type) && !triggers.includes(triggerBy.qinId))
                                          ) {
                          Severity: Major
                          Found in packages/qin.js/src/core/reactorCore/reduxCore/reducers/npcInfo.js - About 40 mins to fix

                            Function getCorrectPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                getCorrectPath(startNode: PathNode): Array<Grid> {
                                    const pathNodes = startNode.getNeighbors();
                                    const scannedPaths: Array<PathNode> = [startNode];
                                    const correctPath = [];
                            
                            

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

                            const dynamicReact = (data: Object, reaction: Object, action:{type: string, triggerBy: any, triggerTo: any, stamp: { seed: string, time: number }}): void => {
                                if (typeof reaction.rate !== 'undefined' && !checkChance(data, reaction, action.stamp)) {
                                    return;
                                }
                            
                            
                            Severity: Minor
                            Found in packages/qin.js/src/core/reactorCore/processReaction.js - About 25 mins 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 _prepareAssets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                _prepareAssets(assetsSet: Array<AnimationAssetType>) {
                                    let loader = PIXI.Loader.shared;
                                    loader.reset();
                            
                                    for (let assetsData of assetsSet) {
                            Severity: Minor
                            Found in packages/qin-renderer.js/src/render/QinRenderer.js - About 25 mins 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