Kuniri/kuniri

View on GitHub

Showing 31 of 31 total issues

Avoid too many return statements within this method.
Open

          return build_data(ELSIF_REGEX, Languages::ELSIF_LABEL)
Severity: Major
Found in lib/kuniri/language/ruby/conditional_ruby.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return nil
    Severity: Major
    Found in lib/kuniri/language/ruby/repetition_ruby.rb - About 30 mins to fix

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

            def execute(pElementFile, pLine)
              classElement = @language.processed_line
      
              if classElement
                classElement.comments = @language.string_comment_to_transfer
      Severity: Minor
      Found in lib/kuniri/state_machine/OO_structured_fsm/class_state.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 check_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_source
            if !@configurationInfo.key?:source
              Util::LoggerKuniri.error('Problem with source parameter')
              raise Error::ConfigurationFileError
            else
      Severity: Minor
      Found in lib/kuniri/core/setting.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 analyse_first_step has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def analyse_first_step(fileElement, source)
            source.each do |line|
              next if line.gsub(/\s+/, '').size.zero?
              processedLines = handle_semicolon(line)
              next if processedLines.nil?
      Severity: Minor
      Found in lib/kuniri/language/ruby/ruby_syntax.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 check_for_lambda has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def check_for_lambda(pLine)
              # (\w+\s+|\s*)lambda(:?\s+do\s*|\s*\{)(\s*$|\s*\|.*)
              regexLambda = [/(\w+\s+|\s*)lambda(:?\s+do|\s*\{)\s*/,
                             /(\s*\w+\s+|\s*)->\s*\(:?.*\)/]
              regexLambda.each do |lambdaSyntaxRegex|
      Severity: Minor
      Found in lib/kuniri/language/ruby/block_ruby.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 get_variable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_variable(pLine)
              varCandidates = @variableBehaviour.common_declaration(pLine)
              return nil if varCandidates.empty?
      
              globalVariables = []
      Severity: Minor
      Found in lib/kuniri/language/ruby/variable_global_ruby.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      module Languages
      
        module Ruby
      
          # Handling ruby method
      Severity: Minor
      Found in lib/kuniri/language/ruby/method_ruby.rb and 1 other location - About 20 mins to fix
      lib/kuniri/language/ruby/global_function_ruby.rb on lines 10..25

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 27.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      module Languages
      
        module Ruby
      
          # Handling ruby global function
      Severity: Minor
      Found in lib/kuniri/language/ruby/global_function_ruby.rb and 1 other location - About 20 mins to fix
      lib/kuniri/language/ruby/method_ruby.rb on lines 10..25

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 27.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def execute(pElementFile, _pLine)
              variableList = @language.processed_line
              if variableList
                variableList.each do |variable|
                  variable.comments = @language.string_comment_to_transfer
      Severity: Minor
      Found in lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb and 1 other location - About 15 mins to fix
      lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb on lines 28..41

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

            def execute(pElementFile, _pLine)
              attributeElement = @language.processed_line
      
              if attributeElement
                # Add attribute to the last class
      Severity: Minor
      Found in lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb and 1 other location - About 15 mins to fix
      lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb on lines 30..41

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Severity
      Category
      Status
      Source
      Language