Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mihail Sokurenko-0 #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Mihail Sokurenko-0 #26

wants to merge 4 commits into from

Conversation

M1ha11
Copy link
Contributor

@M1ha11 M1ha11 commented Dec 9, 2018

Name

Valentine Zavadskiy

Homework#

0

Link to video with demo

https://www.youtube.com/watch?v=ecIWPzGEbFc

Comment

Level 1 and 2.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.


s = Price.new
s.find

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingBlankLines: 1 trailing blank lines detected.

puts "For similar price u can buy #{str}"
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EmptyLinesAroundClassBody: Extra empty line detected at class body end.

puts"No product with similar price"
else
str = a.map{|r| "#{r.capitalize.gsub(/\s+/, " ").gsub(/\n/, " ")}"}.join(', ')
puts "For similar price u can buy #{str}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

if a.empty?
puts"No product with similar price"
else
str = a.map{|r| "#{r.capitalize.gsub(/\s+/, " ").gsub(/\n/, " ")}"}.join(', ')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceBeforeBlockBraces: Space missing to the left of {.
Layout/SpaceInsideBlockBraces: Space between { and | missing.
Style/UnneededInterpolation: Prefer to_s over string interpolation.
Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.
Performance/StringReplacement: Use tr instead of gsub.
Layout/SpaceInsideBlockBraces: Space missing inside }.
Layout/TrailingWhitespace: Trailing whitespace detected.

def similar_out(a)
if a.empty?
puts"No product with similar price"
else

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

@all
end

def out()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/DefWithParentheses: Omit the parentheses in defs when the method doesn't accept any arguments.

def all_files
Dir.foreach('./date').each do |file|
case File.extname(file)
when '.xlsx' then

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.


def old_price(file)
date = get_date(file)
if date[1].to_i < 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression.
Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.

def get_date(file)
dates = file.row(3)[0].split(' ')
@date.each do |d, t|
if dates[1] == d.to_s

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.

a = []
@c.each do |mas|
mas.each do |arr|
if arr == @pr && mas[0] !~ /#{@name.upcase}[.,) ]{1}/ && mas[0] != @name.upcase && !arr.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.

@M1ha11 M1ha11 changed the title Mihail Sokurenko Mihail Sokurenko-0 Dec 9, 2018
Copy link
Member

@anatoliliotych anatoliliotych left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, re-read https://github.com/rubocop-hq/ruby-style-guide and fix rubocop issues.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

end

s = Price.new
s.find

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingBlankLines: Final newline missing.

if a.empty?
puts"No product with similar price"
else
str = a.map { |r| "#{r.to_s.capitalize.gsub(/\s+/, " ")}" }.join(', ')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/UnneededInterpolation: Prefer to_s over string interpolation.
Style/StringLiteralsInInterpolation: Prefer single-quoted strings inside interpolations.


def old_price(file)
date = get_date(file)
(true) if date[1].to_i < 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/RedundantParentheses: Don't use parentheses around a literal.

max_out(max, @max_dat)
end

def similar

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/AbcSize: Assignment Branch Condition size for similar is too high. [15.65/15]

dat = get_date(f)
old_price(f) ? coef = 0.0001 : coef = 1
f.each_with_index do |_, i|
if f.row(i)[0] == @name.upcase || f.row(i)[0] =~ /#{@name.upcase}[.,) ]{1}/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/Next: Use next to skip iteration.

out
end

def min

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/AbcSize: Assignment Branch Condition size for min is too high. [28.3/15]
Metrics/CyclomaticComplexity: Cyclomatic complexity for min is too high. [7/6]
Metrics/MethodLength: Method has too many lines. [17/10]

@l = 0
@c.each_with_index do |mas, i|
mas.each_with_index do |arr, j|
if mas[0] != nil && mas[0] == @name.upcase || mas[0] =~ /#{@name.upcase}[.,) ]{1}/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/IfUnlessModifier: Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

'декабрь': '12'}
end

def find

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/AbcSize: Assignment Branch Condition size for find is too high. [16.31/15]
Metrics/MethodLength: Method has too many lines. [12/10]

@date = { 'январь': '01', 'февраль': '02', 'март': '03', 'апрель': '04',
'май': '05', 'июнь': '06', 'июль': '07', 'август': '08',
'сентябрь': '09', 'октябрь': '10', 'ноябрь': '11',
'декабрь': '12'}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideHashLiteralBraces: Space inside } missing.

require 'roo'
require 'roo-xls'

class Price

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/ClassLength: Class has too many lines. [121/100]

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

max = @pr
all_files
@all.each do |f|
unless f.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/Next: Use next to skip iteration.

min_out(min, @min_dat)
end

def max

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/AbcSize: Assignment Branch Condition size for max is too high. [27.35/15]
Metrics/CyclomaticComplexity: Cyclomatic complexity for max is too high. [7/6]
Metrics/MethodLength: Method has too many lines. [17/10]

min = @pr
all_files
@all.each do |f|
unless f.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/Next: Use next to skip iteration.

out
end

def min

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/AbcSize: Assignment Branch Condition size for min is too high. [27.35/15]
Metrics/CyclomaticComplexity: Cyclomatic complexity for min is too high. [7/6]
Metrics/MethodLength: Method has too many lines. [17/10]

'декабрь': '12' }
end

def find

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/AbcSize: Assignment Branch Condition size for find is too high. [17.23/15]

require 'roo'
require 'roo-xls'

class Price

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/ClassLength: Class has too many lines. [117/100]

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some files could not be reviewed due to errors:

Error: We found some problems with your configuration file: [/IrresponsibleMo...
Error: We found some problems with your configuration file: [/IrresponsibleModule] key 'IrresponsibleModule:' is undefined., [/DuplicateMethodCall] key 'DuplicateMethodCall:' is undefined., [/UtilityFunction] key 'UtilityFunction:' is undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants