Showing 18 of 18 total issues
Method load_yml!
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def load_yml!
self.enabled = yml["enabled"] if yml.has_key?('enabled')
self.fog_provider = yml["fog_provider"]
self.fog_host = yml["fog_host"]
self.fog_port = yml["fog_port"]
- 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 fog_options
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def fog_options
options = { :provider => fog_provider }
if aws?
if aws_iam?
options.merge!({
- 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
File config.rb
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "active_model"
require "erb"
module AssetSync
class Config
Class Config
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Config
include ActiveModel::Validations
class Invalid < StandardError; end
File storage.rb
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "fog/core"
require "asset_sync/multi_mime"
module AssetSync
Class Storage
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Storage
REGEXP_FINGERPRINTED_FILES = /\A(.*)\/(.+)-[^\.]+\.([^\.]+)\z/m
REGEXP_ASSETS_TO_CACHE_CONTROL = /-[0-9a-fA-F]{32,}$/
CONTENT_ENCODING = {
Method upload_file
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_file(f)
# TODO output files in debug logs as asset filename only.
one_year = 31557600
ext = File.extname(f)[1..-1]
mime = MultiMime.lookup(ext)
Method upload_file
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def upload_file(f)
# TODO output files in debug logs as asset filename only.
one_year = 31557600
ext = File.extname(f)[1..-1]
mime = MultiMime.lookup(ext)
- 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 fog_options
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fog_options
options = { :provider => fog_provider }
if aws?
if aws_iam?
options.merge!({
Method load_yml!
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_yml!
self.enabled = yml["enabled"] if yml.has_key?('enabled')
self.fog_provider = yml["fog_provider"]
self.fog_host = yml["fog_host"]
self.fog_port = yml["fog_port"]
Class InstallGenerator
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class InstallGenerator < Rails::Generators::Base
desc "Install a config/asset_sync.yml and the asset:precompile rake task enhancer"
# Commandline options can be defined here using Thor-like options:
class_option :use_yml, :type => :boolean, :default => false, :desc => "Use YML file instead of Rails Initializer"
Method get_asset_files_from_manifest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_asset_files_from_manifest
if self.config.manifest
if ActionView::Base.respond_to?(:assets_manifest)
log "Using: Rails 4.0 manifest access"
manifest = Sprockets::Manifest.new(ActionView::Base.assets_manifest.environment, ActionView::Base.assets_manifest.dir, self.config.manifest_path)
- 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 upload_files
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload_files
# fixes: https://github.com/rumblelabs/asset_sync/issues/19
local_files_to_upload = local_files - ignored_files - remote_files + always_upload_files
local_files_to_upload = (local_files_to_upload + get_non_fingerprinted(local_files_to_upload)).uniq
# Only files.
Method remote_files
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def remote_files
return [] if ignore_existing_remote_files?
return @remote_files if @remote_files
if remote_file_list_remote_path && remote_file_list_cache_file_path
- 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 with_config
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def with_config(&block)
return unless AssetSync.enabled?
errors = config.valid? ? "" : config.errors.full_messages.join(', ')
- 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 upload_files
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def upload_files
# fixes: https://github.com/rumblelabs/asset_sync/issues/19
local_files_to_upload = local_files - ignored_files - remote_files + always_upload_files
local_files_to_upload = (local_files_to_upload + get_non_fingerprinted(local_files_to_upload)).uniq
# Only files.
- 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
Avoid deeply nested control flow statements. Open
elsif backblaze?
require 'fog/backblaze'
options.merge!({
:b2_key_id => b2_key_id,
:b2_key_token => b2_key_token,
Avoid deeply nested control flow statements. Open
options.merge!({:environment => fog_region}) if fog_region