Showing 48 of 48 total issues
File console.rb
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Bovem
# List of valid terminal colors.
TERM_COLORS = {black: 0, red: 1, green: 2, yellow: 3, blue: 4, magenta: 5, cyan: 6, white: 7, default: 9}.freeze
# List of valid terminal text effects.
File shell.rb
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Bovem
# Methods of the {Shell Shell} class.
module ShellMethods
# General methods.
module General
File command.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Bovem
# Methods for the {Command Command} class.
module CommandMethods
# Methods for showing help messages.
module Help
Class Option
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Option
attr_accessor :name
attr_accessor :short
attr_accessor :long
attr_accessor :type
Function generateTOC
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateTOC() {
if ($('#filecontents').length === 0) return;
var _toc = $('<ol class="top"></ol>');
var show = false;
var toc = _toc;
Method handle_copy_or_move_failure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_copy_or_move_failure(single, src, show_errors, fatal, single_msg, multi_msg, error)
if fatal || show_errors
if single
@console.send(fatal ? :fatal : :error, single_msg, suffix: "\n", indented: 5)
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 match_pattern
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def match_pattern(entry, patterns, by_extension)
catch(:found) do
if block_given?
throw(:found, true) if yield(entry)
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 prepare_destination
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def prepare_destination(single, src, dst, operation, show_errors, fatal)
dst_dir = single ? File.dirname(dst) : dst
has_dir = check(dst_dir, :dir)
# Create directory
- 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 find
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find(directories, patterns: [], extension_only: false, case_sensitive: false, &block)
rv = []
directories = directories.ensure_array(no_duplicates: true, compact: true, flatten: true) { |d| File.expand_path(d.ensure_string) }
patterns = normalize_patterns(patterns, extension_only, case_sensitive)
- 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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse(file = nil, overrides = {}, logger = nil)
file = file.present? ? File.expand_path(file) : nil
if file
raise(Bovem::Errors::InvalidConfiguration, i18n.not_found(file)) unless File.readable?(file)
- 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
Function summaryToggle
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function summaryToggle() {
$('.summary_toggle').click(function(e) {
e.preventDefault();
localStorage.summaryCollapsed = $(this).text();
$('.summary_toggle').each(function() {
Method handle_copy_or_move_general_erorr
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_copy_or_move_general_erorr(src, dst, dst_dir, single, e, operation_s, show_errors, fatal)
Method execute_copy_or_move
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def execute_copy_or_move(src, dst, dst_dir, single, operation, operation_s, show_errors, fatal)
Method try_create_directory
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def try_create_directory(directory, mode, fatal, directories, show_errors)
rv = false
# Perform tests
if check(directory, :directory)
- 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 handle_failure
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_failure(e, access_error, not_found_error, general_error, entries, fatal, show_errors)
Method handle_copy_or_move_access_error
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_copy_or_move_access_error(src, dst, dst_dir, single, operation_s, show_errors, fatal)
Method handle_copy_or_move_failure
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_copy_or_move_failure(single, src, show_errors, fatal, single_msg, multi_msg, error)
Similar blocks of code found in 2 locations. Consider refactoring. Open
$('.toggleSource').toggle(function() {
$(this).parent().nextAll('.source_code').slideDown(100);
$(this).text("Hide source");
},
- 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 51.
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
function() {
$(this).parent().nextAll('.source_code').slideUp(100);
$(this).text("View source");
});
- 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 51.
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
$('#toc .hide_toc').toggle(function() {
$('#toc .top').slideUp('fast');
$('#toc').toggleClass('hidden');
$('#toc .title small').toggle();
}, function() {
- 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 50.
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