Showing 30 of 30 total issues
Class PresentationXMLConvert
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def multidef(elem)
number_multidef(elem)
collapse_multidef(elem)
end
Class Converter
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Converter < Standoc::Converter
def initial_boilerplate(xml, isodoc)
intro_boilerplate(xml, isodoc)
super if @document_scheme == "ieee-sa-2021"
xml.at("//boilerplate") or return
Class PresentationXMLConvert
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def initialize(options)
@hierarchical_assets = options[:hierarchicalassets]
super
end
Class Converter
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Converter < Standoc::Converter
BIBLIO =
"//bibliography/references[@normative = 'false'][not(@hidden)] | " \
"//bibliography/clause[.//references[@normative = 'false']] | " \
"//annex//references[@normative = 'false'][not(@hidden)]".freeze
Class Converter
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Converter < Standoc::Converter
def validate(doc)
content_validate(doc)
schema_validate(formattedstr_strip(doc.dup),
File.join(File.dirname(__FILE__), "ieee.rng"))
Class Converter
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Converter < Standoc::Converter
def metadata_committee(node, xml)
metadata_committee_prep(node) or return
xml.editorialgroup do |a|
committee_component("society", node, a)
Class WordConvert
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class WordConvert < IsoDoc::WordConvert
def authority_cleanup(docxml)
feedback_footnote(docxml)
%w(copyright license disclaimers participants).each do |t|
authority_cleanup1(docxml, t)
Class WordConvert
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class WordConvert < IsoDoc::WordConvert
def initialize(options)
@libdir = File.dirname(__FILE__)
super
init_wp(options.dup)
Method stylesmap
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stylesmap
{
example: "IEEEStdsParagraph",
MsoNormal: "IEEEStdsParagraph",
NormRef: "IEEEStdsParagraph",
Method stylesmap
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def stylesmap
{
example: "IEEEStdsParagraph", # x
MsoNormal: "MsoBodyText",
NormRef: "MsoBodyText",
Method style_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def style_list(elem, level, liststyle, listnumber)
return unless liststyle
sameelem_level = elem.ancestors.map(&:name).count(elem.parent.name)
if elem["style"]
- 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 list2para
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list2para(list)
list.name == "ol" and return super
return if list.xpath("./li").empty?
list.xpath("./li/p").each do |p|
- 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 ddMMMyyyy(isodate)
isodate.nil? and return nil
arr = isodate.split("-")
if arr.size == 1 && (/^\d+$/.match isodate)
Date.new(*arr.map(&:to_i)).strftime("%Y")
- 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 48.
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 ddMMMyyyy(isodate)
isodate.nil? and return nil
arr = isodate.split("-")
if arr.size == 1 && (/^\d+$/.match isodate)
Date.new(*arr.map(&:to_i)).strftime("%Y")
- 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 48.
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 list2para1
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def list2para1(list, level, type)
list.xpath("./li").first["class"] ||= list_style(type, level, "First")
list.xpath("./li").last["class"] ||= list_style(type, level, "Last")
list.xpath("./li/p").each do |p|
p["class"] ||= list_style(type, level, "Middle")
- 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 std_docid_sdo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def std_docid_sdo(text)
found = false
text.split(%r{([\p{Zs}|/]+)}).reverse.map do |x|
if /[A-Za-z]/.match?(x)
k = if found || agency?(x) then "std_publisher"
- 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 onlychild_clause_validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def onlychild_clause_validate(root)
root.xpath(Standoc::Utils::SUBCLAUSE_XPATH).each do |c|
next unless c.xpath("../clause").size == 1
title = c.at("./title")
- 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 listdepth_validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def listdepth_validate(doc)
doc.xpath("//ul[.//ul//ul]").each do |u|
next unless u.ancestors("ul").empty?
@log.add("Style", u,
- 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 toWord(result, filename, dir, header)
::Html2Doc::Ieee_Wp.new(
filename: filename,
imagedir: @localdir,
stylesheet: @wordstylesheet&.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 38.
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 toWord(result, filename, dir, header)
::Html2Doc::Ieee.new(
filename: filename,
imagedir: @localdir,
stylesheet: @wordstylesheet&.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 38.
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