Showing 82 of 82 total issues
Function Modernizr
has 594 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.Modernizr = (function( window, document, undefined ) {
var version = '2.6.1',
Modernizr = {},
Function Modernizr
has a Cognitive Complexity of 115 (exceeds 5 allowed). Consider refactoring. Open
window.Modernizr = (function( window, document, undefined ) {
var version = '2.6.1',
Modernizr = {},
- 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 modernizr.js
has 596 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* Modernizr v2.6.1
* www.modernizr.com
*
* Copyright (c) Faruk Ates, Paul Irish, Alex Sexton
File base.rb
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'log4r'
require 'nokogiri'
require 'vagrant/util/busy'
require 'vagrant/util/network_ip'
Class Base
has 57 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
# Include this so we can use `Subprocess` more easily.
include Vagrant::Util::Retryable
include Vagrant::Util::NetworkIP
Method detect_owner_group_ids
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def detect_owner_group_ids(machine, guest_path, mount_options, options)
mount_uid = find_mount_options_id("uid", mount_options)
mount_gid = find_mount_options_id("gid", mount_options)
if mount_uid.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
File action.rb
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'vagrant/action/builder'
module VagrantPlugins
module Parallels
module Action
File network.rb
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'ipaddr'
require 'set'
require 'log4r'
require 'vagrant/util/scoped_hash_override'
Method call
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
@env = env
# Get the list of network adapters from the configuration
network_adapters_config = env[:machine].provider_config.network_adapters.dup
- 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 bridged_adapter
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def bridged_adapter(config)
# Find the bridged interfaces that are available
bridgedifs = @env[:machine].provider.driver.read_bridged_interfaces
bridgedifs.delete_if { |interface| interface[:status] == 'Down' }
- 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 call
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
@env = env
# Get the list of network adapters from the configuration
network_adapters_config = env[:machine].provider_config.network_adapters.dup
Method hostonly_config
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def hostonly_config(options)
options = {
auto_config: true,
mac: nil,
name: 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
machine.communicate.tap do |comm|
arch = ''
comm.execute("uname -p") { |type, data| arch << data if type == :stdout }
tools_iso_path = File.expand_path(
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 93.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
machine.communicate.tap do |comm|
arch = ''
comm.execute("uname -p") { |type, data| arch << data if type == :stdout }
tools_iso_path = File.expand_path(
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 93.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method detect_owner_group_ids
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def detect_owner_group_ids(machine, guest_path, mount_options, options)
mount_uid = find_mount_options_id("uid", mount_options)
mount_gid = find_mount_options_id("gid", mount_options)
if mount_uid.nil?
Method hostonly_config
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hostonly_config(options)
options = {
auto_config: true,
mac: nil,
name: nil,
Method bridged_adapter
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bridged_adapter(config)
# Find the bridged interfaces that are available
bridgedifs = @env[:machine].provider.driver.read_bridged_interfaces
bridgedifs.delete_if { |interface| interface[:status] == 'Down' }
Method action_start
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.action_start
Vagrant::Action::Builder.new.tap do |b|
b.use BoxCheckOutdated
b.use Call, IsState, :running do |env1, b1|
# If the VM is running, run the necessary provisioners
- 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 action_destroy
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.action_destroy
Vagrant::Action::Builder.new.tap do |b|
b.use ConfigValidate
b.use Call, IsState, :not_created do |env1, b1|
if env1[:result]
- 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 hostonly_find_matching_network
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def hostonly_find_matching_network(config)
this_netaddr = IPAddr.new("#{config[:ip]}/#{config[:netmask]}")
@env[:machine].provider.driver.read_host_only_interfaces.each do |interface|
return interface if config[:name] && config[:name] == interface[: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"