jordimassaguerpla/gems-status

View on GitHub

Showing 12 of 12 total issues

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

    def Utils.download_license(name, version, gems_url)
      version = version.to_s if version.is_a? Gem::Version
      key = "#{name}-#{version}-#{gems_url.gsub("/", "_").gsub(":", "_")}"
      return @@licenses[key] if @@licenses[key]
      begin
Severity: Minor
Found in lib/gems-status/utils.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 download_emails has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def Utils.download_emails(email_username, email_password, mailing_lists)
      begin
        self.get_emails_from_fs if @@emails.nil?
      rescue Exception => e
        self.log_error "", "There was a problem getting emails from filesystem #{e.message}"
Severity: Minor
Found in lib/gems-status/utils.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 download_emails has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def Utils.download_emails(email_username, email_password, mailing_lists)
      begin
        self.get_emails_from_fs if @@emails.nil?
      rescue Exception => e
        self.log_error "", "There was a problem getting emails from filesystem #{e.message}"
Severity: Minor
Found in lib/gems-status/utils.rb - About 1 hr to fix

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

        def execute
          return unless @source
          @gem_list = @source.gem_list
          @checkers.each do |check_object|
            Utils::log_debug "checking #{check_object.class.name}"
    Severity: Minor
    Found in lib/gems-status/runner.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_emails_from_fs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def Utils.get_emails_from_fs
          @@emails = {}
          Dir.glob("#{EMAIL_TMP_PATH}/**/*").each do |filename|
            next unless File.file?(filename)
            open(filename, "r") do |file|
    Severity: Minor
    Found in lib/gems-status/utils.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(name, version, md5, origin, gems_url=nil, dependencies = nil )
    Severity: Minor
    Found in lib/gems-status/gem_simple.rb - About 45 mins to fix

      Method check_messages has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def check_messages(name, source_repo, message_checker, origin, counter = 0)
      Severity: Minor
      Found in lib/gems-status/checkers/scm_check_messages.rb - About 35 mins to fix

        Method send_email has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def Utils.send_email(email_receiver, email_username, email_password, name, mssg)
        Severity: Minor
        Found in lib/gems-status/utils.rb - About 35 mins to fix

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

              def security_alerts(name, commits, message_checker, origin)
                results = {}
                commits.each do |commit|
                  if message_checker.check_message?(message(commit))
                    Utils::log_debug "#{message(commit)}"
          Severity: Minor
          Found in lib/gems-status/checkers/scm_check_messages.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 download_gem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def Utils.download_gem(name, version, gems_url)
                gem_uri = URI.parse("#{gems_url}/#{name}-#{version}.gem")
                tmp_path = "tmp/utils/gems/#{gems_url.gsub("/", "_").gsub(":", "_")}/"
                gem_name = "#{name}-#{version}.gem"
                full_path = "#{tmp_path}/#{gem_name}"
          Severity: Minor
          Found in lib/gems-status/utils.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 look_for_security_messages has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

             def look_for_security_messages(name, source_repo, origin, counter = 0)
                Utils::log_debug "looking for security messages on #{source_repo}"
                if ! File.exists?("build_security_messages_check")
                  Utils::log_debug "creating build_security_messages_check in #{Dir.pwd}"
                  Dir.mkdir("build_security_messages_check")
          Severity: Minor
          Found in lib/gems-status/checkers/not_a_security_alert_checker.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 look_in_emails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def look_in_emails(gem)
                @emails.each do |listname, emails|
                  emails.each do |email|
                    if listname.strip == "rubyonrails-security@googlegroups.com" && gem.name == "rails" 
                      @security_messages[key_for_emails(listname, gem, email)] = SecurityAlert.new(email.subject)
          Severity: Minor
          Found in lib/gems-status/checkers/not_a_security_alert_checker.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