nirnanaaa/gollum_rails

View on GitHub

Showing 6 of 6 total issues

Method install_languages has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def install_languages
        case language
        when "ascii"
          puts <<-EOT
          \n Installation instructures for ASCIIDoc:\n
Severity: Major
Found in lib/generators/gollum_rails/language/language_generator.rb - About 2 hrs to fix

    Method build has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def build(new_attributes = nil, &block)
            if block_given?
              yield self
            else
              if !new_attributes.respond_to?(:stringify_keys)
    Severity: Minor
    Found in lib/gollum_rails/setup.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 validate! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate!(tempfile)
          if self.class.max_size
            raise FileTooBigError,
              "File is too big. Max. size is #{self.class.max_size}" if tempfile.size > self.class.max_size
          end
    Severity: Minor
    Found in lib/gollum_rails/upload.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 save! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def save!
          if self.file
            fullname = Gollum::Page.cname(self.file.original_filename)
            tempfile = self.file
            validate! tempfile
    Severity: Minor
    Found in lib/gollum_rails/upload.rb - About 1 hr to fix

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

            def find(name, version=nil, folder_reset=false, exact=true)
              name = name[:name] if name.kind_of?(Hash) && name.has_key?(:name)
              Page.reset_folder if folder_reset
              wiki.clear_cache
              path = File.split(name)
      Severity: Minor
      Found in lib/gollum_rails/finders.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 save! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def save!
            if self.file
              fullname = Gollum::Page.cname(self.file.original_filename)
              tempfile = self.file
              validate! tempfile
      Severity: Minor
      Found in lib/gollum_rails/upload.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