mgleon08/slack_neuralyzer

View on GitHub

Showing 3 of 92 total issues

Method clean_channel_messages has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

      def clean_channel_messages(channel_id, user_id, end_point)
        has_more = true

        while has_more
          res = Slack.public_send(end_point, channel: channel_id, oldest: start_time, latest: end_time)
Severity: Minor
Found in lib/slack_neuralyzer/cleaner/messages.rb - About 4 hrs 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 clean_channel_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def clean_channel_file(channel_id, user_id)
        page, total_page = 0, nil
        until page == total_page
          page += 1
          res = Slack.files_list(page: page, channel: channel_id, types: args.file, ts_from: start_time, ts_to: end_time)
Severity: Minor
Found in lib/slack_neuralyzer/cleaner/files.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 get_channel_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_channel_id
        if args.channel
          @channel_type = 'channel'
          channel_id    = dict.find_channel_id(args.channel)
        elsif args.direct
Severity: Minor
Found in lib/slack_neuralyzer/cleaner/base.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