Showing 10 of 10 total issues

Method track_changes_in_object has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def track_changes_in_object(object)
        state = self
        is_untracked = !object.instance_variable_defined?('@fie_tracked')

        if is_untracked
Severity: Minor
Found in lib/fie/state/track.rb - 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

Method untrack_changes_in_object has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def untrack_changes_in_object(object)
        is_tracked = object.instance_variable_defined?('@fie_tracked')

        if is_tracked
          object.methods.each do |attribute_name, attribute_value|
Severity: Minor
Found in lib/fie/state/track.rb - 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

Method track_changes_in_array has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def track_changes_in_array(object)
        state = self

        unless object.frozen?
          object.class_eval do
Severity: Minor
Found in lib/fie/state/track.rb - About 1 hr to fix

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

      processCommand(command, parameters = {}) {
        switch(command) {
          case 'refresh_view':
            innerHTML(document.querySelector('[fie-body=true]'), parameters.html);
            const event = new Event(this.eventName);
    Severity: Minor
    Found in lib/javascript/fie/commander.js - About 1 hr to fix

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

        _diffSetup() {
          polyfill();
      
          use(
            Object.assign(_ => {}, {
      Severity: Minor
      Found in lib/javascript/fie.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

      Method traverse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def traverse(changelog:, object:, node_name:, changelog_node:)
              if object.is_a?(Array)
                node_name = node_name.to_i
                object_node = object[node_name]
              elsif object.is_a?(Hash)
      Severity: Minor
      Found in lib/fie/state/changelog.rb - 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

      Method update_object_using_changelog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_object_using_changelog(changelog, object = self)
            unless changelog.blank?
              changelog.each do |node_name, _|
                changelog_node = changelog[node_name]
                is_not_end_of_tree = changelog_node.is_a? Hash
      Severity: Minor
      Found in lib/fie/state/changelog.rb - 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

      Method update_object_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def update_object_value(object:, node_name:, value:)
              if object.is_a?(Array)
                node_name = node_name.to_i
                object[node_name] = value
              elsif object.is_a?(Hash)
      Severity: Minor
      Found in lib/fie/state/changelog.rb - 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

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

          def track_changes_in_objects(object)
            if object.is_a?(Array)
              track_changes_in_array(object)
            elsif object.is_a?(Hash)
              track_changes_in_hash(object)
      Severity: Minor
      Found in lib/fie/state/track.rb and 1 other location - About 25 mins to fix
      lib/fie/state/track.rb on lines 15..24

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

      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

          def untrack_changes_in_objects(object)
            if object.is_a? Hash
              untrack_changes_in_hash(object)
            elsif object.is_a? Array
              untrack_changes_in_array(object)
      Severity: Minor
      Found in lib/fie/state/track.rb and 1 other location - About 25 mins to fix
      lib/fie/state/track.rb on lines 3..12

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

      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

      Severity
      Category
      Status
      Source
      Language