pouyana/gutenbergtranslator

View on GitHub

Showing 5 of 7 total issues

Method initilize has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initilize(gutenberg,licence,ebook_number,title,author,illustrator,release_date,lang,charset,size)
Severity: Major
Found in app/helpers/text_to_paragraphs.rb - About 1 hr to fix

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

      def dataMiner
        wikidata = Hash.new
        setHasArticle(false)
        if(parsedPage=getParser)
          if parsedPage["entities"].has_key?("-1") and parsedPage["entities"]["success"]="1"
    Severity: Minor
    Found in app/models/wikidata.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 initilize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def initilize(ebook_number,title,author,release_date,lang,size ,downloads)
    Severity: Major
    Found in app/helpers/rdfreader.rb - About 50 mins to fix

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

        def self.bookresolver(bookid)
          result = false
          text = false
          book=Book.find(bookid)
          combination=["",0,8]
      Severity: Minor
      Found in app/models/book.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 search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.search(search)
          if search
            if search[:number]
              find(:all, :conditions => ['number LIKE ?', "%#{search[:search]}%"])
            elsif search[:title]
      Severity: Minor
      Found in app/models/book.rb - About 35 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