BlackDice/b3-chief

View on GitHub

Showing 43 of 43 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    updateTree(state, { payload: { id, property, value }}) {
        return t.update(state, {
            [id]: { [property]: { $set: value }},
        })
    },
Severity: Major
Found in src/providers/trees.js and 2 other locations - About 1 hr to fix
src/providers/behaviors.js on lines 30..34
src/providers/subjects.js on lines 45..49

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    updateBehavior(state, { payload: { id, property, value }}) {
        return t.update(state, {
            [id]: { [property]: { $set: value }},
        })
    },
Severity: Major
Found in src/providers/behaviors.js and 2 other locations - About 1 hr to fix
src/providers/subjects.js on lines 45..49
src/providers/trees.js on lines 44..48

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  changeParent(parentId) {
                      store.actions.updateTreeNode({
                          treeId,
                          nodeId: this.getId(),
                          property: 'parentId',
      Severity: Minor
      Found in src/NodeModel.js and 1 other location - About 50 mins to fix
      src/NodeModel.js on lines 61..68

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  changeChildIndex(childIndex) {
                      store.actions.updateTreeNode({
                          treeId,
                          nodeId: this.getId(),
                          property: 'childIndex',
      Severity: Minor
      Found in src/NodeModel.js and 1 other location - About 50 mins to fix
      src/NodeModel.js on lines 53..60

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              set(property, value) {
                  store.actions.updateTree({
                      id: this.getId(),
                      property,
                      value,
      Severity: Minor
      Found in src/TreeModel.js and 2 other locations - About 40 mins to fix
      src/BehaviorModel.js on lines 19..25
      src/SubjectModel.js on lines 16..22

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 48.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              set(property, value) {
                  store.actions.updateBehavior({
                      id: this.getId(),
                      property,
                      value,
      Severity: Minor
      Found in src/BehaviorModel.js and 2 other locations - About 40 mins to fix
      src/SubjectModel.js on lines 16..22
      src/TreeModel.js on lines 20..26

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 48.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              set(property, value) {
                  store.actions.updateSubject({
                      id: this.getId(),
                      property,
                      value,
      Severity: Minor
      Found in src/SubjectModel.js and 2 other locations - About 40 mins to fix
      src/BehaviorModel.js on lines 19..25
      src/TreeModel.js on lines 20..26

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 48.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      const behavior = {
          name: 'Limiter',
          type: BEHAVIOR_TYPE.DECORATOR,
          description: oneLine`
              This decorator limit the number of times its child can be called. After a
      Severity: Minor
      Found in src/behaviors/Limiter.js and 1 other location - About 35 mins to fix
      src/behaviors/MaxTime.js on lines 6..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      const behavior = {
          name: 'RepeatUntilSuccess',
          type: BEHAVIOR_TYPE.DECORATOR,
          description: oneLine`
              RepeatUntilSuccess is a decorator that repeats the tick signal until the
      Severity: Minor
      Found in src/behaviors/RepeatUntilSuccess.js and 2 other locations - About 35 mins to fix
      src/behaviors/RepeatUntilFailure.js on lines 7..18
      src/behaviors/Repeater.js on lines 7..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      const behavior = {
          name: 'RepeatUntilFailure',
          type: BEHAVIOR_TYPE.DECORATOR,
          description: oneLine`
              RepeatUntilFailure is a decorator that repeats the tick signal until the
      Severity: Minor
      Found in src/behaviors/RepeatUntilFailure.js and 2 other locations - About 35 mins to fix
      src/behaviors/RepeatUntilSuccess.js on lines 7..18
      src/behaviors/Repeater.js on lines 7..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

      const behavior = {
          name: 'Repeater',
          type: BEHAVIOR_TYPE.DECORATOR,
          description: oneLine`
              Repeater is a decorator that repeats execution of its child until that child
      Severity: Minor
      Found in src/behaviors/Repeater.js and 2 other locations - About 35 mins to fix
      src/behaviors/RepeatUntilFailure.js on lines 7..18
      src/behaviors/RepeatUntilSuccess.js on lines 7..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      const behavior = {
          name: 'MaxTime',
          type: BEHAVIOR_TYPE.DECORATOR,
          description: oneLine`
              The MaxTime decorator limits the maximum time the node child can execute.
      Severity: Minor
      Found in src/behaviors/MaxTime.js and 1 other location - About 35 mins to fix
      src/behaviors/Limiter.js on lines 7..18

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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 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 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

      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 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

      Severity
      Category
      Status
      Source
      Language