-
Notifications
You must be signed in to change notification settings - Fork 43
2355 - 2 #243
base: master
Are you sure you want to change the base?
2355 - 2 #243
Conversation
2355/2/top_words.rb
Outdated
@top_words = {} | ||
end | ||
|
||
# This method smells of :reek:NestedIterators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/CommentIndentation: Incorrect indentation detected (column 1 instead of 2).
2355/2/top_bad_words.rb
Outdated
def average_bad_words_in_battle(battler) | ||
top_obscenity["#{battler}"] / (Dir[File.join("./rap-battles/#{battler}/", '**', '*')].count { |file| File.file?(file) }) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/Syntax: unexpected token kEND
2355/2/top_bad_words.rb
Outdated
# This method smells of :reek:DuplicateMethodCall | ||
def set_top_obscenity | ||
0.upto(battlers.size - 1) do |index | ||
check = FindObscenity.new(@battlers[indexx]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/Syntax: unexpected token tIDENTIFIER
2355/2/top_bad_words.rb
Outdated
# rubocop:disable Lint/Syntax | ||
# This class is needed for first level of Task 2 | ||
# This class smells of :reek:Attribute | ||
class TopBad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/Syntax: class definition in method body
2355/2/top_bad_words.rb
Outdated
# This method smells of :reek:DuplicateMethodCall | ||
def set_top_obscenity | ||
0.upto(battlers.size - 1) do |index | ||
check = FindObscenity.new(@battlers[indexx]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax: This file has unexpected token tIDENTIFIER. More info.
2355/2/top_bad_words.rb
Outdated
def average_bad_words_in_battle(battler) | ||
top_obscenity["#{battler}"] / (Dir[File.join("./rap-battles/#{battler}/", '**', '*')].count { |file| File.file?(file) }) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax: This file has unexpected token kEND. More info.
2355/2/top_bad_words.rb
Outdated
# rubocop:disable Lint/Syntax | ||
# This class is needed for first level of Task 2 | ||
# This class smells of :reek:Attribute | ||
class TopBad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax: This file has class definition in method body. More info.
2355/2/top_bad_words.rb
Outdated
def average_bad_words_in_battle(battler) | ||
top_obscenity["#{battler}"] / (Dir[File.join("./rap-battles/#{battler}/", '**', '*')].count { |file| File.file?(file) }) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/Syntax: unexpected token kEND
2355/2/top_bad_words.rb
Outdated
# This method smells of :reek:DuplicateMethodCall | ||
def set_top_obscenity | ||
0.upto(battlers.size - 1) do |index | ||
check = FindObscenity.new(@battlers[indexx]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/Syntax: unexpected token tIDENTIFIER
2355/2/top_bad_words.rb
Outdated
# rubocop:disable Lint/Syntax | ||
# This class is needed for first level of Task 2 | ||
# This class smells of :reek:Attribute | ||
class TopBad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/Syntax: class definition in method body
2355/2/top_bad_words.rb
Outdated
# This method smells of :reek:DuplicateMethodCall | ||
def set_top_obscenity | ||
0.upto(battlers.size - 1) do |index | ||
check = FindObscenity.new(@battlers[indexx]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax: This file has unexpected token tIDENTIFIER. More info.
2355/2/top_bad_words.rb
Outdated
def average_bad_words_in_battle(battler) | ||
top_obscenity["#{battler}"] / (Dir[File.join("./rap-battles/#{battler}/", '**', '*')].count { |file| File.file?(file) }) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax: This file has unexpected token kEND. More info.
2355/2/top_bad_words.rb
Outdated
# rubocop:disable Lint/Syntax | ||
# This class is needed for first level of Task 2 | ||
# This class smells of :reek:Attribute | ||
class TopBad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syntax: This file has class definition in method body. More info.
2355/2/top_bad_words.rb
Outdated
@@ -0,0 +1,50 @@ | |||
require './find_obscenity.rb' | |||
|
|||
# rubocop:disable Lint/UnusedBlockArgument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/UnneededCopDisableDirective: Unnecessary disabling of Lint/UnusedBlockArgument.
2355/2/find_obscenity.rb
Outdated
# rubocop:enable Metrics/AbcSize | ||
# rubocop:enable Style/IfUnlessModifier | ||
# rubocop:enable Lint/ImplicitStringConcatenation | ||
|
There was a problem hiding this comment.
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.
Please, fix commit history, removing files with another commit is useless. |
2355/2/find_obscenity.rb
Outdated
@@ -0,0 +1,58 @@ | |||
require 'russian_obscenity' | |||
|
|||
# rubocop:disable Metrics/MethodLength |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these checks should be removed.
2355/2/find_obscenity.rb
Outdated
require 'russian_obscenity' | ||
|
||
# This class is needed to find and collect all obscenity from text files | ||
class FindObscenity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't name classes with verbs.
2355/2/main.rb
Outdated
else | ||
1 | ||
end | ||
top = TopBad.new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn't look like OOP. you've just moved all methods to class and calling them.
2355/2/main.rb
Outdated
end | ||
end | ||
end.parse! | ||
# rubocop:enable Metrics/BlockLength |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf?
2355/2/top_words.rb
Outdated
end | ||
end | ||
|
||
# This method smells of :reek:DuplicateMethodCall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf?
2355/2/top_words.rb
Outdated
end | ||
end | ||
|
||
# This method smells of :reek:DuplicateMethodCall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf?
2355/2/top_bad_words.rb
Outdated
file.each { |line| @battlers << line.delete("\n") } | ||
end | ||
|
||
# This method smells of :reek:UtilityFunction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf?
2355/2/main.rb
Outdated
require 'optparse' | ||
require 'terminal-table' | ||
|
||
# rubocop:disable Metrics/BlockLength |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf?
2355/2/main.rb
Outdated
require 'terminal-table' | ||
|
||
# rubocop:disable Metrics/BlockLength | ||
# This disable is needed because this block is the main logic of the program. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment means that you just wanted to pass, but not to solve it. Please look through all videos about OOP we had. You should change 'the main logic of the program'
2355/2/find_obscenity.rb
Outdated
end | ||
end | ||
|
||
# This method smells of :reek:NestedIterators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf?
2355/2/find_obscenity.rb
Outdated
File.new('./mistakes').each { |line| @mistakes << line.delete("\n") } | ||
end | ||
|
||
# This method smells of :reek:NestedIterators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wtf?
2355/2/parser.rb
Outdated
@top.average_words_in_round(elem).to_s | ||
end | ||
|
||
def print_table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TooManyStatements: Parser#print_table has approx 6 statements. More info.
2355/2/parser.rb
Outdated
|
||
def print_table | ||
table = Terminal::Table.new do |tb| | ||
@bad_words.times do |index| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NestedIterators: Parser#print_table contains iterators nested 2 deep. More info.
2355/2/parser.rb
Outdated
require 'terminal-table' | ||
|
||
# This class is needed to parsing console params | ||
class Parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2355/2/parser.rb
Outdated
end | ||
|
||
def top_words=(most) | ||
@top_words = !most.empty? ? most.to_i : 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureEnvy: Parser#top_words= refers to 'most' more than self (maybe move it to another class?). More info.
2355/2/parser.rb
Outdated
|
||
def print_top_words | ||
t_w = TopWord.new(@name) | ||
t_w.check_all_words |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureEnvy: Parser#print_top_words refers to 't_w' more than self (maybe move it to another class?). More info.
2355/2/parser.rb
Outdated
end | ||
|
||
def bad_words=(bad) | ||
@bad_words = !bad.empty? ? bad.to_i : 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FeatureEnvy: Parser#bad_words= refers to 'bad' more than self (maybe move it to another class?). More info.
please, don't leave your thoughts and jokes in commit messages. |
it's your personal task to write each commit message to fit these rules: https://chris.beams.io/posts/git-commit/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, look through Lomov's explanation about how to structure the application in terms of OOP.
2355/2/top_bad_words.rb
Outdated
@words_count = 0 | ||
end | ||
|
||
def battlers_names |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you explain logic of this method?
2355/2/top_bad_words.rb
Outdated
1.upto(@dir_count) do |text| | ||
words_in_text(battler, text) | ||
end | ||
@words_count / (@dir_count * 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove magic number
2355/2/top_words.rb
Outdated
@top_words = {} | ||
end | ||
|
||
def dir_count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have code duplication between two classes.
2355/2/README.md
Outdated
@@ -0,0 +1,54 @@ | |||
# Инструкция по применению | |||
|
|||
Запустить в консоли файл __main.rb__ командой __ruby main.rb__, добавив в конце записи необходимые команды. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you read task requirements? how should I guess where to put texts of battles?
2355/2/find_obscenity.rb
Outdated
# I would have each block do-end to make a separate function and call them all one by one, | ||
# but in my opinion, this will lower the readability of the code. | ||
# This method smells of :reek:NestedIterators | ||
def first_check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix all reek smells.
Номер
2355
Номер задания
2
Ссылка на видео с демо
https://youtu.be/wehCfIbeW28
Комментарии
Успел сделать 1 и 2 уровни, но вот как делать третий так и не придумал. Есть одна сложнореализуемая идея, но она требует больше времени.