BlackDice/b3-chief

View on GitHub

Showing 16 of 43 total issues

Function setup has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function setup(store) {
    const Adapter = methods({
        set(property, value) {
            store.actions.updateSubject({
                id: this.getId(),
Severity: Major
Found in src/SubjectModel.js - About 2 hrs to fix

    Function setup has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function setup(store, treeId) {
        const Adapter = methods({
            set(property, value) {
                store.actions.updateTreeNode({
                    nodeId: this.getId(),
    Severity: Major
    Found in src/NodeModel.js - About 2 hrs to fix

      Function initialize has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function initialize(Model, select) {
          const ModelType = Model.getModelType()
      
          const isModelInstance = (possibleInstance) => (
              t.Nil.is(possibleInstance) === false &&
      Severity: Major
      Found in src/core/ModelList.js - About 2 hrs to fix

        Function setup has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function setup(store) {
            const Adapter = methods({
                getNodes() {
                    throw new Error(oneLine`
                        Collection of nodes of tree cannot be directly read.
        Severity: Major
        Found in src/TreeModel.js - About 2 hrs to fix

          Function Model has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function Model(ModelType, Adapter) {
              const ModelAdapter = methods({
                  get(property, dataSource) {
                      const modelData = dataSource()
          
          
          Severity: Major
          Found in src/core/Model.js - About 2 hrs to fix

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

            function sync(watchRemote = false) {
                invariant(syncedInstances.has(this.chief) === false, oneLine`
                    The Chief %s is already synced with firebase %s
                `, this.chief.id, this.firebaseRef.toString())
            
            
            Severity: Minor
            Found in src/adapter/FirebaseAdapter.js - About 1 hr to fix

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

              function applySubjectMemory(subject, memoryId, key, value) {
                  let result = subject
              
                  if (MemoryDictionary.is(subject.memories) === false) {
                      result = t.update(result, {
              Severity: Minor
              Found in src/providers/subjects.js - About 1 hr to fix

                Function initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                export default function initialize(Model, select) {
                    const ModelType = Model.getModelType()
                
                    const isModelInstance = (possibleInstance) => (
                        t.Nil.is(possibleInstance) === false &&
                Severity: Minor
                Found in src/core/ModelList.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

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

                function execute(executionNode, executionContext, executionTick) {
                    const { memory, status: { ERROR, RUNNING }} = executionContext
                
                    if (executeEnter(executionNode, executionContext) === ERROR) {
                        return ERROR
                Severity: Minor
                Found in src/Execution.js - About 35 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 buildExecutionTree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function buildExecutionTree(tree, buildExecutionNode) {
                    const treeId = tree.getId()
                    const nodes = tree.listNodes()
                    const executionNodes = nodes.map(buildExecutionNode)
                    const executionNodeMap = executionNodes.reduce(convertToNodeMap, {})
                Severity: Minor
                Found in src/Execution.js - About 35 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 tick has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    tick({ status, memory }, { children }) {
                        const childrenCount = children.length
                
                        let childIndex = memory.get('runningChild') || initialChildIndex
                
                
                Severity: Minor
                Found in src/behaviors/MemSequence.js - About 35 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 tick has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    tick({ status, memory }, { children }) {
                        const childrenCount = children.length
                
                        let childIndex = memory.get('runningChild') || initialChildIndex
                
                
                Severity: Minor
                Found in src/behaviors/MemSelector.js - About 35 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 initializeMemoryModel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function initializeMemoryModel({ store, subjectId, memoryId }) {
                    invariant(store, oneLine`
                        Memory model is expecting store instance
                    `)
                
                
                Severity: Minor
                Found in src/MemoryModel.js - About 35 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 too many return statements within this function.
                Open

                    return tickStatus
                Severity: Major
                Found in src/Execution.js - About 30 mins to fix

                  Function planExecution has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function planExecution(toolboxFactory = () => null, onError = log) {
                      const getExecutionRootNode = ObjectCache(
                          buildExecutionTree, (tree) => tree.getId(),
                      )
                  
                  
                  Severity: Minor
                  Found in src/Execution.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 tick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      tick({ status, memory, config }, { child }) {
                          const { maxLoop } = config
                  
                          let currentLoop = memory.get('currentLoop')
                          let resultStatus = status.SUCCESS
                  Severity: Minor
                  Found in src/behaviors/Repeater.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