Showing 62 of 62 total issues
File theme.rb
has 1462 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rubyXL/objects/ooxml_object'
require 'rubyXL/objects/extensions'
module RubyXL
# http://www.datypic.com/sc/ooxml/e-a_ext-1.html
Method default
has 317 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.default
default_theme = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">
<a:themeElements>
<a:clrScheme name="Office">
File worksheet.rb
has 622 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rubyXL/objects/ooxml_object'
require 'rubyXL/objects/simple_types'
require 'rubyXL/objects/extensions'
require 'rubyXL/objects/relationships'
require 'rubyXL/objects/sheet_common'
File worksheet.rb
has 559 lines of code (exceeds 250 allowed). Consider refactoring. Open
module RubyXL
module WorksheetConvenienceMethods
NAME = 0
SIZE = 1
COLOR = 2
File workbook.rb
has 445 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'date'
require 'rubyXL/objects/ooxml_object'
require 'rubyXL/objects/shared_strings'
require 'rubyXL/objects/stylesheet'
require 'rubyXL/objects/theme'
Method parse
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def parse(node, known_namespaces = nil)
case node
when String, IO, Zip::InputStream then node = Nokogiri::XML.parse(node)
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
class CT_ScRgbColor < OOXMLObject
# -- Choice [0..*] (a:EG_ColorTransform)
define_child_node(RubyXL::IntegerValue, :node_name => 'a:tint')
define_child_node(RubyXL::IntegerValue, :node_name => 'a:shade')
define_child_node(RubyXL::BooleanValue, :node_name => 'a:comp')
- 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 190.
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
class CT_HslColor < OOXMLObject
define_child_node(RubyXL::IntegerValue, :node_name => 'a:tint')
define_child_node(RubyXL::IntegerValue, :node_name => 'a:shade')
define_child_node(RubyXL::BooleanValue, :node_name => 'a:comp')
define_child_node(RubyXL::BooleanValue, :node_name => 'a:inv')
- 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 190.
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 write_xml
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def write_xml(xml = nil, node_name_override = nil)
if xml.nil? then
seed_xml = Nokogiri::XML('<?xml version = "1.0" standalone ="yes"?>')
seed_xml.encoding = 'UTF-8'
- 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
class CT_PresetColor < OOXMLObject
define_child_node(RubyXL::IntegerValue, :node_name => 'a:tint')
define_child_node(RubyXL::IntegerValue, :node_name => 'a:shade')
define_child_node(RubyXL::BooleanValue, :node_name => 'a:comp')
define_child_node(RubyXL::BooleanValue, :node_name => 'a:inv')
- 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 179.
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
class CT_SchemeColor < OOXMLObject
define_child_node(RubyXL::IntegerValue, :node_name => 'a:tint')
define_child_node(RubyXL::IntegerValue, :node_name => 'a:shade')
define_child_node(RubyXL::BooleanValue, :node_name => 'a:comp')
define_child_node(RubyXL::BooleanValue, :node_name => 'a:inv')
- 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 179.
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 before_write_xml
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def before_write_xml # This method may need to be moved higher in the hierarchy
first_nonempty_row = nil
last_nonempty_row = 0
first_nonempty_column = nil
last_nonempty_column = 0
- 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_row
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def insert_row(row_index = 0)
validate_workbook
ensure_cell_exists(row_index)
old_row = new_cells = 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
Class Workbook
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Workbook < OOXMLTopLevelObject
CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'.freeze
CONTENT_TYPE_TEMPLATE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml'.freeze
CONTENT_TYPE_TEMPLATE_WITH_MACROS = 'application/vnd.ms-excel.template.macroEnabled.main+xml'.freeze
CONTENT_TYPE_WITH_MACROS = 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'.freeze
Method before_write_xml
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def before_write_xml
content_types_by_ext = {}
# Collect all extensions and corresponding content types
root.rels_hash.each_pair { |klass, objects|
- 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 ooxml_object.rb
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
require 'pathname'
require 'rubyXL/objects/reference'
module RubyXL
Method add_cell
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_cell(row_index = 0, column_index = 0, data = '', formula = nil, overwrite = true)
validate_workbook
validate_nonnegative(row_index)
validate_nonnegative(column_index)
row = sheet_data.rows[row_index] || add_row(row_index)
- 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_related_files
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def load_related_files(zipdir_path, base_file_name)
self.related_files = {}
@@debug_indent += 2 if @@debug_indent
- 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 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(node, known_namespaces = nil)
case node
when String, IO, Zip::InputStream then node = Nokogiri::XML.parse(node)
end
Method insert_column
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def insert_column(column_index = 0)
validate_workbook
ensure_cell_exists(0, column_index)
old_range = cols.get_range(column_index)
- 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"