Showing 14 of 14 total issues
Class Table
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Table
# 以下は継承先でオーバーライド必須
# * TABLE_NAME, COLUMN_NAMES
# * initialize()
TABLE_NAME = :tables
File table.rb
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'facemock/database'
require 'sqlite3'
require 'hashie'
module Facemock
Method update!
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update!(options={})
if options.empty?
column_names.each do |column_name|
if (value = self.send(column_name)) && column_name != :id
options[column_name] = value unless options.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 load_users
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def load_users(ymlfile)
load_data = YAML.load_file(ymlfile)
raise Facemock::Errors::IncorrectDataFormat.new "data is not Array" unless load_data.kind_of?(Array)
load_data.each do |app_data|
- 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 method_missing
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(name, *args)
method_name = name.to_s.include?("=") ? name.to_s[0...-1].to_sym : name
case name
when :identifier then return send(:id)
when :identifier= then return send(:id=, *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 fetch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def fetch
@record = if @identifier == :app
unless validate_access_token
raise Facemock::FbGraph::InvalidToken.new "Invalid OAuth access token."
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 method_missing
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.method_missing(name, *args)
if ((name =~ /^find_by_(.+)/ || name =~ /^find_all_by_(.+)/) &&
(column_name = $1) && column_names.include?(column_name.to_sym))
raise ArgumentError, "wrong number of arguments (#{args.size} for 1)" unless args.size == 1
define_find_method(name, column_name) ? send(name, args.first) : super
- 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 validate_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_user(user)
return false unless validate_id(user.identifier)
[:name, :password, :name].each do |key|
value = user.send(key)
case value
- 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 validate_users
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_users(users)
case users
when Array
return false if users.empty?
users.each {|user| return false unless validate_user(Hashie::Mash.new(user)) }
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(application_id, options={})
@limit = limit = (options[:limit] && options[:limit] > 0) ? options[:limit] : DEFAULT_LIMIT
@after = after = (options[:after] && options[:after] > 0) ? options[:after] : DEFAULT_AFTER
@application_id = application_id
st = after
- 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 insert!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def insert!(options={})
opts = Hashie::Mash.new(options)
instance = self.class.new
column_names.each do |column_name|
next if column_name == :created_at
- 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 auth_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def auth_hash(access_token=nil)
if access_token.kind_of?(String) && access_token.size > 0
user = Facemock::User.find_by_access_token(access_token)
if user
Facemock::AuthHash.new({
- 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(options={})
opts = Hashie::Mash.new(options)
id = opts.id || opts.identifier
@id = (id.to_i > 0) ? id.to_i : ("10000" + Faker::Number.number(10)).to_i
@name = opts.name || create_user_name
- 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 validate_identifier
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_identifier
return false if @identifier.nil? || @identifier == ""
return false unless [Fixnum, String].include?(@identifier.class)
return false unless Facemock::Application.find_by_id(@identifier)
true
- 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"