vesselinv/glove

View on GitHub

Showing 5 of 5 total issues

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

      def calc_weights(w1, w2, prediction=0.0, word_a_norm=0.0, word_b_norm = 0.0)
Severity: Minor
Found in lib/glove/workers/training_worker.rb - About 35 mins to fix

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

        def analogy_words(word1, word2, target, num=3, accuracy=0.0001)
    Severity: Minor
    Found in lib/glove/model.rb - About 35 mins to fix

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

            def apply_weights(w1, w2, loss, word_a_norm, word_b_norm)
      Severity: Minor
      Found in lib/glove/workers/training_worker.rb - About 35 mins to fix

        Method token_neighbors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def token_neighbors(word, index)
              start_pos = index - window < 0 ? 0 : index - window
              end_pos   = (index + window >= tokens.size) ? tokens.size - 1 : index + window
        
              tokens[start_pos..end_pos].map do |neighbor|
        Severity: Minor
        Found in lib/glove/corpus.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 vector_distance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def vector_distance(word)
              return {} unless word_vector = vector(word)
        
              token_index.map.with_index do |(token,count), idx|
                next if token.eql? word
        Severity: Minor
        Found in lib/glove/model.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