fga-gpp-mds/2017.1-Escola-X

View on GitHub
app/helpers/reader_helper.rb

Summary

Maintainability
A
1 hr
Test Coverage
ReaderHelper has 6 constants
ReaderHelper has no descriptive comment
Missing top-level module documentation comment.
module ReaderHelper
Extra empty line detected at module body beginning.
 
Tab detected.
Use 2 (not 1) spaces for indentation.
Freeze mutable objects assigned to constants.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
TWO_POINTS = ":"
Freeze mutable objects assigned to constants.
Tab detected.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
DATE_SPACE = "/"
Freeze mutable objects assigned to constants.
Tab detected.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
SPACE_TRACE_SPACE = "-"
Tab detected.
Do not use semicolons to terminate expressions.
ADJUSTING_FUSE_TO_BRAZILIAN = 3;
Do not use semicolons to terminate expressions.
Tab detected.
Freeze mutable objects assigned to constants.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
ZERO = "0";
Tab detected.
SINGLE_CHAR = 1
 
Extra blank line detected.
 
Assignment Branch Condition size for mountCurrentDate is too high. [20.98/15]
Method has too many lines. [11/10]
ReaderHelper#mountCurrentDate has approx 7 statements
ReaderHelper#mountCurrentDate doesn't depend on instance state (maybe move it to another class?)
ReaderHelper#mountCurrentDate has the name 'mountCurrentDate'
Identical blocks of code found in 2 locations. Consider refactoring.
Trailing whitespace detected.
Use snake_case for method names.
Tab detected.
Omit the parentheses in defs when the method doesn't accept any arguments.
def mountCurrentDate()
Tab detected.
Trailing whitespace detected.
Tab detected.
Missing space after `#`.
#hour = (Time.current.hour - ADJUSTING_FUSE_TO_BRAZILIAN).to_s
Tab detected.
Missing space after `#`.
#minute = Time.current.min .to_s
ReaderHelper#mountCurrentDate calls 'Time.current' 3 times
Tab detected.
day = Time.current.day.to_s
Tab detected.
month = Time.current.month.to_s
Tab detected.
Trailing whitespace detected.
year = Time.current.year.to_s
 
Don't use parentheses around the condition of an `if`.
Tab detected.
Favor modifier `if` usage when having a single-line body. Another good alternative is the usage of control flow `&&`/`||`.
if (month.length == SINGLE_CHAR)
Use 2 (not 1) spaces for indentation.
Tab detected.
month = ZERO + month
Tab detected.
end
 
Favor modifier `if` usage when having a single-line body. Another good alternative is the usage of control flow `&&`/`||`.
Don't use parentheses around the condition of an `if`.
Tab detected.
if (day.length == SINGLE_CHAR)
Tab detected.
Use 2 (not 1) spaces for indentation.
day = ZERO + day
Tab detected.
end
 
ReaderHelper#mountCurrentDate has the variable name 'correctDate'
Use snake_case for variable names.
Trailing whitespace detected.
Tab detected.
correctDate = year + SPACE_TRACE_SPACE + month + SPACE_TRACE_SPACE + day
Redundant `return` detected.
Tab detected.
Inconsistent indentation detected.
return correctDate.to_s
Tab detected.
end
Trailing whitespace detected.
Tab detected.
end