evinsou/paperclip-googledrive

View on GitHub

Showing 5 of 5 total issues

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

      def flush_writes
        @queued_for_write.each do |style, file|
          if exists?(path(style))
            raise FileExists, "file \"#{path(style)}\" already exists in your Google Drive"
          else
Severity: Minor
Found in lib/paperclip/storage/google_drive.rb - About 1 hr to fix

    Method authorize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def authorize
            puts 'Enter client ID:'
            client_id = $stdin.gets.chomp
            puts 'Enter client SECRET:'
            client_secret = $stdin.gets.chomp.strip
    Severity: Minor
    Found in lib/paperclip/google_drive/rake.rb - About 1 hr to fix

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

            def url(*args)
              if present?
                style = args.first.is_a?(Symbol) ? args.first : default_style
                options = args.last.is_a?(Hash) ? args.last : {}
                public_url_for(path(style))
      Severity: Minor
      Found in lib/paperclip/storage/google_drive.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 extended has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.extended(base)
              begin
                require 'google-api-client'
              rescue LoadError => e
                e.message << " (You may need to install the google-api-client gem)"
      Severity: Minor
      Found in lib/paperclip/storage/google_drive.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 flush_writes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def flush_writes
              @queued_for_write.each do |style, file|
                if exists?(path(style))
                  raise FileExists, "file \"#{path(style)}\" already exists in your Google Drive"
                else
      Severity: Minor
      Found in lib/paperclip/storage/google_drive.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