diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .rubocop.yml | 20 | ||||
-rw-r--r-- | .rubocop_todo.yml | 1241 | ||||
-rw-r--r-- | Gemfile.lock | 44 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | Rakefile | 12 | ||||
-rw-r--r-- | oxidized.gemspec | 2 | ||||
-rw-r--r-- | spec/githubrepo_spec.rb | 9 | ||||
-rw-r--r-- | spec/input/ssh_spec.rb | 2 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 |
10 files changed, 1284 insertions, 51 deletions
@@ -10,6 +10,7 @@ /test/version_tmp/ /tmp/ .idea/ +Gemfile.lock # Used by dotenv library to load environment variables. # .env diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..ad1ca31 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,20 @@ +inherit_from: .rubocop_todo.yml + +AllCops: + Include: + - Rakefile + +StringLiterals: + Enabled: false + +LineLength: + Enabled: false + +# Stick to verbose until https://bugs.ruby-lang.org/issues/10177 is closed. +Style/PreferredHashMethods: + EnforcedStyle: verbose + +AllCops: + Exclude: + - 'vendor/**/*' + - 'lib/oxidized/input/tftp.rb' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..8121015 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,1241 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2018-04-11 13:02:45 +0200 using RuboCop version 0.54.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: 5 +# Cop supports --auto-correct. +# Configuration parameters: Include, TreatCommentsAsGroupSeparators. +# Include: **/*.gemspec +Gemspec/OrderedDependencies: + Exclude: + - 'oxidized.gemspec' + +# Offense count: 1 +# Configuration parameters: Include. +# Include: **/*.gemspec +Gemspec/RequiredRubyVersion: + Exclude: + - 'oxidized.gemspec' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: outdent, indent +Layout/AccessModifierIndentation: + Exclude: + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/AlignHash: + Exclude: + - 'spec/input/ssh_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_parameter, with_fixed_indentation +Layout/AlignParameters: + Exclude: + - 'lib/oxidized/hook.rb' + - 'lib/oxidized/hook/exec.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/worker.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith. +# SupportedStylesAlignWith: either, start_of_block, start_of_line +Layout/BlockAlignment: + Exclude: + - 'lib/oxidized/model/awplus.rb' + - 'lib/oxidized/model/sgos.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Layout/BlockEndNewline: + Exclude: + - 'lib/oxidized/model/awplus.rb' + - 'lib/oxidized/model/hatteras.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth. +# SupportedStyles: case, end +Layout/CaseIndentation: + Exclude: + - 'lib/oxidized/output/http.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/ClosingParenthesisIndentation: + Exclude: + - 'lib/oxidized/output/git.rb' + +# Offense count: 13 +# Cop supports --auto-correct. +Layout/CommentIndentation: + Exclude: + - 'lib/oxidized/model/aosw.rb' + - 'lib/oxidized/model/audiocodes.rb' + - 'lib/oxidized/model/awplus.rb' + - 'lib/oxidized/model/edgeswitch.rb' + - 'lib/oxidized/model/fujitsupy.rb' + - 'lib/oxidized/model/gcombnps.rb' + - 'lib/oxidized/model/masteros.rb' + - 'lib/oxidized/model/planet.rb' + - 'lib/oxidized/output/http.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity. +# SupportedStylesAlignWith: start_of_line, def +Layout/DefEndAlignment: + Exclude: + - 'lib/oxidized/hook/xmppdiff.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Layout/ElseAlignment: + Exclude: + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/output/gitcrypt.rb' + - 'lib/oxidized/source/csv.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'oxidized.gemspec' + +# Offense count: 17 +# Cop supports --auto-correct. +# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines. +Layout/EmptyLineBetweenDefs: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/manager.rb' + - 'lib/oxidized/model/model.rb' + - 'lib/oxidized/nodes.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 17 +# Cop supports --auto-correct. +Layout/EmptyLines: + Exclude: + - 'bin/oxidized' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/model/acsw.rb' + - 'lib/oxidized/model/alvarion.rb' + - 'lib/oxidized/model/gaiaos.rb' + - 'lib/oxidized/model/gcombnps.rb' + - 'lib/oxidized/model/hatteras.rb' + - 'lib/oxidized/model/ironware.rb' + - 'lib/oxidized/model/planet.rb' + - 'lib/oxidized/model/voltaire.rb' + - 'lib/oxidized/nodes.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'lib/oxidized/hook/githubrepo.rb' + - 'lib/oxidized/model/alvarion.rb' + - 'lib/oxidized/model/asyncos.rb' + - 'lib/oxidized/model/audiocodes.rb' + - 'lib/oxidized/model/ciscosma.rb' + - 'lib/oxidized/model/tplink.rb' + - 'spec/input/ssh_spec.rb' + - 'spec/node_spec.rb' + +# Offense count: 158 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Exclude: + - 'lib/oxidized/hook/exec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundMethodBody: + Exclude: + - 'lib/oxidized/output/http.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines +Layout/EmptyLinesAroundModuleBody: + Exclude: + - 'lib/oxidized/input/cli.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith, AutoCorrect, Severity. +# SupportedStylesAlignWith: keyword, variable, start_of_line +Layout/EndAlignment: + Exclude: + - 'lib/oxidized/output/gitcrypt.rb' + - 'lib/oxidized/source/csv.rb' + +# Offense count: 1 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: native, lf, crlf +Layout/EndOfLine: + Exclude: + - 'lib/oxidized/model/br6910.rb' + +# Offense count: 63 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: consistent, special_for_inner_method_call, special_for_inner_method_call_in_parentheses +Layout/FirstParameterIndentation: + Exclude: + - 'lib/oxidized/output/http.rb' + +# Offense count: 11 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: special_inside_parentheses, consistent, align_braces +Layout/IndentHash: + Exclude: + - 'lib/oxidized/hook/awssns.rb' + - 'lib/oxidized/hook/githubrepo.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/output/http.rb' + - 'spec/githubrepo_spec.rb' + - 'spec/node_spec.rb' + +# Offense count: 21 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, rails +Layout/IndentationConsistency: + Exclude: + - 'lib/oxidized/model/acsw.rb' + - 'lib/oxidized/model/awplus.rb' + - 'lib/oxidized/model/fortios.rb' + - 'lib/oxidized/model/hpebladesystem.rb' + - 'lib/oxidized/model/masteros.rb' + - 'lib/oxidized/model/sgos.rb' + - 'lib/oxidized/model/slxos.rb' + - 'lib/oxidized/output/git.rb' + +# Offense count: 116 +# Cop supports --auto-correct. +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Enabled: false + +# Offense count: 109 +# Cop supports --auto-correct. +Layout/LeadingCommentSpace: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/MultilineBlockLayout: + Exclude: + - 'lib/oxidized/model/hatteras.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: symmetrical, new_line, same_line +Layout/MultilineMethodCallBraceLayout: + Exclude: + - 'lib/oxidized/hook/slackdiff.rb' + - 'lib/oxidized/output/git.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/MultilineOperationIndentation: + Exclude: + - 'lib/oxidized/hook.rb' + - 'lib/oxidized/model/awplus.rb' + - 'lib/oxidized/model/hatteras.rb' + - 'lib/oxidized/model/quantaos.rb' + - 'lib/oxidized/model/trango.rb' + +# Offense count: 33 +# Cop supports --auto-correct. +Layout/SpaceAfterComma: + Enabled: false + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleInsidePipes. +# SupportedStylesInsidePipes: space, no_space +Layout/SpaceAroundBlockParameters: + Exclude: + - 'lib/oxidized/model/aos.rb' + - 'lib/oxidized/model/aos7.rb' + - 'lib/oxidized/model/c4cmts.rb' + - 'lib/oxidized/model/coriantgroove.rb' + - 'lib/oxidized/model/dlink.rb' + - 'lib/oxidized/model/enterasys.rb' + - 'lib/oxidized/model/hpebladesystem.rb' + - 'lib/oxidized/model/mtrlrfs.rb' + - 'lib/oxidized/model/xos.rb' + - 'lib/oxidized/model/zhoneolt.rb' + - 'lib/oxidized/node.rb' + +# Offense count: 32 +# Cop supports --auto-correct. +# Configuration parameters: . +# SupportedStyles: space, no_space +Layout/SpaceAroundEqualsInParameterDefault: + EnforcedStyle: no_space + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/SpaceAroundKeyword: + Exclude: + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/model/xos.rb' + +# Offense count: 49 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Layout/SpaceAroundOperators: + Enabled: false + +# Offense count: 15 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Exclude: + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/model/aos.rb' + - 'lib/oxidized/model/aos7.rb' + - 'lib/oxidized/model/c4cmts.rb' + - 'lib/oxidized/model/coriantgroove.rb' + - 'lib/oxidized/model/dlink.rb' + - 'lib/oxidized/model/enterasys.rb' + - 'lib/oxidized/model/hpebladesystem.rb' + - 'lib/oxidized/model/mtrlrfs.rb' + - 'lib/oxidized/model/xos.rb' + - 'lib/oxidized/model/zhoneolt.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/output/output.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Layout/SpaceBeforeComma: + Exclude: + - 'lib/oxidized/hook/exec.rb' + - 'lib/oxidized/model/fortios.rb' + +# Offense count: 25 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Layout/SpaceBeforeFirstArg: + Enabled: false + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/input/telnet.rb' + - 'oxidized.gemspec' + +# Offense count: 31 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Enabled: false + +# Offense count: 23 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'lib/oxidized/hook/slackdiff.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + - 'lib/oxidized/output/http.rb' + - 'spec/githubrepo_spec.rb' + - 'spec/input/ssh_spec.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +Layout/SpaceInsideParens: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/model/asa.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Layout/SpaceInsidePercentLiteralDelimiters: + Exclude: + - 'oxidized.gemspec' + +# Offense count: 6 +# Cop supports --auto-correct. +Layout/SpaceInsideRangeLiteral: + Exclude: + - 'lib/oxidized/input/telnet.rb' + +# Offense count: 302 +# Cop supports --auto-correct. +# Configuration parameters: IndentationWidth. +Layout/Tab: + Exclude: + - 'lib/oxidized/model/asyncos.rb' + - 'lib/oxidized/model/ciscosma.rb' + - 'lib/oxidized/model/cumulus.rb' + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingBlankLines: + Exclude: + - 'lib/oxidized/model/aen.rb' + - 'lib/oxidized/model/apc_aos.rb' + - 'lib/oxidized/model/firewareos.rb' + - 'lib/oxidized/model/gcombnps.rb' + - 'lib/oxidized/model/hpemsa.rb' + - 'lib/oxidized/model/mtrlrfs.rb' + - 'lib/oxidized/model/tplink.rb' + - 'lib/oxidized/output/http.rb' + +# Offense count: 165 +# Cop supports --auto-correct. +Layout/TrailingWhitespace: + Enabled: false + +# Offense count: 4 +Lint/AmbiguousBlockAssociation: + Exclude: + - 'lib/oxidized/model/model.rb' + - 'lib/oxidized/model/nos.rb' + +# Offense count: 648 +Lint/AmbiguousRegexpLiteral: + Enabled: false + +# Offense count: 8 +# Configuration parameters: AllowSafeAssignment. +Lint/AssignmentInCondition: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Lint/DeprecatedClassMethods: + Exclude: + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/output/file.rb' + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 3 +Lint/HandleExceptions: + Exclude: + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 2 +Lint/LiteralAsCondition: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/core.rb' + +# Offense count: 4 +Lint/ParenthesesAsGroupedExpression: + Exclude: + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/model/aricentiss.rb' + - 'lib/oxidized/model/asa.rb' + - 'lib/oxidized/model/ios.rb' + +# Offense count: 3 +Lint/ShadowingOuterLocalVariable: + Exclude: + - 'lib/oxidized/model/fortios.rb' + - 'lib/oxidized/model/planet.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Lint/StringConversionInInterpolation: + Exclude: + - 'lib/oxidized/hook/slackdiff.rb' + - 'lib/oxidized/hook/xmppdiff.rb' + +# Offense count: 10 +Lint/UnderscorePrefixedVariableName: + Exclude: + - 'lib/oxidized/input/cli.rb' + - 'lib/oxidized/manager.rb' + - 'lib/oxidized/model/model.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'lib/oxidized/hook/githubrepo.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'lib/oxidized/core.rb' + - 'lib/oxidized/hook.rb' + - 'lib/oxidized/output/file.rb' + +# Offense count: 12 +Lint/UselessAssignment: + Exclude: + - 'lib/oxidized/model/cumulus.rb' + - 'lib/oxidized/model/edgeos.rb' + - 'lib/oxidized/model/gaiaos.rb' + - 'lib/oxidized/model/mlnxos.rb' + - 'lib/oxidized/model/procurve.rb' + - 'lib/oxidized/model/trango.rb' + - 'lib/oxidized/model/voltaire.rb' + - 'lib/oxidized/model/vyatta.rb' + - 'lib/oxidized/model/zhoneolt.rb' + - 'lib/oxidized/output/gitcrypt.rb' + - 'lib/oxidized/output/http.rb' + - 'lib/oxidized/source/csv.rb' + +# Offense count: 1 +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'lib/oxidized/model/voss.rb' + +# Offense count: 60 +Metrics/AbcSize: + Max: 86 + +# Offense count: 15 +# Configuration parameters: CountComments, ExcludedMethods. +Metrics/BlockLength: + Max: 143 + +# Offense count: 4 +# Configuration parameters: CountBlocks. +Metrics/BlockNesting: + Max: 4 + +# Offense count: 7 +# Configuration parameters: CountComments. +Metrics/ClassLength: + Max: 210 + +# Offense count: 13 +Metrics/CyclomaticComplexity: + Max: 28 + +# Offense count: 53 +# Configuration parameters: CountComments. +Metrics/MethodLength: + Max: 72 + +# Offense count: 2 +# Configuration parameters: CountKeywordArgs. +Metrics/ParameterLists: + Max: 6 + +# Offense count: 14 +Metrics/PerceivedComplexity: + Max: 32 + +# Offense count: 1 +Naming/AccessorMethodName: + Exclude: + - 'lib/oxidized/string.rb' + +# Offense count: 1 +Naming/ClassAndModuleCamelCase: + Exclude: + - 'lib/oxidized/model/apc_aos.rb' + +# Offense count: 8 +Naming/ConstantName: + Exclude: + - 'extra/rest_client.rb' + - 'lib/oxidized/config.rb' + - 'lib/oxidized/hook.rb' + - 'lib/oxidized/input/ftp.rb' + - 'lib/oxidized/input/input.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/input/telnet.rb' + +# Offense count: 1 +Naming/MemoizedInstanceVariableName: + Exclude: + - 'lib/oxidized/string.rb' + +# Offense count: 3 +# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros. +# NamePrefix: is_, has_, have_ +# NamePrefixBlacklist: is_, has_, have_ +# NameWhitelist: is_a? +# MethodDefinitionMacros: define_method, define_singleton_method +Naming/PredicateName: + Exclude: + - 'spec/**/*' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/worker.rb' + +# Offense count: 11 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: io, id, to +Naming/UncommunicativeMethodParamName: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/input/cli.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/model/model.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Performance/Casecmp: + Exclude: + - 'lib/oxidized/manager.rb' + +# Offense count: 57 +# Cop supports --auto-correct. +Performance/RedundantMatch: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: MaxKeyValuePairs. +Performance/RedundantMerge: + Exclude: + - 'lib/oxidized/hook/exec.rb' + - 'lib/oxidized/input/telnet.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +Performance/StringReplacement: + Exclude: + - 'lib/oxidized/model/awplus.rb' + - 'lib/oxidized/model/comware.rb' + - 'lib/oxidized/model/sros.rb' + +# Offense count: 1 +Security/Eval: + Exclude: + - 'Rakefile' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect. +Security/JSONLoad: + Exclude: + - 'extra/nagios_check_failing_nodes.rb' + +# Offense count: 5 +Security/Open: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/output/file.rb' + - 'lib/oxidized/source/csv.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: prefer_alias, prefer_alias_method +Style/Alias: + Exclude: + - 'lib/oxidized/node.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 46 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, conditionals +Style/AndOr: + Enabled: false + +# Offense count: 1 +# Configuration parameters: AllowedChars. +Style/AsciiComments: + Exclude: + - 'lib/oxidized/hook/slackdiff.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'lib/oxidized/hook/xmppdiff.rb' + - 'lib/oxidized/model/aricentiss.rb' + - 'lib/oxidized/model/hatteras.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: braces, no_braces, context_dependent +Style/BracesAroundHashParameters: + Exclude: + - 'lib/oxidized/hook/awssns.rb' + - 'lib/oxidized/hook/githubrepo.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/model/procurve.rb' + - 'lib/oxidized/output/http.rb' + - 'spec/githubrepo_spec.rb' + - 'spec/input/ssh_spec.rb' + - 'spec/node_spec.rb' + +# Offense count: 3 +Style/CaseEquality: + Exclude: + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/model/model.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle. +# SupportedStyles: nested, compact +Style/ClassAndModuleChildren: + Exclude: + - 'lib/oxidized/config/vars.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: is_a?, kind_of? +Style/ClassCheck: + Exclude: + - 'lib/oxidized/input/telnet.rb' + +# Offense count: 2 +Style/ClassVars: + Exclude: + - 'lib/oxidized.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Style/ColonMethodCall: + Exclude: + - 'lib/oxidized/hook/xmppdiff.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/input/telnet.rb' + +# Offense count: 1 +Style/CommentedKeyword: + Exclude: + - 'lib/oxidized/input/telnet.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'lib/oxidized/hook/githubrepo.rb' + - 'lib/oxidized/model/model.rb' + +# Offense count: 142 +Style/Documentation: + Enabled: false + +# Offense count: 2 +Style/DoubleNegation: + Exclude: + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/hook/exec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'lib/oxidized/hook.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/Encoding: + Exclude: + - 'oxidized.gemspec' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/ExpandPathArguments: + Exclude: + - 'bin/console' + - 'oxidized.gemspec' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Exclude: + - 'lib/oxidized/hook/slackdiff.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 16 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: annotated, template, unannotated +Style/FormatStringToken: + Exclude: + - 'lib/oxidized/node.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 15 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/hook/slackdiff.rb' + - 'lib/oxidized/hook/xmppdiff.rb' + - 'lib/oxidized/input/cli.rb' + - 'lib/oxidized/jobs.rb' + - 'lib/oxidized/nodes.rb' + - 'lib/oxidized/output/file.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + - 'lib/oxidized/output/http.rb' + - 'lib/oxidized/source/http.rb' + - 'lib/oxidized/source/sql.rb' + - 'lib/oxidized/string.rb' + +# Offense count: 104 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + Enabled: false + +# Offense count: 1 +Style/IfInsideElse: + Exclude: + - 'lib/oxidized/output/file.rb' + +# Offense count: 38 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Enabled: false + +# Offense count: 1 +Style/IfUnlessModifierOfIfUnless: + Exclude: + - 'lib/oxidized/input/ssh.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/InfiniteLoop: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/core.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: InverseMethods, InverseBlocks. +Style/InverseMethods: + Exclude: + - 'lib/oxidized/model/aosw.rb' + - 'lib/oxidized/model/asa.rb' + - 'lib/oxidized/model/comware.rb' + - 'lib/oxidized/model/firewareos.rb' + - 'lib/oxidized/model/powerconnect.rb' + - 'lib/oxidized/model/procurve.rb' + - 'lib/oxidized/model/routeros.rb' + - 'lib/oxidized/model/vrp.rb' + - 'lib/oxidized/model/zhoneolt.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/LineEndConcatenation: + Exclude: + - 'lib/oxidized/hook.rb' + +# Offense count: 9 +# Cop supports --auto-correct. +Style/MethodCallWithoutArgsParentheses: + Exclude: + - 'spec/githubrepo_spec.rb' + - 'spec/input/ssh_spec.rb' + +# Offense count: 131 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: require_parentheses, require_no_parentheses, require_no_parentheses_except_multiline +Style/MethodDefParentheses: + Enabled: false + +# Offense count: 2 +# Cop supports --auto-correct. +Style/MultilineIfThen: + Exclude: + - 'lib/oxidized/model/aricentiss.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +Style/MutableConstant: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/hook.rb' + - 'lib/oxidized/input/ftp.rb' + - 'lib/oxidized/input/input.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/version.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: both, prefix, postfix +Style/NegatedIf: + Exclude: + - 'lib/oxidized/model/ios.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + - 'lib/oxidized/worker.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, MinBodyLength. +# SupportedStyles: skip_modifier_ifs, always +Style/Next: + Exclude: + - 'lib/oxidized/model/trango.rb' + - 'lib/oxidized/output/git.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/NilComparison: + Exclude: + - 'lib/oxidized/input/ssh.rb' + +# Offense count: 31 +# Cop supports --auto-correct. +Style/Not: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedOctalStyle. +# SupportedOctalStyles: zero_with_o, zero_only +Style/NumericLiteralPrefix: + Exclude: + - 'lib/oxidized/output/git.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, EnforcedStyle. +# SupportedStyles: predicate, comparison +Style/NumericPredicate: + Exclude: + - 'spec/**/*' + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/core.rb' + - 'lib/oxidized/jobs.rb' + - 'lib/oxidized/nodes.rb' + - 'lib/oxidized/worker.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/OrAssignment: + Exclude: + - 'lib/oxidized/manager.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Style/ParallelAssignment: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/hook/exec.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: AllowSafeAssignment. +Style/ParenthesesAroundCondition: + Exclude: + - 'lib/oxidized/model/ios.rb' + - 'lib/oxidized/model/powerconnect.rb' + - 'lib/oxidized/source/http.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'lib/oxidized/config.rb' + - 'lib/oxidized/input/ssh.rb' + - 'oxidized.gemspec' + - 'spec/nodes_spec.rb' + +# Offense count: 22 +# Cop supports --auto-correct. +Style/PerlBackrefs: + Exclude: + - 'lib/oxidized/model/acos.rb' + - 'lib/oxidized/model/aos7.rb' + - 'lib/oxidized/model/ios.rb' + - 'lib/oxidized/model/junos.rb' + - 'lib/oxidized/model/powerconnect.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: short, verbose +Style/PreferredHashMethods: + Exclude: + - 'lib/oxidized/manager.rb' + - 'lib/oxidized/source/csv.rb' + - 'lib/oxidized/source/http.rb' + - 'lib/oxidized/source/sql.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/Proc: + Exclude: + - 'lib/oxidized/hook/githubrepo.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/manager.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +Style/RedundantParentheses: + Exclude: + - 'lib/oxidized/model/aricentiss.rb' + - 'lib/oxidized/model/ios.rb' + - 'lib/oxidized/model/powerconnect.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'lib/oxidized/node.rb' + - 'lib/oxidized/output/file.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +Style/RedundantSelf: + Exclude: + - 'lib/oxidized/hook.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 29 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: + Enabled: false + +# Offense count: 6 +# Cop supports --auto-correct. +Style/RescueModifier: + Exclude: + - 'bin/oxidized' + - 'extra/syslog.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 19 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'bin/oxidized' + - 'extra/rest_client.rb' + - 'extra/syslog.rb' + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/config.rb' + - 'lib/oxidized/hook.rb' + - 'lib/oxidized/hook/exec.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + - 'lib/oxidized/worker.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +# Configuration parameters: AllowAsExpressionSeparator. +Style/Semicolon: + Exclude: + - 'lib/oxidized/model/ios.rb' + - 'lib/oxidized/output/git.rb' + - 'lib/oxidized/output/gitcrypt.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: use_perl_names, use_english_names +Style/SpecialGlobalVars: + Exclude: + - 'lib/oxidized/cli.rb' + +# Offense count: 1 +Style/StructInheritance: + Exclude: + - 'lib/oxidized/hook.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: respond_to, define_method +Style/SymbolProc: + Exclude: + - 'lib/oxidized/model/datacom.rb' + - 'lib/oxidized/model/hpebladesystem.rb' + - 'lib/oxidized/model/junos.rb' + - 'lib/oxidized/model/outputs.rb' + - 'lib/oxidized/nodes.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'lib/oxidized/hook/exec.rb' + - 'lib/oxidized/output/git.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'lib/oxidized/input/input.rb' + - 'lib/oxidized/input/ssh.rb' + +# Offense count: 11 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: + Exclude: + - 'extra/syslog.rb' + - 'lib/oxidized/config.rb' + - 'lib/oxidized/input/ftp.rb' + - 'lib/oxidized/input/input.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/node.rb' + - 'lib/oxidized/node/stats.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowNamedUnderscoreVariables. +Style/TrailingUnderscoreVariable: + Exclude: + - 'lib/oxidized/node.rb' + - 'lib/oxidized/output/git.rb' + - 'spec/node_spec.rb' + +# Offense count: 3 +# 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 +Style/TrivialAccessors: + Exclude: + - 'lib/oxidized/cli.rb' + - 'lib/oxidized/input/ssh.rb' + - 'lib/oxidized/model/model.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/UnneededInterpolation: + Exclude: + - 'bin/oxidized' + - 'lib/oxidized/cli.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + EnforcedStyle: percent + MinSize: 3 + +# Offense count: 4 +# Cop supports --auto-correct. +Style/ZeroLengthPredicate: + Exclude: + - 'lib/oxidized/core.rb' + - 'lib/oxidized/input/telnet.rb' + - 'lib/oxidized/model/ciscosmb.rb' + - 'lib/oxidized/output/git.rb' + +# Offense count: 275 +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 257 diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index 6ee594f..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,44 +0,0 @@ -PATH - remote: . - specs: - oxidized (0.21.0) - asetus (~> 0.1) - net-ssh (~> 3.0.2) - net-telnet (~> 0) - rugged (~> 0.21, >= 0.21.4) - slop (~> 3.5) - -GEM - remote: https://rubygems.org/ - specs: - asetus (0.3.0) - coderay (1.1.1) - git (1.3.0) - metaclass (0.0.4) - method_source (0.8.2) - minitest (5.10.1) - mocha (1.2.1) - metaclass (~> 0.0.1) - net-ssh (3.0.2) - net-telnet (0.1.1) - pry (0.11.0.pre2) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - rake (10.5.0) - rugged (0.25.1.1) - slop (3.6.0) - -PLATFORMS - ruby - -DEPENDENCIES - bundler (~> 1.10) - git (~> 1) - minitest (~> 5.8) - mocha (~> 1.1) - oxidized! - pry (~> 0) - rake (~> 10.0) - -BUNDLED WITH - 1.14.6 @@ -1,4 +1,4 @@ -# Oxidized [![Build Status](https://travis-ci.org/Shopify/oxidized.svg)](https://travis-ci.org/Shopify/oxidized) [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized) [![Join the chat at https://gitter.im/oxidized/Lobby](https://badges.gitter.im/oxidized/Lobby.svg)](https://gitter.im/oxidized/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +# Oxidized [![Build Status](https://travis-ci.org/ytti/oxidized.svg)](https://travis-ci.org/ytti/oxidized) [![Gem Version](https://badge.fury.io/rb/oxidized.svg)](http://badge.fury.io/rb/oxidized) [![Join the chat at https://gitter.im/oxidized/Lobby](https://badges.gitter.im/oxidized/Lobby.svg)](https://gitter.im/oxidized/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Oxidized is a network device configuration backup tool. It's a RANCID replacement! @@ -4,6 +4,18 @@ require 'rake/testtask' gemspec = eval(File.read(Dir['*.gemspec'].first)) file = [gemspec.name, gemspec.version].join('-') + '.gem' +# Integrate Rubocop if available +begin + require 'rubocop/rake_task' + + RuboCop::RakeTask.new + task(:default).prerequisites << task(:rubocop) +rescue LoadError + task :rubocop do + puts 'Install rubocop to run its rake tasks' + end +end + desc 'Validate gemspec' task :gemspec do gemspec.validate diff --git a/oxidized.gemspec b/oxidized.gemspec index a8e3eb5..6019842 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -34,4 +34,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'minitest', '~> 5.8' s.add_development_dependency 'mocha', '~> 1.1' s.add_development_dependency 'git', '~> 1' + s.add_development_dependency 'rubocop', '~> 0.54' + s.add_development_dependency 'rails_best_practices', '~> 1.19' end diff --git a/spec/githubrepo_spec.rb b/spec/githubrepo_spec.rb index 2f84c78..e676534 100644 --- a/spec/githubrepo_spec.rb +++ b/spec/githubrepo_spec.rb @@ -32,7 +32,7 @@ describe GithubRepo do describe "#fetch_and_merge_remote" do before(:each) do Oxidized.config.hooks.github_repo_hook.remote_repo = 'git@github.com:username/foo.git' - Rugged::Credentials::SshKeyFromAgent.expects(:new).with(username: 'git').returns(credentials) + Proc.expects(:new).returns(credentials) repo_head.expects(:name).returns('refs/heads/master') gr.cfg = Oxidized.config.hooks.github_repo_hook end @@ -89,6 +89,7 @@ describe GithubRepo do end before do + Proc.expects(:new).returns(credentials) repo_head.expects(:name).twice.returns('refs/heads/master') repo.expects(:head).twice.returns(repo_head) repo.expects(:path).returns('/foo.git') @@ -108,14 +109,14 @@ describe GithubRepo do Oxidized.config.hooks.github_repo_hook.remote_repo = 'https://github.com/username/foo.git' Oxidized.config.hooks.github_repo_hook.username = 'username' Oxidized.config.hooks.github_repo_hook.password = 'password' - Rugged::Credentials::UserPassword.expects(:new).with(username: 'username', password: 'password').returns(credentials) + Proc.expects(:new).returns(credentials) gr.cfg = Oxidized.config.hooks.github_repo_hook gr.run_hook(ctx).must_equal true end it "will push to the remote repository using ssh" do Oxidized.config.hooks.github_repo_hook.remote_repo = 'git@github.com:username/foo.git' - Rugged::Credentials::SshKeyFromAgent.expects(:new).with(username: 'git').returns(credentials) + Proc.expects(:new).returns(credentials) gr.cfg = Oxidized.config.hooks.github_repo_hook gr.run_hook(ctx).must_equal true end @@ -125,7 +126,7 @@ describe GithubRepo do let(:group) { 'ggrroouupp' } before do - Rugged::Credentials::SshKeyFromAgent.expects(:new).with(username: 'git').returns(credentials) + Proc.expects(:new).returns(credentials) Rugged::Repository.expects(:new).with(repository).returns(repo) repo.expects(:remotes).twice.returns(remotes) diff --git a/spec/input/ssh_spec.rb b/spec/input/ssh_spec.rb index d86ffa0..7be9139 100644 --- a/spec/input/ssh_spec.rb +++ b/spec/input/ssh_spec.rb @@ -24,7 +24,7 @@ describe Oxidized::SSH do model = mock() model.expects(:cfg).returns({'ssh' => []}) - @node.expects(:model).returns(model) + @node.expects(:model).returns(model).at_least_once proxy = mock() Net::SSH::Proxy::Command.expects(:new).with("ssh test.com -W %h:%p").returns(proxy) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 28eb9d4..2b49a6c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,5 @@ require 'minitest/autorun' -require 'mocha/mini_test' +require 'mocha/minitest' require 'oxidized' Oxidized.mgr = Oxidized::Manager.new |