threefunkymonkeys/chist

View on GitHub

Showing 15 of 15 total issues

Method parse has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def self.parse(log)
    time_regexp = /^.*\s*\[\d+:\d{2}\s*[AMP]{2}*\]\s*/

    #scan for participants
    participants = log.each_line.grep(/.+\s\[\d{1,2}:\d{1,2}\s*[AMP]{0,2}\].+/).collect{ |capture| capture.split(" [").first }.uniq
Severity: Minor
Found in lib/parser/slack_parser.rb - About 2 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 parse has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.parse(log)
    time_regexp = /^.*\s*\[\d+:\d{2}\s*[AMP]{2}*\]\s*/

    #scan for participants
    participants = log.each_line.grep(/.+\s\[\d{1,2}:\d{1,2}\s*[AMP]{0,2}\].+/).collect{ |capture| capture.split(" [").first }.uniq
Severity: Minor
Found in lib/parser/slack_parser.rb - About 1 hr to fix

    Method to_signup_hash has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def to_signup_hash
          {
            uid:   uid || '',
            name:  self.respond_to?(:extra) && extra.respond_to?(:name) && !extra.name.empty? ? extra.name : \
                  (self.respond_to?(:info) && info.respond_to?(:name) && !info.name.empty? ? info.name : ''),
    Severity: Minor
    Found in lib/omniauth_auth_hash.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 call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def call
          if @user
            return :provider_duplicated if @user.has_provider?(@provider)
            return :provider_added if @user.add_provider(@provider, @auth_info.uid)
          elsif @user = User.find(:"#{@provider}_user" => @auth_info.uid)
    Severity: Minor
    Found in context/provider_auth.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 show_flash_message has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def show_flash_message
          markup = []
    
          if flash.has_key?(:info)
            markup << "<div class='alert alert-dismissable alert-info'>
    Severity: Minor
    Found in helpers/view_helper.rb - About 1 hr to fix

      Method call has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def call
            if @user
              return :provider_duplicated if @user.has_provider?(@provider)
              return :provider_added if @user.add_provider(@provider, @auth_info.uid)
            elsif @user = User.find(:"#{@provider}_user" => @auth_info.uid)
      Severity: Minor
      Found in context/provider_auth.rb - About 1 hr to fix

        Method parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.parse(log)
            output = ""
            members = []
            classes = {}
            log.split(/\n\r?/).each do |line|
        Severity: Minor
        Found in lib/parser/limechat_parser.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

        Avoid too many return statements within this method.
        Open

                    return :account_exists
        Severity: Major
        Found in context/provider_auth.rb - About 30 mins to fix

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

            } else {
                _this.removeClass('public').addClass('private').html('Private');
                $('#public_chist').val(0);
            }
          Severity: Minor
          Found in public/js/chist.js and 1 other location - About 30 mins to fix
          public/js/chist.js on lines 101..104

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

          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

          Avoid too many return statements within this method.
          Open

                      return :user_created
          Severity: Major
          Found in context/provider_auth.rb - About 30 mins to fix

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

              if (_this.hasClass('private')){
                  _this.removeClass('private').addClass('public').html('Public');
                  $('#public_chist').val(1);
              } else {
            Severity: Minor
            Found in public/js/chist.js and 1 other location - About 30 mins to fix
            public/js/chist.js on lines 104..107

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

            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

                    email: self.respond_to?(:extra) && extra.respond_to?(:email) && !extra.email.empty? ? extra.email : \
                          (self.respond_to?(:info) && info.respond_to?(:email) && !info.email.empty? ? info.email : ''),
            Severity: Minor
            Found in lib/omniauth_auth_hash.rb and 1 other location - About 25 mins to fix
            lib/omniauth_auth_hash.rb on lines 6..7

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

            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

                    name:  self.respond_to?(:extra) && extra.respond_to?(:name) && !extra.name.empty? ? extra.name : \
                          (self.respond_to?(:info) && info.respond_to?(:name) && !info.name.empty? ? info.name : ''),
            Severity: Minor
            Found in lib/omniauth_auth_hash.rb and 1 other location - About 25 mins to fix
            lib/omniauth_auth_hash.rb on lines 8..9

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

            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

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

                def self.connection_path(settings)
                  "postgres://#{settings['user']}:#{settings['password']}@#{settings['host']}:#{settings['port']}/#{settings['db_name']}"
            Severity: Minor
            Found in lib/chist.rb and 1 other location - About 20 mins to fix
            lib/monkeymailer/mm-sequel.rb on lines 30..31

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

            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

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

                def self.connection_path(settings)
                  "postgres://#{settings['user']}:#{settings['password']}@#{settings['host']}:#{settings['port']}/#{settings['db_name']}"
            Severity: Minor
            Found in lib/monkeymailer/mm-sequel.rb and 1 other location - About 20 mins to fix
            lib/chist.rb on lines 27..28

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

            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