Showing 18 of 20 total issues
File rasl.rb
has 1386 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'optparse'
require 'pathname'
require 'readline'
require 'kconv'
Class Value
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Value
class << self
def cast_value(value, signed)
format = {8 => 'c', 16 => 's', 32 => 'l', 64 => 'q'}.fetch(Value.bit)
[value].pack(format).unpack(signed ? format : format.upcase).first
Method operand_list
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def operand_list
[
{ key: :nop, op_code: 0x09, encode: :encode_blank, decode: :decode_nop },
{ key: :ld, op_code: 0x10, encode: :encode_rix, with_imm: true, decode: :decode_ld_rix, printer: :prt_rix },
Method parser
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parser
OptionParser.new do |o|
o.version = VERSION
o.banner = [
"CASL Assembler / Simulator #{o.ver}\n",
Method parse_order_part
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse_order_part
if str = @scanner.scan(syntax[:symbol])
@encoded = false
skip_blank
pointer = @scanner.pointer
- Read upRead up
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 simulator
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def simulator
command_init
loop do
if defined? Readline
getline(Readline.readline('-'))
- Read upRead up
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 execute
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(args)
begin
parser.parse!(args)
rescue OptionParser::InvalidOption => error
puts error
Method execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute(args)
begin
parser.parse!(args)
rescue OptionParser::InvalidOption => error
puts error
- Read upRead up
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 assemble_once
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def assemble_once
Rasl::Parser.line_count = nil
@code_size = 0
@boot_pc = nil
- Read upRead up
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 scan_imm
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def scan_imm
case
when str = @scanner.scan(syntax[:label])
if @pass_count == 0
undecision
- Read upRead up
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 assemble_once
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def assemble_once
Rasl::Parser.line_count = nil
@code_size = 0
@boot_pc = nil
Method current_file_line
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def current_file_line
if Rasl::Parser.line_count
if ARGF.filename == '-'
path = '<STDIN>'
else
- Read upRead up
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_label_part
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_label_part
@current_label = nil
if label = @scanner.scan(/#{syntax[:label]}:?/)
if Rasl.config.bol_order && !label.end_with?(':') && @operands.collect(&:match_names).flatten.include?(label.downcase)
@scanner.unscan
- Read upRead up
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 store_object
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def store_object(gr: nil, imm: nil, xr: nil)
raise SyntaxError if (gr && !gr.pos) || (gr && !gr.pos)
store_prim_op(@current_op.op_code, (gr ? gr.pos : nil), (xr ? xr.pos : nil), imm)
end
- Read upRead up
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 store_object
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def store_object(gr: nil, imm: nil, xr: nil)
raise SyntaxError if gr && !gr.pos
raise SyntaxError if xr && !xr.pos
store_prim_op(@current_op.op_code, (gr ? gr.pos : nil), (xr ? xr.pos : nil), imm)
end
- Read upRead up
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 scan_xr
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def scan_xr
skip_sep
if str = @scanner.scan(register_regexp)
xr = @gr[str.downcase]
unless xr
- Read upRead up
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 scan_str_literal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def scan_str_literal(mark)
if @scanner.check(/#{mark}/)
from = @scanner.pointer
nil while @scanner.scan(/#{mark}[^#{mark}]*#{mark}/) && @scanner.check(/#{mark}/)
str = @scanner.string[from...@scanner.pointer] # 【'a''b'】
- Read upRead up
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 prefetch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prefetch(pc)
attrs = {}
attrs[:addr] = pc
attrs[:raw] = mem_get(pc)
- Read upRead up
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"