summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Fazekas <mfazekas@szemafor.com>2016-12-11 13:40:11 +0100
committerMiklos Fazekas <mfazekas@szemafor.com>2016-12-15 17:59:40 +0100
commit48d314f7f42333385d9c234f3c9332297d7352a0 (patch)
treefb883dcf206dc2957e066c6799f56404d8c5b736
parentc0dd903f5648039370615fe800cfa85facda46a7 (diff)
downloadnet-ssh-48d314f7f42333385d9c234f3c9332297d7352a0.tar.gz
Rubocop update to 0.46.0
-rw-r--r--.rubocop_todo.yml370
-rw-r--r--Gemfile2
-rw-r--r--Rakefile2
-rw-r--r--lib/net/ssh/authentication/key_manager.rb2
-rw-r--r--lib/net/ssh/authentication/pageant.rb18
-rw-r--r--lib/net/ssh/buffer.rb2
-rw-r--r--lib/net/ssh/config.rb2
-rw-r--r--lib/net/ssh/connection/event_loop.rb20
-rw-r--r--lib/net/ssh/connection/session.rb4
-rw-r--r--lib/net/ssh/errors.rb12
-rw-r--r--lib/net/ssh/prompt.rb10
-rw-r--r--lib/net/ssh/transport/algorithms.rb3
-rw-r--r--net-ssh.gemspec3
-rw-r--r--test/common.rb3
-rw-r--r--test/integration/test_forward.rb70
-rw-r--r--test/start/test_options.rb4
-rw-r--r--test/transport/test_algorithms.rb10
-rw-r--r--test/transport/test_cipher_factory.rb3
-rw-r--r--test/transport/test_packet_stream.rb2
19 files changed, 283 insertions, 259 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 9afab70..a998015 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,12 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
-# on 2016-03-30 13:23:48 +0200 using RuboCop version 0.39.0.
+# on 2016-12-11 13:27:14 +0100 using RuboCop version 0.46.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 9
+# Offense count: 4
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
@@ -14,7 +14,7 @@ Lint/AssignmentInCondition:
- 'lib/net/ssh/connection/session.rb'
- 'lib/net/ssh/proxy/command.rb'
-# Offense count: 2
+# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AlignWith, SupportedStyles.
# SupportedStyles: either, start_of_block, start_of_line
@@ -28,14 +28,19 @@ Lint/DeprecatedClassMethods:
Exclude:
- 'Rakefile'
-# Offense count: 217
+# Offense count: 1
+Lint/EmptyWhen:
+ Exclude:
+ - 'lib/net/ssh/config.rb'
+
+# Offense count: 223
# Cop supports --auto-correct.
# Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
# SupportedStyles: keyword, variable, start_of_line
Lint/EndAlignment:
Enabled: false
-# Offense count: 12
+# Offense count: 8
Lint/HandleExceptions:
Exclude:
- 'lib/net/ssh/authentication/session.rb'
@@ -43,7 +48,6 @@ Lint/HandleExceptions:
- 'lib/net/ssh/transport/openssl.rb'
- 'test/integration/common.rb'
- 'test/integration/test_forward.rb'
- - 'test/manual/test_pageant.rb'
- 'test/start/test_connection.rb'
- 'test/start/test_transport.rb'
@@ -53,7 +57,7 @@ Lint/ImplicitStringConcatenation:
- 'lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb'
- 'lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb'
-# Offense count: 3
+# Offense count: 1
Lint/LiteralInCondition:
Exclude:
- 'lib/net/ssh/authentication/pageant.rb'
@@ -64,12 +68,6 @@ Lint/Loop:
- 'lib/net/ssh/authentication/methods/password.rb'
- 'lib/net/ssh/key_factory.rb'
-# Offense count: 12
-Lint/NestedMethodDefinition:
- Exclude:
- - 'lib/net/ssh/transport/ctr.rb'
- - 'test/authentication/methods/test_keyboard_interactive.rb'
-
# Offense count: 1
Lint/NextWithoutAccumulator:
Exclude:
@@ -87,14 +85,19 @@ Lint/RescueException:
- 'lib/net/ssh/service/forward.rb'
- 'lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb'
+# Offense count: 2
+Lint/ShadowedException:
+ Exclude:
+ - 'lib/net/ssh/authentication/key_manager.rb'
+
# Offense count: 1
Lint/UnderscorePrefixedVariableName:
Exclude:
- 'lib/net/ssh/test/local_packet.rb'
-# Offense count: 53
+# Offense count: 52
# Cop supports --auto-correct.
-# Configuration parameters: IgnoreEmptyBlocks.
+# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Exclude:
- 'lib/net/ssh/connection/keepalive.rb'
@@ -108,67 +111,72 @@ Lint/UnusedBlockArgument:
- 'test/transport/test_algorithms.rb'
- 'test/transport/test_hmac.rb'
-# Offense count: 44
+# Offense count: 50
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
Enabled: false
# Offense count: 3
+# Configuration parameters: ContextCreatingMethods.
Lint/UselessAccessModifier:
Exclude:
- 'lib/net/ssh/buffered_io.rb'
- 'lib/net/ssh/connection/channel.rb'
- 'lib/net/ssh/transport/session.rb'
-# Offense count: 12
+# Offense count: 10
Lint/UselessAssignment:
Exclude:
- - 'lib/net/ssh/key_factory.rb'
- 'lib/net/ssh/proxy/socks4.rb'
- 'lib/net/ssh/proxy/socks5.rb'
- 'test/integration/common.rb'
- 'test/integration/test_forward.rb'
-# Offense count: 185
+# Offense count: 196
Metrics/AbcSize:
- Max: 91
+ Max: 76
-# Offense count: 2
+# Offense count: 14
+# Configuration parameters: CountComments.
+Metrics/BlockLength:
+ Max: 88
+
+# Offense count: 1
Metrics/BlockNesting:
Max: 4
-# Offense count: 31
+# Offense count: 27
# Configuration parameters: CountComments.
Metrics/ClassLength:
- Max: 1130
+ Max: 548
# Offense count: 34
Metrics/CyclomaticComplexity:
Max: 39
-# Offense count: 1275
-# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
+# Offense count: 1341
+# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 934
-# Offense count: 166
+# Offense count: 164
# Configuration parameters: CountComments.
Metrics/MethodLength:
- Max: 99
+ Max: 93
-# Offense count: 3
+# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ModuleLength:
- Max: 155
+ Max: 142
# Offense count: 1
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 6
-# Offense count: 28
+# Offense count: 27
Metrics/PerceivedComplexity:
Max: 23
@@ -192,19 +200,18 @@ Performance/RedundantMatch:
- 'lib/net/ssh/key_factory.rb'
- 'lib/net/ssh/transport/server_version.rb'
-# Offense count: 14
+# Offense count: 13
Style/AccessorMethodName:
Exclude:
- 'lib/net/ssh/authentication/methods/password.rb'
- 'lib/net/ssh/authentication/pageant.rb'
- 'lib/net/ssh/connection/session.rb'
- - 'lib/net/ssh/prompt.rb'
- 'lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb'
- 'lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb'
- 'lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb'
- 'lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb'
-# Offense count: 3
+# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: prefer_alias, prefer_alias_method
@@ -212,7 +219,6 @@ Style/Alias:
Exclude:
- 'lib/net/ssh/connection/session.rb'
- 'lib/net/ssh/service/forward.rb'
- - 'lib/net/ssh/transport/ctr.rb'
# Offense count: 1
# Cop supports --auto-correct.
@@ -235,28 +241,42 @@ Style/AlignHash:
- 'test/transport/test_cipher_factory.rb'
- 'test/transport/test_state.rb'
-# Offense count: 76
+# Offense count: 72
# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
+# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: with_first_parameter, with_fixed_indentation
Style/AlignParameters:
Enabled: false
-# Offense count: 46
+# Offense count: 33
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: always, conditionals
Style/AndOr:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh/authentication/key_manager.rb'
+ - 'lib/net/ssh/buffer.rb'
+ - 'lib/net/ssh/buffered_io.rb'
+ - 'lib/net/ssh/config.rb'
+ - 'lib/net/ssh/connection/channel.rb'
+ - 'lib/net/ssh/connection/session.rb'
+ - 'lib/net/ssh/key_factory.rb'
+ - 'lib/net/ssh/service/forward.rb'
+ - 'lib/net/ssh/test/channel.rb'
+ - 'lib/net/ssh/test/script.rb'
+ - 'lib/net/ssh/transport/cipher_factory.rb'
+ - 'lib/net/ssh/transport/hmac.rb'
+ - 'lib/net/ssh/transport/key_expander.rb'
+ - 'lib/net/ssh/transport/packet_stream.rb'
+ - 'test/common.rb'
-# Offense count: 3
+# Offense count: 2
Style/AsciiComments:
Exclude:
- - 'lib/net/ssh/authentication/agent/java_pageant.rb'
- 'lib/net/ssh/authentication/pageant.rb'
- 'lib/net/ssh/buffered_io.rb'
-# Offense count: 32
+# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining
@@ -298,7 +318,16 @@ Style/CaseEquality:
# Configuration parameters: IndentWhenRelativeTo, SupportedStyles, IndentOneStep, IndentationWidth.
# SupportedStyles: case, end
Style/CaseIndentation:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh.rb'
+ - 'lib/net/ssh/authentication/methods/hostbased.rb'
+ - 'lib/net/ssh/authentication/methods/none.rb'
+ - 'lib/net/ssh/authentication/methods/password.rb'
+ - 'lib/net/ssh/authentication/methods/publickey.rb'
+ - 'lib/net/ssh/buffer.rb'
+ - 'lib/net/ssh/config.rb'
+ - 'lib/net/ssh/test/local_packet.rb'
+ - 'lib/net/ssh/test/packet.rb'
# Offense count: 1
# Cop supports --auto-correct.
@@ -322,26 +351,11 @@ Style/ClassAndModuleCamelCase:
- 'test/transport/hmac/test_sha2_512.rb'
- 'test/transport/hmac/test_sha2_512_96.rb'
-# Offense count: 15
+# Offense count: 16
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
- Exclude:
- - 'lib/net/ssh/transport/ctr.rb'
- - 'lib/net/ssh/transport/hmac.rb'
- - 'lib/net/ssh/transport/hmac/md5.rb'
- - 'lib/net/ssh/transport/hmac/md5_96.rb'
- - 'lib/net/ssh/transport/hmac/none.rb'
- - 'lib/net/ssh/transport/hmac/ripemd160.rb'
- - 'lib/net/ssh/transport/hmac/sha1.rb'
- - 'lib/net/ssh/transport/hmac/sha1_96.rb'
- - 'lib/net/ssh/transport/hmac/sha2_256.rb'
- - 'lib/net/ssh/transport/hmac/sha2_256_96.rb'
- - 'lib/net/ssh/transport/hmac/sha2_512.rb'
- - 'lib/net/ssh/transport/hmac/sha2_512_96.rb'
- - 'lib/net/ssh/transport/kex.rb'
- - 'lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb'
- - 'lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha256.rb'
+ Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
@@ -397,11 +411,10 @@ Style/ConditionalAssignment:
- 'lib/net/ssh/proxy/socks5.rb'
- 'lib/net/ssh/test/script.rb'
-# Offense count: 8
+# Offense count: 5
Style/ConstantName:
Exclude:
- 'lib/net/ssh/authentication/pageant.rb'
- - 'lib/net/ssh/prompt.rb'
- 'lib/net/ssh/transport/kex/diffie_hellman_group14_sha1.rb'
- 'lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb'
- 'lib/net/ssh/transport/openssl.rb'
@@ -412,14 +425,7 @@ Style/DefWithParentheses:
Exclude:
- 'test/integration/test_forward.rb'
-# Offense count: 3
-# Cop supports --auto-correct.
-Style/DeprecatedHashMethods:
- Exclude:
- - 'lib/net/ssh/connection/session.rb'
- - 'test/transport/test_packet_stream.rb'
-
-# Offense count: 29
+# Offense count: 16
Style/Documentation:
Exclude:
- 'spec/**/*'
@@ -442,9 +448,11 @@ Style/Documentation:
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: leading, trailing
Style/DotPosition:
- Enabled: false
+ Exclude:
+ - 'test/transport/test_algorithms.rb'
# Offense count: 3
+# Cop supports --auto-correct.
Style/EachWithObject:
Exclude:
- 'lib/net/ssh/config.rb'
@@ -469,7 +477,7 @@ Style/EmptyLineBetweenDefs:
- 'test/test_buffer.rb'
- 'test/test_key_factory.rb'
-# Offense count: 22
+# Offense count: 16
# Cop supports --auto-correct.
Style/EmptyLines:
Exclude:
@@ -488,27 +496,26 @@ Style/EmptyLines:
- 'test/test_known_hosts.rb'
- 'test/transport/test_cipher_factory.rb'
-# Offense count: 48
+# Offense count: 39
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: empty_lines, no_empty_lines
+# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
Style/EmptyLinesAroundClassBody:
Enabled: false
-# Offense count: 5
+# Offense count: 4
# Cop supports --auto-correct.
Style/EmptyLinesAroundMethodBody:
Exclude:
- 'lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb'
- 'lib/net/ssh/transport/openssl.rb'
- - 'test/authentication/methods/test_keyboard_interactive.rb'
- 'test/transport/hmac/test_sha2_256.rb'
- 'test/transport/hmac/test_sha2_512.rb'
# Offense count: 209
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: empty_lines, no_empty_lines
+# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
Style/EmptyLinesAroundModuleBody:
Enabled: false
@@ -525,7 +532,7 @@ Style/EvenOdd:
Exclude:
- 'lib/net/ssh/buffer.rb'
-# Offense count: 28
+# Offense count: 17
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Style/ExtraSpacing:
@@ -542,7 +549,7 @@ Style/ExtraSpacing:
- 'test/test_key_factory.rb'
- 'test/transport/test_packet_stream.rb'
-# Offense count: 3
+# Offense count: 2
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: format, sprintf, percent
Style/FormatString:
@@ -550,50 +557,17 @@ Style/FormatString:
- 'lib/net/ssh/authentication/pageant.rb'
- 'lib/net/ssh/loggable.rb'
-
-# Offense count: 11
+# Offense count: 35
# Configuration parameters: MinBodyLength.
Style/GuardClause:
- Exclude:
- - 'lib/net/ssh.rb'
- - 'lib/net/ssh/buffered_io.rb'
- - 'lib/net/ssh/connection/channel.rb'
- - 'lib/net/ssh/key_factory.rb'
- - 'lib/net/ssh/service/forward.rb'
- - 'lib/net/ssh/transport/openssl.rb'
- - 'lib/net/ssh/transport/algorithms.rb'
- - 'lib/net/ssh/test/script.rb'
- - 'lib/net/ssh/authentication/agent/socket.rb'
- - 'lib/net/ssh/authentication/pageant.rb'
- - 'lib/net/ssh/authentication/buffer.rb'
- - 'lib/net/ssh/authentication/config.rb'
- - 'lib/net/ssh/connection/keepalive.rb'
- - 'lib/net/ssh/connection/session.rb'
- - 'lib/net/ssh/buffer.rb'
- - 'lib/net/ssh/proxy/command.rb'
- - 'lib/net/ssh/proxy/socks5.rb'
- - 'lib/net/ssh/transport/packet_stream.rb'
- - 'lib/net/ssh/transport/server_version.rb'
- - 'lib/net/ssh/transport/session.rb'
- - 'test/authentication/test_key_manager.rb'
- - 'test/common.rb'
- - 'lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb'
-
-# Offense count: 338
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
-# SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
-Style/HashSyntax:
- Enabled: true
- EnforcedStyle: ruby19
+ Enabled: false
-# Offense count: 2
+# Offense count: 1
Style/IfInsideElse:
Exclude:
- 'lib/net/ssh/connection/session.rb'
- - 'lib/net/ssh/key_factory.rb'
-# Offense count: 8
+# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: MaxLineLength.
Style/IfUnlessModifier:
@@ -612,7 +586,8 @@ Style/IfUnlessModifier:
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Style/IndentArray:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh/transport/openssl.rb'
# Offense count: 4
# Cop supports --auto-correct.
@@ -624,14 +599,14 @@ Style/IndentAssignment:
- 'test/transport/kex/test_ecdh_sha2_nistp384.rb'
- 'test/transport/kex/test_ecdh_sha2_nistp521.rb'
-# Offense count: 216
+# Offense count: 227
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: normal, rails
Style/IndentationConsistency:
Enabled: false
-# Offense count: 93
+# Offense count: 96
# Cop supports --auto-correct.
# Configuration parameters: Width.
Style/IndentationWidth:
@@ -643,7 +618,7 @@ Style/InfiniteLoop:
Exclude:
- 'lib/net/ssh/authentication/pageant.rb'
-# Offense count: 33
+# Offense count: 17
# Cop supports --auto-correct.
Style/LeadingCommentSpace:
Exclude:
@@ -652,7 +627,7 @@ Style/LeadingCommentSpace:
- 'test/integration/test_id_rsa_keys.rb'
- 'test/integration/test_proxy.rb'
-# Offense count: 29
+# Offense count: 27
# Cop supports --auto-correct.
Style/LineEndConcatenation:
Exclude:
@@ -662,7 +637,7 @@ Style/LineEndConcatenation:
- 'lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb'
- 'lib/net/ssh/verifiers/secure.rb'
-# Offense count: 52
+# Offense count: 12
# Cop supports --auto-correct.
Style/MethodCallParentheses:
Exclude:
@@ -676,13 +651,27 @@ Style/MethodCallParentheses:
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline
Style/MethodDefParentheses:
- Enabled: false
+ Exclude:
+ - 'test/common.rb'
+ - 'test/integration/common.rb'
-# Offense count: 22
+# Offense count: 1
+Style/MethodMissing:
+ Exclude:
+ - 'lib/net/ssh/connection/session.rb'
+
+# Offense count: 24
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: snake_case, camelCase
Style/MethodName:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh/authentication/ed25519_loader.rb'
+ - 'test/authentication/test_agent.rb'
+ - 'test/authentication/test_session.rb'
+ - 'test/common.rb'
+ - 'test/connection/test_channel.rb'
+ - 'test/test_config.rb'
+ - 'test/test_key_factory.rb'
# Offense count: 3
# Cop supports --auto-correct.
@@ -691,30 +680,33 @@ Style/MultilineIfThen:
- 'lib/net/ssh/buffered_io.rb'
- 'lib/net/ssh/service/forward.rb'
-# Offense count: 24
+# Offense count: 23
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented
Style/MultilineOperationIndentation:
- Enabled: false
-
-# Offense count: 1
-Style/MultilineTernaryOperator:
Exclude:
- - 'lib/net/ssh/authentication/agent.rb'
+ - 'lib/net/ssh/authentication/pageant.rb'
+ - 'lib/net/ssh/known_hosts.rb'
+ - 'lib/net/ssh/proxy/https.rb'
+ - 'lib/net/ssh/transport/algorithms.rb'
+ - 'lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb'
+ - 'lib/net/ssh/transport/state.rb'
+ - 'lib/net/ssh/verifiers/secure.rb'
+ - 'test/authentication/methods/test_hostbased.rb'
+ - 'test/authentication/methods/test_publickey.rb'
-# Offense count: 49
+# Offense count: 40
# Cop supports --auto-correct.
Style/MutableConstant:
Enabled: false
-# Offense count: 14
+# Offense count: 13
# Cop supports --auto-correct.
Style/NegatedIf:
Exclude:
- 'lib/net/ssh.rb'
- 'lib/net/ssh/authentication/key_manager.rb'
- - 'lib/net/ssh/prompt.rb'
- 'lib/net/ssh/service/forward.rb'
- 'lib/net/ssh/transport/algorithms.rb'
- 'lib/net/ssh/transport/hmac/abstract.rb'
@@ -730,11 +722,6 @@ Style/NegatedWhile:
- 'lib/net/ssh/config.rb'
# Offense count: 2
-Style/NestedTernaryOperator:
- Exclude:
- - 'lib/net/ssh/authentication/agent.rb'
-
-# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
# SupportedStyles: skip_modifier_ifs, always
@@ -750,24 +737,40 @@ Style/NilComparison:
- 'lib/net/ssh/proxy/command.rb'
- 'lib/net/ssh/transport/openssl.rb'
-# Offense count: 4
+# Offense count: 3
# Cop supports --auto-correct.
Style/Not:
Exclude:
- 'lib/net/ssh/connection/channel.rb'
-# Offense count: 6
+# Offense count: 7
# Cop supports --auto-correct.
Style/NumericLiterals:
MinDigits: 310
+# Offense count: 11
+# Cop supports --auto-correct.
+# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
+# SupportedStyles: predicate, comparison
+Style/NumericPredicate:
+ Exclude:
+ - 'spec/**/*'
+ - 'lib/net/ssh/authentication/methods/password.rb'
+ - 'lib/net/ssh/authentication/pageant.rb'
+ - 'lib/net/ssh/buffer.rb'
+ - 'lib/net/ssh/service/forward.rb'
+ - 'lib/net/ssh/test/extensions.rb'
+ - 'lib/net/ssh/transport/key_expander.rb'
+ - 'test/transport/test_packet_stream.rb'
+ - 'test_connection_close_shall_close_cannels.rb'
+
# Offense count: 2
Style/OpMethod:
Exclude:
- 'lib/net/ssh/buffer.rb'
- 'lib/net/ssh/version.rb'
-# Offense count: 16
+# Offense count: 15
# Cop supports --auto-correct.
Style/ParallelAssignment:
Exclude:
@@ -792,7 +795,7 @@ Style/ParenthesesAroundCondition:
- 'lib/net/ssh/transport/ctr.rb'
- 'test/integration/test_proxy.rb'
-# Offense count: 9
+# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
@@ -801,7 +804,7 @@ Style/PercentLiteralDelimiters:
- 'net-ssh.gemspec'
- 'test/test_config.rb'
-# Offense count: 17
+# Offense count: 16
# Cop supports --auto-correct.
Style/PerlBackrefs:
Exclude:
@@ -827,16 +830,17 @@ Style/Proc:
- 'test/connection/test_session.rb'
# Offense count: 7
+# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: compact, exploded
Style/RaiseArgs:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh/authentication/ed25519.rb'
-# Offense count: 8
+# Offense count: 4
# Cop supports --auto-correct.
Style/RedundantBegin:
Exclude:
- - 'lib/net/ssh/authentication/agent/socket.rb'
- 'lib/net/ssh/buffered_io.rb'
- 'lib/net/ssh/verifiers/strict.rb'
- 'test/manual/test_pageant.rb'
@@ -847,7 +851,7 @@ Style/RedundantParentheses:
Exclude:
- 'support/arcfour_check.rb'
-# Offense count: 49
+# Offense count: 57
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
@@ -870,13 +874,13 @@ Style/RescueModifier:
- 'lib/net/ssh/service/forward.rb'
- 'lib/net/ssh/transport/algorithms.rb'
-# Offense count: 2
+# Offense count: 1
# Cop supports --auto-correct.
Style/SelfAssignment:
Exclude:
- 'lib/net/ssh/config.rb'
-# Offense count: 10
+# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: AllowAsExpressionSeparator.
Style/Semicolon:
@@ -902,7 +906,7 @@ Style/SingleLineMethods:
Exclude:
- 'lib/net/ssh/buffered_io.rb'
-# Offense count: 17
+# Offense count: 16
# Cop supports --auto-correct.
Style/SpaceAfterColon:
Exclude:
@@ -910,19 +914,19 @@ Style/SpaceAfterColon:
- 'test/integration/test_ed25519_pkeys.rb'
- 'test/verifiers/test_secure.rb'
-# Offense count: 247
+# Offense count: 254
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Enabled: false
-# Offense count: 131
+# Offense count: 132
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Style/SpaceAroundEqualsInParameterDefault:
Enabled: false
-# Offense count: 56
+# Offense count: 55
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Style/SpaceAroundOperators:
@@ -933,7 +937,11 @@ Style/SpaceAroundOperators:
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Style/SpaceBeforeBlockBraces:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh/authentication/session.rb'
+ - 'support/ssh_tunnel_bug.rb'
+ - 'test/authentication/test_agent.rb'
+ - 'test/connection/test_session.rb'
# Offense count: 4
# Cop supports --auto-correct.
@@ -951,14 +959,20 @@ Style/SpaceBeforeFirstArg:
- 'lib/net/ssh/transport/hmac/sha2_512_96.rb'
- 'test/authentication/test_key_manager.rb'
-# Offense count: 30
+# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
Style/SpaceInsideBlockBraces:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh/authentication/session.rb'
+ - 'lib/net/ssh/transport/ctr.rb'
+ - 'support/ssh_tunnel_bug.rb'
+ - 'test/authentication/test_agent.rb'
+ - 'test/authentication/test_key_manager.rb'
+ - 'test/start/test_user_nil.rb'
-# Offense count: 40
+# Offense count: 22
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Exclude:
@@ -968,10 +982,10 @@ Style/SpaceInsideBrackets:
- 'test/integration/test_forward.rb'
- 'test/start/test_options.rb'
-# Offense count: 46
+# Offense count: 69
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
-# SupportedStyles: space, no_space
+# SupportedStyles: space, no_space, compact
Style/SpaceInsideHashLiteralBraces:
Enabled: false
@@ -989,35 +1003,34 @@ Style/SpaceInsideRangeLiteral:
- 'lib/net/ssh/authentication/ed25519.rb'
- 'lib/net/ssh/transport/algorithms.rb'
-# Offense count: 40
+# Offense count: 22
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: use_perl_names, use_english_names
Style/SpecialGlobalVars:
- Enabled: false
+ Exclude:
+ - 'lib/net/ssh/authentication/agent.rb'
+ - 'lib/net/ssh/connection/session.rb'
+ - 'support/ssh_tunnel_bug.rb'
+ - 'test/integration/common.rb'
+ - 'test/integration/test_forward.rb'
+ - 'test/manual/test_pageant.rb'
+ - 'test/test_all.rb'
+ - 'test_connection_close_shall_close_cannels.rb'
+ - 'test_kerberos_client2.rb'
-# Offense count: 1739
+# Offense count: 1846
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Enabled: false
-# Offense count: 1
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles.
-# SupportedStyles: single_quotes, double_quotes
-Style/StringLiteralsInInterpolation:
- Enabled: false
-
-# Offense count: 17
+# Offense count: 11
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
-# IgnoredMethods: respond_to, on_close
+# IgnoredMethods: respond_to, define_method
Style/SymbolProc:
- IgnoredMethods:
- - respond_to
- - on_close
Exclude:
- 'lib/net/ssh/authentication/session.rb'
- 'lib/net/ssh/buffer.rb'
@@ -1025,6 +1038,7 @@ Style/SymbolProc:
- 'lib/net/ssh/test/extensions.rb'
- 'lib/net/ssh/transport/algorithms.rb'
- 'test/integration/test_forward.rb'
+ - 'test/test/test_test.rb'
# Offense count: 1
# Cop supports --auto-correct.
@@ -1032,7 +1046,7 @@ Style/Tab:
Exclude:
- 'lib/net/ssh/config.rb'
-# Offense count: 41
+# Offense count: 39
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: final_newline, final_blank_line
@@ -1051,12 +1065,12 @@ Style/TrailingCommaInLiteral:
- 'lib/net/ssh/transport/openssl.rb'
- 'test/transport/test_packet_stream.rb'
-# Offense count: 120
+# Offense count: 66
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Enabled: false
-# Offense count: 2
+# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
# Whitelist: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
@@ -1097,7 +1111,7 @@ Style/WhileUntilDo:
- 'lib/net/ssh/config.rb'
- 'test/integration/common.rb'
-# Offense count: 2
+# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, WordRegex.
# SupportedStyles: percent, brackets
diff --git a/Gemfile b/Gemfile
index c8047b5..aaa8066 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,6 +8,6 @@ if !Gem.win_platform? && RUBY_ENGINE == "mri"
end
if ENV["CI"]
- gem 'simplecov', require: false, group: :test
gem 'codecov', require: false, group: :test
+ gem 'simplecov', require: false, group: :test
end
diff --git a/Rakefile b/Rakefile
index 7249906..5317e0a 100644
--- a/Rakefile
+++ b/Rakefile
@@ -29,7 +29,7 @@ name = "net-ssh"
require_relative "lib/net/ssh/version"
version = Net::SSH::Version::CURRENT
-extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt ]
+extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt]
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "#{name} #{version}"
diff --git a/lib/net/ssh/authentication/key_manager.rb b/lib/net/ssh/authentication/key_manager.rb
index f324b7c..1b9ad92 100644
--- a/lib/net/ssh/authentication/key_manager.rb
+++ b/lib/net/ssh/authentication/key_manager.rb
@@ -140,7 +140,7 @@ module Net
if info[:key].nil? && info[:from] == :file
begin
info[:key] = KeyFactory.load_private_key(info[:file], options[:passphrase], !options[:non_interactive])
- rescue Exception, OpenSSL::OpenSSLError => e
+ rescue OpenSSL::OpenSSLError, Exception => e
raise KeyManagerError, "the given identity is known, but the private key could not be loaded: #{e.class} (#{e.message})"
end
end
diff --git a/lib/net/ssh/authentication/pageant.rb b/lib/net/ssh/authentication/pageant.rb
index 3f63db4..1826e9a 100644
--- a/lib/net/ssh/authentication/pageant.rb
+++ b/lib/net/ssh/authentication/pageant.rb
@@ -250,12 +250,15 @@ module Net; module SSH; module Authentication
psd_information = malloc_ptr(Win::SECURITY_DESCRIPTOR.size)
raise_error_if_zero(
Win.InitializeSecurityDescriptor(psd_information,
- Win::REVISION))
+ Win::REVISION)
+ )
raise_error_if_zero(
Win.SetSecurityDescriptorOwner(psd_information, get_sid_ptr(user),
- 0))
+ 0)
+ )
raise_error_if_zero(
- Win.IsValidSecurityDescriptor(psd_information))
+ Win.IsValidSecurityDescriptor(psd_information)
+ )
sa = Win::SECURITY_ATTRIBUTES.new(to_struct_ptr(malloc_ptr(Win::SECURITY_ATTRIBUTES.size)))
sa.nLength = Win::SECURITY_ATTRIBUTES.size
@@ -337,7 +340,8 @@ module Net; module SSH; module Authentication
raise_error_if_zero(
Win.OpenProcessToken(process_handle, desired_access,
- ptoken_handle))
+ ptoken_handle)
+ )
token_handle = ptr_to_handle(ptoken_handle)
return token_handle
end
@@ -362,7 +366,8 @@ module Net; module SSH; module Authentication
token_information_class,
ptoken_information,
ptoken_information.size,
- preturn_length))
+ preturn_length)
+ )
return to_token_user(ptoken_information)
end
@@ -430,8 +435,7 @@ module Net; module SSH; module Authentication
@output_buffer.read(n)
end
- def close
- end
+ def close; end
# Packages the given query string and sends it to the pageant
# process via the Windows messaging subsystem. The result is
diff --git a/lib/net/ssh/buffer.rb b/lib/net/ssh/buffer.rb
index 86f1a85..1db5f24 100644
--- a/lib/net/ssh/buffer.rb
+++ b/lib/net/ssh/buffer.rb
@@ -162,7 +162,7 @@ module Net; module SSH
index = @content.index(pattern, @position) or return nil
length = case pattern
when String then pattern.length
- when Fixnum then 1
+ when Integer then 1
when Regexp then $&.length
end
index && read(index+length)
diff --git a/lib/net/ssh/config.rb b/lib/net/ssh/config.rb
index 4d8cf77..7b1e939 100644
--- a/lib/net/ssh/config.rb
+++ b/lib/net/ssh/config.rb
@@ -280,7 +280,7 @@ module Net; module SSH
else size.to_i
end
end
-
+
def merge_challenge_response_with_keyboard_interactive(hash)
if hash[:auth_methods].include?('challenge-response')
hash[:auth_methods].delete('challenge-response')
diff --git a/lib/net/ssh/connection/event_loop.rb b/lib/net/ssh/connection/event_loop.rb
index 5892bce..f9d95ea 100644
--- a/lib/net/ssh/connection/event_loop.rb
+++ b/lib/net/ssh/connection/event_loop.rb
@@ -68,14 +68,18 @@ module Net; module SSH; module Connection
fired_sessions = {}
- readers.each do |reader|
- session = owners[reader]
- (fired_sessions[session] ||= {r: [],w: []})[:r] << reader
- end if readers
- writers.each do |writer|
- session = owners[writer]
- (fired_sessions[session] ||= {r: [],w: []})[:w] << writer
- end if writers
+ if readers
+ readers.each do |reader|
+ session = owners[reader]
+ (fired_sessions[session] ||= {r: [],w: []})[:r] << reader
+ end
+ end
+ if writers
+ writers.each do |writer|
+ session = owners[writer]
+ (fired_sessions[session] ||= {r: [],w: []})[:w] << writer
+ end
+ end
fired_sessions.each do |s,rw|
s.ev_do_handle_events(rw[:r],rw[:w])
diff --git a/lib/net/ssh/connection/session.rb b/lib/net/ssh/connection/session.rb
index 596811b..07b4daf 100644
--- a/lib/net/ssh/connection/session.rb
+++ b/lib/net/ssh/connection/session.rb
@@ -78,8 +78,8 @@ module Net; module SSH; module Connection
@on_global_request = {}
@properties = (options[:properties] || {}).dup
- @max_pkt_size = (options.has_key?(:max_pkt_size) ? options[:max_pkt_size] : 0x8000)
- @max_win_size = (options.has_key?(:max_win_size) ? options[:max_win_size] : 0x20000)
+ @max_pkt_size = (options.key?(:max_pkt_size) ? options[:max_pkt_size] : 0x8000)
+ @max_win_size = (options.key?(:max_win_size) ? options[:max_win_size] : 0x20000)
@keepalive = Keepalive.new(self)
diff --git a/lib/net/ssh/errors.rb b/lib/net/ssh/errors.rb
index 910c961..84bcbdf 100644
--- a/lib/net/ssh/errors.rb
+++ b/lib/net/ssh/errors.rb
@@ -5,14 +5,14 @@ module Net; module SSH
# This exception is raised when authentication fails (whether it be
# public key authentication, password authentication, or whatever).
- class AuthenticationFailed < Exception; end
+ class AuthenticationFailed < Net::SSH::Exception; end
# This exception is raised when a connection attempt times out.
- class ConnectionTimeout < Exception; end
+ class ConnectionTimeout < Net::SSH::Exception; end
# This exception is raised when the remote host has disconnected
# unexpectedly.
- class Disconnect < Exception; end
+ class Disconnect < Net::SSH::Exception; end
# This exception is raised when the remote host has disconnected/
# timeouted unexpectedly.
@@ -23,14 +23,14 @@ module Net; module SSH
# want to fail in such a way that the server knows it failed, you can
# raise this exception in the handler and Net::SSH will translate that into
# a "channel failure" message.
- class ChannelRequestFailed < Exception; end
+ class ChannelRequestFailed < Net::SSH::Exception; end
# This is exception is primarily used internally, but if you have a channel
# open handler (see Net::SSH::Connection::Session#on_open_channel) and you
# want to fail in such a way that the server knows it failed, you can
# raise this exception in the handler and Net::SSH will translate that into
# a "channel open failed" message.
- class ChannelOpenFailed < Exception
+ class ChannelOpenFailed < Net::SSH::Exception
attr_reader :code, :reason
def initialize(code, reason)
@@ -42,7 +42,7 @@ module Net; module SSH
# Base class for host key exceptions. When rescuing this exception, you can
# inspect the key fingerprint and, if you want to proceed anyway, simply call
# the remember_host! method on the exception, and then retry.
- class HostKeyError < Exception
+ class HostKeyError < Net::SSH::Exception
# the callback to use when #remember_host! is called
attr_writer :callback #:nodoc:
diff --git a/lib/net/ssh/prompt.rb b/lib/net/ssh/prompt.rb
index 54b4d85..3c552cb 100644
--- a/lib/net/ssh/prompt.rb
+++ b/lib/net/ssh/prompt.rb
@@ -24,14 +24,13 @@ module Net; module SSH
@default ||= new(options)
end
- def initialize(options = {})
- end
+ def initialize(options = {}); end
# default prompt object implementation. More sophisticated implemenetations
# might implement caching.
class Prompter
def initialize(info)
- if info[:type] == 'keyboard-interactive' # rubocop:disable Style/GuardClause
+ if info[:type] == 'keyboard-interactive'
$stdout.puts(info[:name]) unless info[:name].empty?
$stdout.puts(info[:instruction]) unless info[:instruction].empty?
end
@@ -49,8 +48,7 @@ module Net; module SSH
# success method will be called when the password was accepted
# It's a good time to save password asked to a cache.
- def success
- end
+ def success; end
end
# start password session. Multiple questions might be asked multiple times
@@ -61,4 +59,4 @@ module Net; module SSH
end
end
-end; end \ No newline at end of file
+end; end
diff --git a/lib/net/ssh/transport/algorithms.rb b/lib/net/ssh/transport/algorithms.rb
index 7e941a6..9658b8f 100644
--- a/lib/net/ssh/transport/algorithms.rb
+++ b/lib/net/ssh/transport/algorithms.rb
@@ -34,8 +34,7 @@ module Net; module SSH; module Transport
aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se
idea-cbc none arcfour128 arcfour256 arcfour
aes128-ctr aes192-ctr aes256-ctr
- cast128-ctr blowfish-ctr 3des-ctr
- ),
+ cast128-ctr blowfish-ctr 3des-ctr),
hmac: %w(hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96
hmac-ripemd160 hmac-ripemd160@openssh.com
diff --git a/net-ssh.gemspec b/net-ssh.gemspec
index eddc13e..adf57e8 100644
--- a/net-ssh.gemspec
+++ b/net-ssh.gemspec
@@ -35,8 +35,9 @@ Gem::Specification.new do |spec|
end
spec.add_development_dependency "bundler", "~> 1.11"
+
spec.add_development_dependency "rake", "~> 12.0"
spec.add_development_dependency "minitest", "~> 5.10"
- spec.add_development_dependency "rubocop", "~> 0.39.0"
+ spec.add_development_dependency "rubocop", "~> 0.46.0"
spec.add_development_dependency "mocha", ">= 1.2.1"
end
diff --git a/test/common.rb b/test/common.rb
index e84a624..05b6110 100644
--- a/test/common.rb
+++ b/test/common.rb
@@ -62,8 +62,7 @@ class MockPrompt
_ask(message, @info, echo)
end
- def success
- end
+ def success; end
end
class MockTransport < Net::SSH::Transport::Session
diff --git a/test/integration/test_forward.rb b/test/integration/test_forward.rb
index 38587dd..f98e5fd 100644
--- a/test/integration/test_forward.rb
+++ b/test/integration/test_forward.rb
@@ -225,44 +225,48 @@ class TestForward < NetSSHTest
end
end
- def create_local_socket(&blk)
- tempfile = Tempfile.new("net_ssh_forward_test")
- path = tempfile.path
- tempfile.delete
- yield UNIXServer.open(path)
- File.delete(path)
- end if defined?(UNIXServer)
-
- def test_forward_local_unix_socket_to_remote_port
- setup_ssh_env do
- session = Net::SSH.start(*ssh_start_params)
- server_exc = Queue.new
- server = start_server_sending_lot_of_data(server_exc)
- remote_port = server.addr[1]
- client_data = nil
-
- create_local_socket do |local_socket|
- session.forward.local(local_socket, localhost, remote_port)
- client_done = Queue.new
+ if defined?(UNIXServer)
+ def create_local_socket(&blk)
+ tempfile = Tempfile.new("net_ssh_forward_test")
+ path = tempfile.path
+ tempfile.delete
+ yield UNIXServer.open(path)
+ File.delete(path)
+ end
+ end
- Thread.start do
- begin
- client = UNIXSocket.new(local_socket.path)
- client_data = client.recv(1024)
- client.close
- sleep(0.2)
- ensure
- client_done << true
+ if defined?(UNIXSocket)
+ def test_forward_local_unix_socket_to_remote_port
+ setup_ssh_env do
+ session = Net::SSH.start(*ssh_start_params)
+ server_exc = Queue.new
+ server = start_server_sending_lot_of_data(server_exc)
+ remote_port = server.addr[1]
+ client_data = nil
+
+ create_local_socket do |local_socket|
+ session.forward.local(local_socket, localhost, remote_port)
+ client_done = Queue.new
+
+ Thread.start do
+ begin
+ client = UNIXSocket.new(local_socket.path)
+ client_data = client.recv(1024)
+ client.close
+ sleep(0.2)
+ ensure
+ client_done << true
+ end
end
+
+ session.loop(0.1) { client_done.empty? }
end
- session.loop(0.1) { client_done.empty? }
+ assert_not_nil(client_data, "client should have received data")
+ assert(client_data.match(/item\d/), 'client should have received the string item')
end
-
- assert_not_nil(client_data, "client should have received data")
- assert(client_data.match(/item\d/), 'client should have received the string item')
end
- end if defined?(UNIXSocket)
+ end
def test_loop_should_not_abort_when_server_side_of_forward_is_closed
setup_ssh_env do
@@ -388,7 +392,7 @@ class TestForward < NetSSHTest
Timeout.timeout(5) do
begin
session.loop(0.1) { true }
- rescue EOFError, IOError, Errno::EBADF
+ rescue IOError, Errno::EBADF
server_error = $!
#puts "Error: #{$!} #{$!.backtrace.join("\n")}"
end
diff --git a/test/start/test_options.rb b/test/start/test_options.rb
index 366c852..f0a88fb 100644
--- a/test/start/test_options.rb
+++ b/test/start/test_options.rb
@@ -54,14 +54,14 @@ module NetSSH
end
def test_constructor_should_reject_options_set_to_nil
- Kernel.expects(:warn).with { |message| message =~ /remote_user/}.once
+ Kernel.expects(:warn).with { |message| message =~ /remote_user/ }.once
options = { remote_user: nil }
Net::SSH.start('localhost', 'testuser', options)
end
def test_constructor_should_reject_options_set_to_array_of_nil
- Kernel.expects(:warn).with { |message| message =~ /keys/}.once
+ Kernel.expects(:warn).with { |message| message =~ /keys/ }.once
ENV.delete('no-such-env-variable')
Net::SSH.start('localhost', 'testuser', keys: [ENV['no-such-env-variable']])
diff --git a/test/transport/test_algorithms.rb b/test/transport/test_algorithms.rb
index 610fa4d..278c285 100644
--- a/test/transport/test_algorithms.rb
+++ b/test/transport/test_algorithms.rb
@@ -41,7 +41,7 @@ module Transport
def test_constructor_with_known_hosts_reporting_known_host_key_should_use_that_host_key_type
Net::SSH::KnownHosts.expects(:search_for).with("net.ssh.test,127.0.0.1", {}).returns([stub("key", ssh_type: "ssh-dss")])
- assert_equal %w(ssh-dss ssh-rsa ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com )+ec_ed_host_keys, algorithms[:host_key]
+ assert_equal %w(ssh-dss ssh-rsa ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com)+ec_ed_host_keys, algorithms[:host_key]
end
def ed_host_keys
@@ -65,7 +65,7 @@ module Transport
end
def test_constructor_with_unrecognized_host_key_type_should_return_whats_supported
- assert_equal %w(ssh-rsa ssh-dss ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com )+ec_ed_host_keys, algorithms(host_key: "bogus ssh-rsa",append_all_supported_algorithms: true)[:host_key]
+ assert_equal %w(ssh-rsa ssh-dss ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com)+ec_ed_host_keys, algorithms(host_key: "bogus ssh-rsa",append_all_supported_algorithms: true)[:host_key]
end
def ec_kex
@@ -82,7 +82,8 @@ module Transport
def test_constructor_with_unrecognized_kex_should_not_raise_exception
assert_equal %w(diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256)+ec_kex, algorithms(
- kex: %w(bogus diffie-hellman-group1-sha1),append_all_supported_algorithms: true)[:kex]
+ kex: %w(bogus diffie-hellman-group1-sha1),append_all_supported_algorithms: true
+ )[:kex]
end
def test_constructor_with_preferred_encryption_should_put_preferred_encryption_first
@@ -122,7 +123,8 @@ module Transport
def test_constructor_with_general_preferred_compression_should_put_none_last
assert_equal %w(zlib@openssh.com zlib none), algorithms(
- compression: true, append_all_supported_algorithms: true)[:compression]
+ compression: true, append_all_supported_algorithms: true
+ )[:compression]
end
def test_constructor_with_unrecognized_compression_should_return_whats_supported
diff --git a/test/transport/test_cipher_factory.rb b/test/transport/test_cipher_factory.rb
index 0e59a7b..bbc6525 100644
--- a/test/transport/test_cipher_factory.rb
+++ b/test/transport/test_cipher_factory.rb
@@ -298,8 +298,7 @@ module Transport
key: "abc",
digester: OpenSSL::Digest::MD5,
shared: "1234567890123456780",
- hash: '!@#$%#$^%$&^&%#$@$'
- }
+ hash: '!@#$%#$^%$&^&%#$@$'}
def factory
Net::SSH::Transport::CipherFactory
diff --git a/test/transport/test_packet_stream.rb b/test/transport/test_packet_stream.rb
index 4867a79..77d6528 100644
--- a/test/transport/test_packet_stream.rb
+++ b/test/transport/test_packet_stream.rb
@@ -1125,7 +1125,7 @@ module Transport
hmacs = Net::SSH::Transport::HMAC::MAP.keys
ciphers.each do |cipher_name|
- unless Net::SSH::Transport::CipherFactory.supported?(cipher_name) && PACKETS.has_key?(cipher_name)
+ unless Net::SSH::Transport::CipherFactory.supported?(cipher_name) && PACKETS.key?(cipher_name)
puts "Skipping packet stream test for #{cipher_name}"
next
end