smalruby/smalruby-editor

View on GitHub

Showing 14 of 47 total issues

Class Base has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Base
      STRING_RE = '\s*("[^"]*"|\'[^\']*\')\s*'

      attr_accessor :parent
      attr_accessor :prev_sibling
Severity: Minor
Found in app/models/concerns/ruby_to_block/block/base.rb - About 3 hrs to fix

    File ja.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    goog.provide('Blockly.Msg.ja.smalruby');
    
    goog.require('Blockly.Msg');
    
    
    
    Severity: Minor
    Found in app/assets/javascripts/msg/ja.js - About 2 hrs to fix

      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

      Function initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        initialize: function() {
          if (!this.get('filename')) {
            var filename = Smalruby.Views.MainMenuView.getFilename();
            if (filename.length == 0) {
              filename = Smalruby.SourceCode.defaultFilename();
      Severity: Minor
      Found in app/assets/javascripts/models/source_code.js - 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 blocknize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.blocknize(regexp, options = {})
              klass = (class << self; self; end)
              klass.instance_eval do
                define_method(:regexp_string) do
                  regexp
      Severity: Minor
      Found in app/models/concerns/ruby_to_block/block/base.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 to_blocks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def to_blocks
          fail if data == '__FAIL__'
      
          context = Context.new(data.lines)
          while (line = context.next_line)
      Severity: Minor
      Found in app/models/concerns/ruby_to_block.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

      Function getRbxmlFilename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        getRbxmlFilename: function() {
          var filename = this.get('filename');
          if (filename.match(/\.rb\.xml$/)) {
            return filename;
          }
      Severity: Minor
      Found in app/assets/javascripts/models/source_code.js - 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 process_match_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.process_match_data(md, context)
              ends_num = 1
              context.lines.each do |l|
                md2 = Block.statement_regexp.match(l)
                type = md2.names.find { |n| md2[n.to_sym] }
      Severity: Minor
      Found in app/models/concerns/ruby_to_block/block/end.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 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

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

          def add_block(block)
            if current_block
              # HACK: コメントは下の行に関係することが多いため対象外としている
              if current_block.type == 'character_new' &&
                  block.type != 'character_new' && block.type != 'ruby_comment'
      Severity: Minor
      Found in app/models/concerns/ruby_to_block/context.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 standalone? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def standalone?
          return false if Rails.env == 'production'
          return true if Rails.env == 'standalone'
      
          if Rails.env != 'test' &&
      Severity: Minor
      Found in app/controllers/application_controller.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 process_value_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.process_value_string(context, block, string, name)
              # HACK: 最初と最後の括弧を取り除く
              string = string[1..-2] while string[0] == '(' && string[-1] == ')'
      
              value_md = Block.value_regexp.match(string)
      Severity: Minor
      Found in app/models/concerns/ruby_to_block/block/base.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 load_local_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def load_local_file(path, remix)
          if path
            if remix == 'true'
              filename = SourceCode.make_remix_filename("~/#{session[:username]}",
                                                        path.basename.to_s)
      Severity: Minor
      Found in app/controllers/source_codes_controller.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