weirdpercent/oversetter

View on GitHub

Showing 8 of 16 total issues

Method get_trans has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            def get_trans(search, params)
                func, result = 'translate', nil
                tran = Oversetter::Glosbe.new
                result = tran.get_word(search, func, params, result)
                if result =~ /"/i
Severity: Minor
Found in lib/oversetter/glosbe/translate.rb - About 1 hr to fix

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

                def get_trans(search, params)
                    func, result = 'translate', nil
                    tran = Oversetter::Glosbe.new
                    result = tran.get_word(search, func, params, result)
                    if result =~ /"/i
    Severity: Minor
    Found in lib/oversetter/glosbe/translate.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_trans has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                def get_trans(search, params)
                    func, result = 'translation', nil
                    tran = Oversetter::Hablaa.new
                    result = tran.get_word(search, func, params, result)
                    if result != 'error'
    Severity: Minor
    Found in lib/oversetter/hablaa/translate.rb - About 1 hr to fix

      Method get_trans has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  def get_trans(search, params)
                      func, result = 'translate', nil
                      tran = Oversetter::Yandex.new
                      result = tran.get_word(search, func, params, result)
                      result = MultiJson.load(result)
      Severity: Minor
      Found in lib/oversetter/yandex/translate.rb - About 1 hr to fix

        Method get_word has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_word(search, func, params, result)
                    search = URI.encode(search)
                    prefix = 'https://glosbe.com/gapi/'
                    word, pcont = "#{prefix}#{func}?", []
                    if func == 'translate' then pcont.push "tm=false&"; end
        Severity: Minor
        Found in lib/oversetter/glosbe/text.rb - About 55 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 get_word has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_word(search, func, params, result)
                    search = URI.encode(search)
                    prefix = 'https://translate.yandex.net/api/v1.5/tr.json/'
                    word, pcont = "#{prefix}#{func}?", []
                    if func != 'getLangs' then pcont.push "text=#{search}&"; end
        Severity: Minor
        Found in lib/oversetter/yandex/text.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 get_trans has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                    def get_trans(search, params)
                        func, result = 'translate', nil
                        tran = Oversetter::Yandex.new
                        result = tran.get_word(search, func, params, result)
                        result = MultiJson.load(result)
        Severity: Minor
        Found in lib/oversetter/yandex/translate.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

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

                    def get_trans(search, params)
                        func, result = 'translation', nil
                        tran = Oversetter::Hablaa.new
                        result = tran.get_word(search, func, params, result)
                        if result != 'error'
        Severity: Minor
        Found in lib/oversetter/hablaa/translate.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