Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

2253-1 #179

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

2253-1 #179

wants to merge 170 commits into from

Conversation

Ctalk3r
Copy link
Contributor

@Ctalk3r Ctalk3r commented Jul 11, 2018

Номер

2253

Номер задания

1

Ссылка на видео с демо

https://youtu.be/FsAk0R4Ow7E

Комментарии

Локально стиль в норме

@message_array = []
end

def method_missing(method_name, *args, &block)

Choose a reason for hiding this comment

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

Style/MethodMissing: When using method_missing, define respond_to_missing? and fall back on super.

# of the Proxy class is given in the AboutProxyObjectProject koan.

# rubocop:disable Style/MethodMissingSuper
# rubocop:disable Style/MissingRespondToMissing

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 Style/MissingRespondToMissing (unknown cop).

# missing handler and any other supporting methods. The specification
# of the Proxy class is given in the AboutProxyObjectProject koan.

# rubocop:disable Style/MethodMissingSuper

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 Style/MethodMissingSuper (did you mean Style/SingleLineMethods?).

end

# Error class used in part 2. No need to change this code.
class TriangleError < StandardError

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

assert_equal true, symbol1.object_id == symbol2.object_id
end

# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

# ------------------------------------------------------------------

# rubocop:disable MethodMissingSuper
# rubocop:disable Style/MissingRespondToMissing

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 Style/MissingRespondToMissing (unknown cop).


# ------------------------------------------------------------------

# rubocop:disable MethodMissingSuper

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 MethodMissingSuper (unknown cop).

assert mc.send(:caught?)
end

# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

@@ -0,0 +1,32 @@
require File.expand_path(File.dirname(__FILE__) + '/neo')

# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

assert_equal Object, MySpecialError.ancestors[4]
end

# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

# ------------------------------------------------------------------

# rubocop:disable MethodMissingSuper
# rubocop:disable Style/MissingRespondToMissing

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 Style/MissingRespondToMissing (unknown cop).


# ------------------------------------------------------------------

# rubocop:disable MethodMissingSuper

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 MethodMissingSuper (unknown cop).

:class_level_wag
end

# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

class WellBehavedFooCatcher
def method_missing(method_name, *args, &block)
if method_name.to_s[0, 3] == 'foo'
'Foo to you too'

Choose a reason for hiding this comment

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

Style/MethodMissing: When using method_missing, define respond_to_missing? and fall back on super.

# rubocop:disable MethodMissingSuper
# rubocop:disable Style/MissingRespondToMissing
# :nodoc:
class WellBehavedFooCatcher

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 Style/MissingRespondToMissing (unknown cop).


# rubocop:disable MethodMissingSuper
# rubocop:disable Style/MissingRespondToMissing
# :nodoc:

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 MethodMissingSuper (unknown cop).


# rubocop:disable Metrics/LineLength
def test_all_messages_are_caught
catcher = AllMessageCatcher.new

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 Metrics/LineLength.

class AllMessageCatcher
def method_missing(method_name, *args)
"Someone called #{method_name} with <#{args.join(', ')}>"
end

Choose a reason for hiding this comment

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

Style/MethodMissing: When using method_missing, define respond_to_missing? and fall back on super.

# rubocop:disable MethodMissingSuper
# rubocop:disable Style/MissingRespondToMissing
# :nodoc:
class AllMessageCatcher

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 Style/MissingRespondToMissing (unknown cop).


# rubocop:disable MethodMissingSuper
# rubocop:disable Style/MissingRespondToMissing
# :nodoc:

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 MethodMissingSuper (unknown cop).


# rubocop:disable Metrics/LineLength
def method_with_keyword_arguments_with_mandatory_argument(one, two: 2, three: 3)
# rubocop:enable Metrics/LineLength

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 2 instead of 4).

assert_equal [1, 2], method_with_keyword_arguments(two: 2)
end

# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

# :nodoc:
class WellBehavedFooCatcher
# rubocop:disable MethodMissing
# rubocop:disable Style/MissingRespondToMissing

Choose a reason for hiding this comment

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

Style/MethodMissing: When using method_missing, define respond_to_missing? and fall back on super.


# ------------------------------------------------------------------

# :nodoc:

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 Style/MissingRespondToMissing (unknown cop).

end

# ------------------------------------------------------------------

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 MethodMissingSuper (unknown cop).

# rubocop:enable MethodMissing
end


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 Metrics/LineLength.

class AllMessageCatcher
# rubocop:disable MethodMissing
# rubocop:disable Style/MissingRespondToMissing
def method_missing(method_name, *args)

Choose a reason for hiding this comment

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

Style/MethodMissing: When using method_missing, define respond_to_missing? and fall back on super.

# ------------------------------------------------------------------

# :nodoc:
class AllMessageCatcher

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 Style/MissingRespondToMissing (unknown cop).


# ------------------------------------------------------------------

# :nodoc:

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 MethodMissingSuper (unknown cop).

assert_equal true, ex.is_a?(StandardError), 'Should be a Standard Error'
assert_equal true, ex.is_a?(RuntimeError), 'Should be a Runtime Error'

# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

# :nodoc:
class WellBehavedFooCatcher
# rubocop:disable MethodMissing
# rubocop:disable Style/MissingRespondToMissing

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 Style/MissingRespondToMissing (unknown cop).


assert_equal 'Someone called foobar with <>', catcher.foobar
assert_equal 'Someone called foobaz with <1>', catcher.foobaz(1)
# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

# rubocop:enable MethodMissing
end


Choose a reason for hiding this comment

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

Layout/EmptyLines: Extra blank line detected.

end

def test_gsub_is_like_find_and_replace_all
# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

end

def test_sub_is_like_find_and_replace
# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

end

def test_gsub_is_like_find_and_replace_all
# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.

end

def test_sub_is_like_find_and_replace
# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.


def test_method_names_become_symbols
symbols_as_strings = Symbol.all_symbols.map(&:to_s)
# rubocop:disable Metrics/LineLength

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 Metrics/LineLength.


# Error class used in part 2. No need to change this code.
# rubocop:disable Lint/Syntax
class TriangleError < StandardError

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

end

# rubocop:disable Style/MethodMissing
# rubocop:disable Style/MissingRespondToMissing

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 Style/MissingRespondToMissing (unknown cop).

@message_array = []
end

# rubocop:disable Style/MethodMissing

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 Style/MethodMissing.

if method_name.to_s[0, 3] == 'foo'
'Foo to you too'
else
super(method_name, *args, &block)

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 Style/MissingRespondToMissing (unknown cop).


# :nodoc:
class WellBehavedFooCatcher
def method_missing(method_name, *args, &block)

Choose a reason for hiding this comment

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

Style/MethodMissing: When using method_missing, define respond_to_missing? and fall back on super.

"Someone called #{method_name} with <#{args.join(', ')}>"
end
end
# rubocop:enable Style/MethodMissing

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 0 instead of 2).

@taleh007
Copy link
Collaborator

taleh007 commented Jul 11, 2018

@Ctalk3r тебе необходимо сделать rebase c последним мастером этого репозитория
ищи помощь в чате

Чини собаку

Коммиты с одинаковым названием не должны быть один за одним

# :scalene if no sides are equal
#
def triangle(fir, sec, thi)
raise TriangleError if [fir, sec, thi].min <= 0 || fir + sec <= thi || fir + thi <= sec || sec + thi <= fir

Choose a reason for hiding this comment

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

FeatureEnvy: triangle refers to 'fir' more than self (maybe move it to another class?). More info.

assert_equal :false_stuff, truth_value(nil)
end

def test_everything_else_is_treated_as_true

Choose a reason for hiding this comment

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

TooManyStatements: AboutTrueAndFalse#test_everything_else_is_treated_as_true has approx 6 statements. More info.

# :nodoc:
class AboutTrueAndFalse < Neo::Koan
def truth_value(condition)
if condition

Choose a reason for hiding this comment

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

ControlParameter: AboutTrueAndFalse#truth_value is controlled by argument 'condition'. More info.

require './triangle.rb'

# :nodoc:
class AboutTriangleProject2 < Neo::Koan

Choose a reason for hiding this comment

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

UncommunicativeModuleName: AboutTriangleProject2 has the name 'AboutTriangleProject2'. More info.

class AboutTriangleProject2 < Neo::Koan
# The first assignment did not talk about how to handle errors.
# Let's handle that part now.
def test_illegal_triangles_throw_exceptions

Choose a reason for hiding this comment

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

TooManyStatements: AboutTriangleProject2#test_illegal_triangles_throw_exceptions has approx 8 statements. More info.

end

def test_identical_symbols_are_a_single_internal_object
symbol1 = :a_symbol

Choose a reason for hiding this comment

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

UncommunicativeVariableName: AboutSymbols#test_identical_symbols_are_a_single_internal_object has the variable name 'symbol1'. More info.


def test_symbols_do_not_have_string_methods
symbol = :not_a_string
assert_equal false, symbol.respond_to?(:each_char)

Choose a reason for hiding this comment

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

ManualDispatch: AboutSymbols#test_symbols_do_not_have_string_methods manually dispatches method call. More info.

assert_equal true, a == b
end

# rubocop:disable Style/PercentLiteralDelimiters

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 Style/PercentLiteralDelimiters.

def test_use_flexible_quoting_to_handle_really_hard_cases
a = %(flexible quotes can handle both ' and " characters)
b = %!flexible quotes can handle both ' and " characters!
c = %{flexible quotes can handle both ' and " characters}

Choose a reason for hiding this comment

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

UncommunicativeVariableName: AboutStrings#test_use_flexible_quoting_to_handle_really_hard_cases has the variable name 'c'. More info.

# rubocop:disable Style/PercentLiteralDelimiters
def test_use_flexible_quoting_to_handle_really_hard_cases
a = %(flexible quotes can handle both ' and " characters)
b = %!flexible quotes can handle both ' and " characters!

Choose a reason for hiding this comment

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

UncommunicativeVariableName: AboutStrings#test_use_flexible_quoting_to_handle_really_hard_cases has the variable name 'b'. More info.

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

Successfully merging this pull request may close these issues.

3 participants