Showing 152 of 152 total issues
Method _nt_zone_info
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _nt_zone_info
start_index = index
if node_cache[:zone_info].has_key?(index)
cached = node_cache[:zone_info][index]
if cached
- 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 _nt_integer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _nt_integer
start_index = index
if node_cache[:integer].has_key?(index)
cached = node_cache[:integer][index]
if cached
Method _nt_space
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _nt_space
start_index = index
if node_cache[:space].has_key?(index)
cached = node_cache[:space][index]
if cached
- 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 _nt_zone_name
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _nt_zone_name
start_index = index
if node_cache[:zone_name].has_key?(index)
cached = node_cache[:zone_name][index]
if cached
- 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
Avoid deeply nested control flow statements. Open
if has_terminal?('ago', false, index)
r7 = instantiate_node(SyntaxNode,input, index...(index + 3))
@index += 3
else
terminal_parse_failure('ago')
Avoid deeply nested control flow statements. Open
if s10.size < 2
@index = i10
r10 = nil
else
r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
Method _nt_now
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _nt_now
start_index = index
if node_cache[:now].has_key?(index)
cached = node_cache[:now][index]
if cached
- 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 _nt_last
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _nt_last
start_index = index
if node_cache[:last].has_key?(index)
cached = node_cache[:last][index]
if cached
- 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
Avoid deeply nested control flow statements. Open
if r9
s8 << r9
else
break
end
Similar blocks of code found in 3 locations. Consider refactoring. Open
if r4
s5, i5 = [], index
loop do
r6 = _nt_space
if r6
- 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
Avoid deeply nested control flow statements. Open
if has_terminal?('including today', false, index)
r8 = instantiate_node(SyntaxNode,input, index...(index + 15))
@index += 15
else
terminal_parse_failure('including today')
Avoid deeply nested control flow statements. Open
if r7
s9, i9 = [], index
loop do
r10 = _nt_space
if r10
Similar blocks of code found in 3 locations. Consider refactoring. Open
if r1
s2, i2 = [], index
loop do
r3 = _nt_space
if r3
- 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
Method _nt_before
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _nt_before
start_index = index
if node_cache[:before].has_key?(index)
cached = node_cache[:before][index]
if cached
- 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 _nt_from
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _nt_from
start_index = index
if node_cache[:from].has_key?(index)
cached = node_cache[:from][index]
if cached
- 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
Avoid deeply nested control flow statements. Open
if r5
r0 = r5
else
@index = i0
r0 = nil
Avoid deeply nested control flow statements. Open
if r5
r0 = r5
else
if has_terminal?('june', false, index)
r6 = instantiate_node(MonthName,input, index...(index + 4))
Method evaluate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(zone_offset)
today = TimeInZone.now(zone_offset).beginning_of_day
return today if !including_today.empty? && today.wday == day_name.value
- 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 _nt_yesterday
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _nt_yesterday
start_index = index
if node_cache[:yesterday].has_key?(index)
cached = node_cache[:yesterday][index]
if cached
- 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
Avoid deeply nested control flow statements. Open
if r7
s9, i9 = [], index
loop do
r10 = _nt_space
if r10