File android_api_gen.rb
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'strscan'
require 'open-uri'
require 'rexml/document'
$stdout.sync = true
Method read_class_or_interface
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def read_class_or_interface
if doc.scan(/\}\s*/) or doc.eos?
return '}'
else
doc.scan(/(public|protected)?([a-z\s]*)\s(class|interface)\s([^\s]+)\s(extends\s([^\s]+)\s)?(implements\s([^\{]+))?\{\s+/)
- 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 compile_platforms
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.compile_platforms()
#Todo: Check to see if there is a newer repository
doc = REXML::Document.new(open('https://dl-ssl.google.com/android/repository/repository-12.xml'))
#odoT
- 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 read_platform_from_xml
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def read_platform_from_xml(file)
doc = StringScanner.new(file)
until doc.eos?
doc.scan(/\s*</)
unless doc.scan(/\/\w+>\s*/)
- 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 compile_platforms
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.compile_platforms()
#Todo: Check to see if there is a newer repository
doc = REXML::Document.new(open('https://dl-ssl.google.com/android/repository/repository-12.xml'))
#odoT
Method read_field
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def read_field
visibility = doc.scan(/\w+/)
doc.scan(/\s+/)
rest = doc.scan(/.*$\s*/)
flags = %w(transient final static deprecated volatile) & rest.split(' ')
- 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 read_class_or_interface
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_class_or_interface
if doc.scan(/\}\s*/) or doc.eos?
return '}'
else
doc.scan(/(public|protected)?([a-z\s]*)\s(class|interface)\s([^\s]+)\s(extends\s([^\s]+)\s)?(implements\s([^\{]+))?\{\s+/)
Method read_platform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def read_platform(number)
@number = number
if File.exist?("apis/#{@number}.txt")
read_platform_from_txt(IO.read("apis/#{@number}.txt"))
- 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 tag_start
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tag_start(api, *args)
return if args[0] == self.class.name[0..-4].downcase
if (i = self.class.children_types.index(args[0]))
# puts "tag_start: #{args.map {|x| x.inspect}.join(', ')}"
@children[i] << (@current = self.class.children_classes[i].new(api || self, *args))
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(api, *args)
@children = []
self.class.children_types.each {|i| @children << []}
@values = args[1] || {}
- 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"