NullVoxPopuli/meshchat

View on GitHub

Showing 6 of 137 total issues

Method for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def for(location: nil, uid: nil, node: nil)
        unless node
          node = Node.find_by_location_on_network(location) if location
          node = Node.find_by_uid(uid) if uid && !node
        end
Severity: Minor
Found in lib/meshchat/models/node.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 update_sender_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def update_sender_info(json)
          sender = json['sender']
          # Note that sender['location'] should always reference
          # the sender's local network address
          network_location = sender['location']
Severity: Minor
Found in lib/meshchat/network/incoming/message_processor.rb - 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

Method errors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def errors
        messages = []
        messages << 'must have an alias' unless self['alias'].present?
        messages << 'must have ip set' unless self['ip'].present?
        messages << 'must have port set' unless self['port'].present?
Severity: Minor
Found in lib/meshchat/configuration/settings.rb - 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

Method handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def handle
          if command_valid?
            msg = _message_factory.create(Network::Message::PING)

            field, value = parse_ping_command
Severity: Minor
Found in lib/meshchat/ui/command/ping.rb - 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

Method check_or_create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def check_or_create(overwrite = false, auto_confirm = false)
        # if setup is complete, we don't need to do anything.
        # it's likely the user already went through the setup process
        return if setup_is_completed? && !overwrite

Severity: Minor
Found in lib/meshchat/configuration/identity.rb - 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

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

        def handle
          if command_valid?
            node = Node.import_from_file(filename)
            if node.valid? && node.persisted?
              Display.success "#{node.alias_name} successfully imported"
Severity: Minor
Found in lib/meshchat/ui/command/import.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

Severity
Category
Status
Source
Language