smalruby/smalruby-editor

View on GitHub
app/models/source_code.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method summary has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def summary
    res = {}
    if xml?
      res[:filename] = filename.sub(/\.xml\z/, '')

Severity: Minor
Found in app/models/source_code.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 parse_ruby_error_messages has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_ruby_error_messages(stderr_str)
    if SmalrubyEditor.windows?
      stderr_str = NKF.nkf("-w", stderr_str)
    end
    stderr_str.lines.each.with_object([]) { |line, res|
Severity: Minor
Found in app/models/source_code.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 make_remix_filename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.make_remix_filename(home_dir, filename)
    home_dir = Pathname(home_dir).expand_path
    filename = filename.dup
    ext = filename.slice!(/\.rb(\.xml)?$/)
    filename.slice!(/(_remix(\d+)?)+$/)
Severity: Minor
Found in app/models/source_code.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

There are no issues that match your filters.

Category
Status