Showing 81 of 81 total issues
Class PresentationXMLConvert
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < ::IsoDoc::Convert
def lower2cap(text)
text.nil? and return text
x = Nokogiri::XML("<a>#{text}</a>")
firsttext = x.at(".//text()[string-length(normalize-space(.))>0]") or return text
Method parse
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(node, out)
if node.text? then text_parse(node, out)
else
case node.name
when "em" then em_parse(node, out)
Class PresentationXMLConvert
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < ::IsoDoc::Convert
def designation(docxml)
docxml.xpath(ns("//term")).each { |t| merge_second_preferred(t) }
docxml.xpath(ns("//preferred | //admitted | //deprecates"))
.each { |p| designation1(p) }
Class PresentationXMLConvert
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < ::IsoDoc::Convert
def non_locality_elems(node)
node.children.reject do |c|
%w{locality localityStack location}.include? c.name
end
Class PresentationXMLConvert
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < ::IsoDoc::Convert
def references(docxml)
bibliography_bibitem_number(docxml)
renderings = references_render(docxml)
docxml.xpath(ns("//references/bibitem")).each do |x|
Class PresentationXMLConvert
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < ::IsoDoc::Convert
SVG = { "m" => "http://www.w3.org/2000/svg" }.freeze
def figure(docxml)
docxml.xpath("//m:svg", SVG).each { |f| svg_wrap(f) }
Class PresentationXMLConvert
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < ::IsoDoc::Convert
def enable_indexsect
false
end
File to_word_html.rb
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "fileutils"
require "pathname"
module IsoDoc
module Function
Method top_element_render
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def top_element_render(e, out)
case e.name
when "abstract" then abstract e, out
when "foreword" then foreword e, out
when "introduction" then introduction e, out
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
def insert_comment_cont(from, upto, target)
# includes_to = from.at(".//*[@id='#{upto}']")
while !from.nil? && from["id"] != upto
following = from.xpath("./following::*")
(from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
- 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 57.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
def insert_comment_cont(from, upto, target)
# includes_to = from.at(".//*[@id='#{upto}']")
while !from.nil? && from["id"] != upto
following = from.xpath("./following::*")
(from = following.shift) && incl_to = from.at(".//*[@id='#{upto}']")
- 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 57.
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 new_subseq_increment1
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def new_subseq_increment1(node)
/^(?<b>.*?)(?<n>\d*)(?<a>[a-zA-Z]*)$/ =~ node["number"]
if !n.empty? || !a.empty?
@letter_override = @letter = a unless a.empty?
@number_override = @num = n.to_i unless n.empty?
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
def get_comments_from_text(docxml, link_order)
comments = []
docxml.xpath("//div[@style='mso-element:comment']").each do |c|
next unless c["id"] && !link_order[c["id"]].nil?
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
def get_comments_from_text(docxml, link_order)
comments = []
docxml.xpath("//div[@style='mso-element:comment']").each do |c|
next unless c["id"] && !link_order[c["id"]].nil?
- 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
Method make_tr_attr
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def make_tr_attr(cell, row, totalrows, header, bordered)
style = cell.name == "th" ? "font-weight:bold;" : ""
cell["align"] and style += "text-align:#{cell['align']};"
cell["valign"] and style += "vertical-align:#{cell['valign']};"
rowmax = cell["rowspan"] ? row + cell["rowspan"].to_i - 1 : row
- 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 norm_ref
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def norm_ref(node, out)
node["hidden"] != "true" or return
out.div do |div|
clause_name(node, node.at(ns("./fmt-title")), div, nil)
if node.name == "clause"
- 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 scss_fontheader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def scss_fontheader(is_html_css)
b = options[:bodyfont] || "Arial"
h = options[:headerfont] || "Arial"
m = options[:monospacefont] || "Courier New"
ns = options[:normalfontsize] || (is_html_css ? "1.0em" : "12.0pt")
- 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
def comment_attributes(docxml, x)
fromlink = docxml.at("//*[@id='#{x['from']}']")
return(nil) if fromlink.nil?
tolink = docxml.at("//*[@id='#{x['to']}']") || fromlink
- 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 43.
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
def comment_attributes(docxml, span)
fromlink = docxml.at("//*[@id='#{span['from']}']")
return(nil) if fromlink.nil?
tolink = docxml.at("//*[@id='#{span['to']}']") || fromlink
- 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 43.
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
def abstract(clause, out)
page_break(out)
out.div **attr_code(id: clause["id"]) do |s|
clause_name(clause, clause.at(ns("./fmt-title")), s,
{ class: "AbstractTitle" })
- 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 40.
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