Showing 82 of 82 total issues
Method cache_workgroup
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cache_workgroup(node)
wgcache_name = "#{Dir.home}/.asciidoc-rfc-workgroup-cache.json"
# If we are required to, clear the wg cache
if node.attr("flush-caches") == "true"
FileUtils.rm_f wgcache_name
Method table
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def table(node)
noko do |xml|
has_body = false
# TODO iref belongs here
- 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 inline_anchor_xref
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def inline_anchor_xref(node)
text = node.text
if text =~ /^\S+ (of|comma|parens|bare)\b/
# <<crossreference#fragment,section (of|comma|parens|bare): text>> = relref
matched = /(?<section>\S+)\s+(?<format>[a-z]+)(: )?(?<text>.*)$/.match node.text
- 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 admonition
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def admonition(node)
result = []
if node.parent.context == :preamble
note_attributes = {
# default title provided: title is mandatory
- 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 inline_anchor_xref
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inline_anchor_xref(node)
text = node.text
if text =~ /^\S+ (of|comma|parens|bare)\b/
# <<crossreference#fragment,section (of|comma|parens|bare): text>> = relref
matched = /(?<section>\S+)\s+(?<format>[a-z]+)(: )?(?<text>.*)$/.match node.text
Method olist
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def olist(node)
result = []
result << noko do |xml|
type = OLIST_TYPES[node.style.to_sym]
Method cleanup
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cleanup(doc)
xmldoc = Nokogiri::XML(doc) do |config|
config.noent
end
Method admonition
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def admonition(node)
result = []
if node.parent.context == :preamble
note_attributes = {
removeInRFC: node.attr("remove-in-rfc"),
Method example
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def example(node)
figure_attributes = {
anchor: node.id,
align: node.attr("align"),
alt: node.alt,
Method dlist_naked
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dlist_naked(node, xml)
style = "hanging"
style = "empty" if node.attr("style") == "empty"
list_attributes = {
hangIndent: node.attr("hang-indent"),
Method example
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def example(node)
figure_attributes = {
anchor: node.id,
align: node.attr("align"),
alt: node.alt,
- 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 inline_quoted
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inline_quoted(node)
noko do |xml|
case node.type
when :emphasis then xml.em node.text
when :strong
Method inline_quoted
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def inline_quoted(node)
noko do |xml|
case node.type
when :emphasis
xml.spanx node.text, style: "emph"
Method section
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def section(node)
if node.attr("style") == "bibliography" ||
node.parent.context == :section && node.parent.attr("style") == "bibliography"
result = ref_section(node)
else
Method ulist
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ulist(node)
result = []
result << noko do |xml|
ul_attributes = {
Similar blocks of code found in 2 locations. Consider refactoring. Open
xml.ol **attr_code(ol_attributes) do |xml_ol|
node.items.each do |item|
li_attributes = {
anchor: item.id,
}
- 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 47.
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
xml.ul **attr_code(ul_attributes) do |xml_ul|
node.items.each do |item|
li_attributes = {
anchor: item.id,
}
- 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 47.
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
ret = noko do |xml|
if node.parent.context != :example
figure_attributes = {
anchor: node.id,
}
- 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 46.
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
ret = noko do |xml|
if node.parent.context != :example
figure_attributes = {
anchor: node.id,
}
- 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 46.
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 link
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def link(node)
result = []
result << noko do |xml|
links = (node.attr("link") || "").split(/,\s*/)
links.each do |link|
- 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"