summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-02-22 18:57:19 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-02-22 18:57:19 +0200
commitf83801a9fe092334d5b325bbe4b736aa6b88007e (patch)
tree9303896a1835f3841e176943d63088bb7df29489
parent8f9046aad854e4c861c3a016cc3dd69e137a5c27 (diff)
downloadgitlab-shell-dz-update-deps.tar.gz
Update files to pass modern rubocop checks. Disable some of themdz-update-deps
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--.rubocop.yml945
-rw-r--r--lib/gitlab_access_status.rb12
-rw-r--r--lib/gitlab_custom_hook.rb2
-rw-r--r--lib/gitlab_keys.rb33
-rw-r--r--lib/gitlab_lfs_authentication.rb10
-rw-r--r--lib/gitlab_logger.rb2
-rw-r--r--lib/gitlab_net.rb24
-rw-r--r--lib/gitlab_post_receive.rb4
-rw-r--r--lib/gitlab_shell.rb22
-rw-r--r--lib/httpunix.rb4
-rwxr-xr-xsupport/go-format2
-rw-r--r--support/go_build.rb4
12 files changed, 93 insertions, 971 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 26579a1..8acd43f 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,958 +1,77 @@
-Style/AccessModifierIndentation:
- Description: Check indentation of private/protected visibility modifiers.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
- Enabled: true
-
-Style/AccessorMethodName:
- Description: Check the naming of accessor methods for get_/set_.
- Enabled: false
-
-Style/Alias:
- Description: 'Use alias_method instead of alias.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
- Enabled: true
-
-Style/AlignArray:
- Description: >-
- Align the elements of an array literal if they span more than
- one line.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
- Enabled: true
-
-Style/AlignHash:
- Description: >-
- Align the elements of a hash literal if they span more than
- one line.
- Enabled: true
-
-Style/AlignParameters:
- Description: >-
- Align the parameters of a method call if they span more
- than one line.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
- Enabled: false
-
-Style/AndOr:
- Description: 'Use &&/|| instead of and/or.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or'
- Enabled: false
-
-Style/ArrayJoin:
- Description: 'Use Array#join instead of Array#*.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
- Enabled: false
-
-Style/AsciiComments:
- Description: 'Use only ascii symbols in comments.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
- Enabled: true
-
-Style/AsciiIdentifiers:
- Description: 'Use only ascii symbols in identifiers.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
- Enabled: true
-
-Style/Attr:
- Description: 'Checks for uses of Module#attr.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
- Enabled: false
-
-Style/BeginBlock:
- Description: 'Avoid the use of BEGIN blocks.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
- Enabled: true
-
-Style/BarePercentLiterals:
- Description: 'Checks if usage of %() or %Q() matches configuration.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand'
- Enabled: false
-
-Style/BlockComments:
- Description: 'Do not use block comments.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
- Enabled: false
-
-Style/BlockEndNewline:
- Description: 'Put end statement of multiline block on its own line.'
- Enabled: true
+# Exclude some of GitLab files
+AllCops:
+ Exclude:
+ - 'spec/**/*'
+ - 'features/**/*'
+ - 'vendor/**/*'
+ - 'db/**/*'
+ - 'tmp/**/*'
+ - 'bin/**/*'
+ - 'lib/backup/**/*'
+ - 'lib/tasks/**/*'
+ - 'lib/email_validator.rb'
+ - 'lib/gitlab/upgrader.rb'
+ - 'lib/gitlab/seeder.rb'
+ - 'lib/vendor/**/*'
+ - 'hooks/**/*'
+ - 'Guardfile'
-Style/BracesAroundHashParameters:
- Description: 'Enforce braces style around hash parameters.'
+Layout/DotPosition:
Enabled: false
-Style/CaseEquality:
- Description: 'Avoid explicit use of the case equality operator(===).'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
+Lint/AmbiguousBlockAssociation:
Enabled: false
-Style/CaseIndentation:
- Description: 'Indentation of when in a case/when/[else/]end.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
- Enabled: true
-
-Style/CharacterLiteral:
- Description: 'Checks for uses of character literals.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
- Enabled: true
-
-Style/ClassAndModuleCamelCase:
- Description: 'Use CamelCase for classes and modules.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
- Enabled: true
-
-Style/ClassAndModuleChildren:
- Description: 'Checks style of children classes and modules.'
+Metrics/LineLength:
Enabled: false
-Style/ClassCheck:
- Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
+Metrics/MethodLength:
Enabled: false
-Style/ClassMethods:
- Description: 'Use self when defining module/class methods.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-singletons'
+Metrics/BlockLength:
Enabled: false
-Style/ClassVars:
- Description: 'Avoid the use of class variables.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
- Enabled: true
-
-Style/ColonMethodCall:
- Description: 'Do not use :: for method call.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
+Metrics/ParameterLists:
Enabled: false
-Style/CommentAnnotation:
- Description: >-
- Checks formatting of special comments
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
+Metrics/AbcSize:
Enabled: false
-Style/CommentIndentation:
- Description: 'Indentation of comments.'
- Enabled: true
-
-Style/ConstantName:
- Description: 'Constants should use SCREAMING_SNAKE_CASE.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
- Enabled: true
-
-Style/DefWithParentheses:
- Description: 'Use def with parentheses when there are arguments.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
+Metrics/CyclomaticComplexity:
Enabled: false
-Style/PreferredHashMethods:
- Description: 'Checks for use of deprecated Hash methods.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
+Metrics/PerceivedComplexity:
Enabled: false
Style/Documentation:
- Description: 'Document classes and non-namespace modules.'
- Enabled: false
-
-Style/DotPosition:
- Description: 'Checks the position of the dot in multi-line method calls.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
- Enabled: false
-
-Style/DoubleNegation:
- Description: 'Checks for uses of double negation (!!).'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
- Enabled: false
-
-Style/EachWithObject:
- Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
- Enabled: false
-
-Style/ElseAlignment:
- Description: 'Align elses and elsifs correctly.'
- Enabled: true
-
-Style/EmptyElse:
- Description: 'Avoid empty else-clauses.'
- Enabled: false
-
-Style/EmptyLineBetweenDefs:
- Description: 'Use empty lines between defs.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
- Enabled: false
-
-Style/EmptyLines:
- Description: "Don't use several empty lines in a row."
- Enabled: false
-
-Style/EmptyLinesAroundAccessModifier:
- Description: "Keep blank lines around access modifiers."
- Enabled: false
-
-Style/EmptyLinesAroundBlockBody:
- Description: "Keeps track of empty lines around block bodies."
- Enabled: false
-
-Style/EmptyLinesAroundClassBody:
- Description: "Keeps track of empty lines around class bodies."
Enabled: false
-Style/EmptyLinesAroundModuleBody:
- Description: "Keeps track of empty lines around module bodies."
- Enabled: false
-
-Style/EmptyLinesAroundMethodBody:
- Description: "Keeps track of empty lines around method bodies."
- Enabled: false
-
-Style/EmptyLiteral:
- Description: 'Prefer literals to Array.new/Hash.new/String.new.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
- Enabled: false
-
-Style/EndBlock:
- Description: 'Avoid the use of END blocks.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks'
- Enabled: false
-
-Style/EndOfLine:
- Description: 'Use Unix-style line endings.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
- Enabled: false
-
-Style/EvenOdd:
- Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
- Enabled: false
-
-Style/FileName:
- Description: 'Use snake_case for source file names.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
- Enabled: false
-
-Style/FlipFlop:
- Description: 'Checks for flip flops'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
- Enabled: false
-
-Style/For:
- Description: 'Checks use of for or each in multiline loops.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops'
+Style/StringLiterals:
Enabled: false
-Style/FormatString:
- Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
+Style/StringLiterals:
Enabled: false
Style/GlobalVars:
- Description: 'Do not introduce global variables.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
Enabled: false
-Style/GuardClause:
- Description: 'Check for conditionals that can be replaced with guard clauses'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
- Enabled: false
-
-Style/HashSyntax:
- Description: >-
- Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
- { :a => 1, :b => 2 }.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
- Enabled: true
-
-Style/IfUnlessModifier:
- Description: >-
- Favor modifier if/unless usage when you have a
- single-line body.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
- Enabled: false
-
-Style/IfWithSemicolon:
- Description: 'Do not use if x; .... Use the ternary operator instead.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
- Enabled: false
-
-Style/IndentationConsistency:
- Description: 'Keep indentation straight.'
- Enabled: true
-
-Style/IndentationWidth:
- Description: 'Use 2 spaces for indentation.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
- Enabled: true
-
-Style/IndentArray:
- Description: >-
- Checks the indentation of the first element in an array
- literal.
- Enabled: false
-
-Style/IndentHash:
- Description: 'Checks the indentation of the first key in a hash literal.'
- Enabled: false
-
-Style/InfiniteLoop:
- Description: 'Use Kernel#loop for infinite loops.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#infinite-loop'
- Enabled: false
-
-Style/Lambda:
- Description: 'Use the new lambda literal syntax for single-line blocks.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
- Enabled: false
-
-Style/LambdaCall:
- Description: 'Use lambda.call(...) instead of lambda.(...).'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
- Enabled: false
-
-Style/LeadingCommentSpace:
- Description: 'Comments should start with a space.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
- Enabled: false
-
-Style/LineEndConcatenation:
- Description: >-
- Use \ instead of + or << to concatenate two string literals at
- line end.
- Enabled: false
-
-Style/MethodCallWithoutArgsParentheses:
- Description: 'Do not use parentheses for method calls with no arguments.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
- Enabled: false
-
-Style/MethodDefParentheses:
- Description: >-
- Checks if the method definitions have or don't have
- parentheses.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
- Enabled: false
-
-Style/MethodName:
- Description: 'Use the configured style when naming methods.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
- Enabled: false
-
-Style/ModuleFunction:
- Description: 'Checks for usage of `extend self` in modules.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
- Enabled: false
-
-Style/MultilineBlockChain:
- Description: 'Avoid multi-line chains of blocks.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
- Enabled: false
-
-Style/MultilineBlockLayout:
- Description: 'Ensures newlines after multiline block do statements.'
- Enabled: false
-
-Style/MultilineIfThen:
- Description: 'Do not use then for multi-line if/unless.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then'
- Enabled: false
-
-Style/MultilineOperationIndentation:
- Description: >-
- Checks indentation of binary operations that span more than
- one line.
- Enabled: false
-
-Style/MultilineTernaryOperator:
- Description: >-
- Avoid multi-line ?: (the ternary operator);
- use if/unless instead.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary'
- Enabled: false
-
-Style/NegatedIf:
- Description: >-
- Favor unless over if for negative conditions
- (or control flow or).
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
- Enabled: false
-
-Style/NegatedWhile:
- Description: 'Favor until over while for negative conditions.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
- Enabled: false
-
-Style/NestedTernaryOperator:
- Description: 'Use one expression per branch in a ternary operator.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
- Enabled: false
-
-Style/Next:
- Description: 'Use `next` to skip iteration instead of a condition at the end.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
- Enabled: false
-
-Style/NilComparison:
- Description: 'Prefer x.nil? to x == nil.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
- Enabled: false
-
-Style/NonNilCheck:
- Description: 'Checks for redundant nil checks.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
- Enabled: false
-
-Style/Not:
- Description: 'Use ! instead of not.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
- Enabled: false
-
-Style/NumericLiterals:
- Description: >-
- Add underscores to large numeric literals to improve their
- readability.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
- Enabled: false
-
-Style/OneLineConditional:
- Description: >-
- Favor the ternary operator(?:) over
- if/then/else/end constructs.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
+Style/AccessorMethodName:
Enabled: false
-Style/OpMethod:
- Description: 'When defining binary operators, name the argument other.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
+Style/GuardClause:
Enabled: false
-Style/ParenthesesAroundCondition:
- Description: >-
- Don't use parentheses around the condition of an
- if/unless/while.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if'
+Style/RescueModifier:
Enabled: false
Style/PercentLiteralDelimiters:
- Description: 'Use `%`-literal delimiters consistently'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
- Enabled: false
-
-Style/PercentQLiterals:
- Description: 'Checks if uses of %Q/%q match the configured preference.'
- Enabled: false
-
-Style/PerlBackrefs:
- Description: 'Avoid Perl-style regex back references.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
- Enabled: false
-
-Style/PredicateName:
- Description: 'Check the names of predicate methods.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
- Enabled: false
-
-Style/Proc:
- Description: 'Use proc instead of Proc.new.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
- Enabled: false
-
-Style/RaiseArgs:
- Description: 'Checks the arguments passed to raise/fail.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
Enabled: false
-Style/RedundantBegin:
- Description: "Don't use begin blocks when they are not needed."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit'
- Enabled: false
-
-Style/RedundantException:
- Description: "Checks for an obsolete RuntimeException argument in raise/fail."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror'
- Enabled: false
-
-Style/RedundantReturn:
- Description: "Don't use return where it's not required."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
- Enabled: false
-
-Style/RedundantSelf:
- Description: "Don't use self where it's not needed."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required'
+Style/IfUnlessModifier:
Enabled: false
Style/RegexpLiteral:
- Description: >-
- Use %r for regular expressions matching more than
- `MaxSlashes` '/' characters.
- Use %r only for regular expressions matching more than
- `MaxSlashes` '/' character.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
- Enabled: false
-
-Style/RescueModifier:
- Description: 'Avoid using rescue in its modifier form.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers'
- Enabled: false
-
-Style/SelfAssignment:
- Description: >-
- Checks for places where self-assignment shorthand should have
- been used.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
- Enabled: false
-
-Style/Semicolon:
- Description: "Don't use semicolons to terminate expressions."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon'
- Enabled: false
-
-Style/SignalException:
- Description: 'Checks for proper usage of fail and raise.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
- Enabled: false
-
-Style/SingleLineBlockParams:
- Description: 'Enforces the names of some block params.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
- Enabled: false
-
-Style/SingleLineMethods:
- Description: 'Avoid single-line methods.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
- Enabled: false
-
-Layout/SpaceBeforeFirstArg:
- Description: >-
- Checks that exactly one space is used between a method name
- and the first argument for method calls without parentheses.
- Enabled: false
-
-Style/SpaceAfterColon:
- Description: 'Use spaces after colons.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
- Enabled: false
-
-Style/SpaceAfterComma:
- Description: 'Use spaces after commas.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
- Enabled: false
-
-Layout/SpaceAroundKeyword:
- Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
- Enabled: false
-
-Style/SpaceAfterMethodName:
- Description: >-
- Do not put a space between a method name and the opening
- parenthesis in a method definition.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
- Enabled: false
-
-Style/SpaceAfterNot:
- Description: Tracks redundant space after the ! operator.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang'
- Enabled: false
-
-Style/SpaceAfterSemicolon:
- Description: 'Use spaces after semicolons.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
- Enabled: false
-
-Style/SpaceBeforeBlockBraces:
- Description: >-
- Checks that the left block brace has or doesn't have space
- before it.
- Enabled: false
-
-Style/SpaceBeforeComma:
- Description: 'No spaces before commas.'
- Enabled: false
-
-Style/SpaceBeforeComment:
- Description: >-
- Checks for missing space between code and a comment on the
- same line.
- Enabled: false
-
-Style/SpaceBeforeSemicolon:
- Description: 'No spaces before semicolons.'
- Enabled: false
-
-Style/SpaceInsideBlockBraces:
- Description: >-
- Checks that block braces have or don't have surrounding space.
- For blocks taking parameters, checks that the left brace has
- or doesn't have trailing space.
- Enabled: false
-
-Style/SpaceAroundEqualsInParameterDefault:
- Description: >-
- Checks that the equals signs in parameter default assignments
- have or don't have surrounding space depending on
- configuration.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals'
- Enabled: false
-
-Style/SpaceAroundOperators:
- Description: 'Use spaces around operators.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
- Enabled: false
-
-Layout/SpaceAroundKeyword:
- Description: 'Put a space before the modifier keyword.'
- Enabled: false
-
-Style/SpaceInsideBrackets:
- Description: 'No spaces after [ or before ].'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
- Enabled: false
-
-Style/SpaceInsideHashLiteralBraces:
- Description: "Use spaces inside hash literal braces - or don't."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
- Enabled: true
-
-Style/SpaceInsideParens:
- Description: 'No spaces after ( or before ).'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
- Enabled: false
-
-Style/SpaceInsideRangeLiteral:
- Description: 'No spaces inside range literals.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals'
Enabled: false
Style/SpecialGlobalVars:
- Description: 'Avoid Perl-style global variables.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
Enabled: false
-
-Style/StringLiterals:
- Description: 'Checks if uses of quotes match the configured preference.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
- Enabled: false
-
-Style/StringLiteralsInInterpolation:
- Description: >-
- Checks if uses of quotes inside expressions in interpolated
- strings match the configured preference.
- Enabled: false
-
-Style/SymbolProc:
- Description: 'Use symbols as procs instead of blocks when possible.'
- Enabled: false
-
-Style/Tab:
- Description: 'No hard tabs.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
- Enabled: false
-
-Style/TrailingBlankLines:
- Description: 'Checks trailing blank lines and final newline.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
- Enabled: true
-
-Style/TrailingCommaInLiteral:
- Description: 'Checks for trailing comma in parameter lists and literals.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
- Enabled: false
-
-Style/TrailingWhitespace:
- Description: 'Avoid trailing whitespace.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
- Enabled: false
-
-Style/TrivialAccessors:
- Description: 'Prefer attr_* methods to trivial readers/writers.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
- Enabled: false
-
-Style/UnlessElse:
- Description: >-
- Do not use unless with else. Rewrite these with the positive
- case first.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
- Enabled: false
-
-Style/UnneededCapitalW:
- Description: 'Checks for %W when interpolation is not needed.'
- Enabled: false
-
-Style/UnneededPercentQ:
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q'
- Enabled: false
-
-Style/VariableInterpolation:
- Description: >-
- Don't interpolate global, instance and class variables
- directly in strings.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
- Enabled: false
-
-Style/VariableName:
- Description: 'Use the configured style when naming variables.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
- Enabled: false
-
-Style/WhenThen:
- Description: 'Use when x then ... for one-line cases.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
- Enabled: false
-
-Style/WhileUntilDo:
- Description: 'Checks for redundant do after while or until.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do'
- Enabled: false
-
-Style/WhileUntilModifier:
- Description: >-
- Favor modifier while/until usage when you have a
- single-line body.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
- Enabled: false
-
-Style/WordArray:
- Description: 'Use %w or %W for arrays of words.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
- Enabled: false
-
-#################### Metrics ################################
-
-Metrics/AbcSize:
- Description: >-
- A calculated magnitude based on number of assignments,
- branches, and conditions.
- Enabled: false
-
-Metrics/BlockNesting:
- Description: 'Avoid excessive block nesting'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
- Enabled: false
-
-Metrics/ClassLength:
- Description: 'Avoid classes longer than 100 lines of code.'
- Enabled: false
-
-Metrics/CyclomaticComplexity:
- Description: >-
- A complexity metric that is strongly correlated to the number
- of test cases needed to validate a method.
- Enabled: false
-
-Metrics/LineLength:
- Description: 'Limit lines to 80 characters.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
- Enabled: false
-
-Metrics/MethodLength:
- Description: 'Avoid methods longer than 10 lines of code.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
- Enabled: false
-
-Metrics/ParameterLists:
- Description: 'Avoid parameter lists longer than three or four parameters.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
- Enabled: false
-
-Metrics/PerceivedComplexity:
- Description: >-
- A complexity metric geared towards measuring complexity for a
- human reader.
- Enabled: false
-
-#################### Lint ################################
-### Warnings
-
-Lint/AmbiguousOperator:
- Description: >-
- Checks for ambiguous operators in the first argument of a
- method invocation without parentheses.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
- Enabled: false
-
-Lint/AmbiguousRegexpLiteral:
- Description: >-
- Checks for ambiguous regexp literals in the first argument of
- a method invocation without parenthesis.
- Enabled: false
-
-Lint/AssignmentInCondition:
- Description: "Don't use assignment in conditions."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
- Enabled: false
-
-Lint/BlockAlignment:
- Description: 'Align block ends correctly.'
- Enabled: false
-
-Lint/ConditionPosition:
- Description: >-
- Checks for condition placed in a confusing position relative to
- the keyword.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
- Enabled: false
-
-Lint/Debugger:
- Description: 'Check for debugger calls.'
- Enabled: false
-
-Lint/DefEndAlignment:
- Description: 'Align ends corresponding to defs correctly.'
- Enabled: false
-
-Lint/DeprecatedClassMethods:
- Description: 'Check for deprecated class method calls.'
- Enabled: false
-
-Lint/ElseLayout:
- Description: 'Check for odd code arrangement in an else block.'
- Enabled: false
-
-Lint/EmptyEnsure:
- Description: 'Checks for empty ensure block.'
- Enabled: false
-
-Lint/EmptyInterpolation:
- Description: 'Checks for empty string interpolation.'
- Enabled: false
-
-Lint/EndAlignment:
- Description: 'Align ends correctly.'
- Enabled: false
-
-Lint/EndInMethod:
- Description: 'END blocks should not be placed inside method definitions.'
- Enabled: false
-
-Lint/EnsureReturn:
- Description: 'Do not use return in an ensure block.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
- Enabled: false
-
-Lint/Eval:
- Description: 'The use of eval represents a serious security risk.'
- Enabled: false
-
-Lint/HandleExceptions:
- Description: "Don't suppress exception."
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
- Enabled: false
-
-Lint/InvalidCharacterLiteral:
- Description: >-
- Checks for invalid character literals with a non-escaped
- whitespace character.
- Enabled: false
-
-Lint/LiteralInCondition:
- Description: 'Checks of literals used in conditions.'
- Enabled: false
-
-Lint/LiteralInInterpolation:
- Description: 'Checks for literals used in interpolation.'
- Enabled: false
-
-Lint/Loop:
- Description: >-
- Use Kernel#loop with break rather than begin/end/until or
- begin/end/while for post-loop tests.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
- Enabled: false
-
-Lint/ParenthesesAsGroupedExpression:
- Description: >-
- Checks for method calls with a space before the opening
- parenthesis.
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
- Enabled: true
-
-Lint/RequireParentheses:
- Description: >-
- Use parentheses in the method call to avoid confusion
- about precedence.
- Enabled: false
-
-Lint/RescueException:
- Description: 'Avoid rescuing the Exception class.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
- Enabled: false
-
-Lint/ShadowingOuterLocalVariable:
- Description: >-
- Do not use the same name as outer local variable
- for block arguments or block local variables.
- Enabled: false
-
-Layout/SpaceBeforeFirstArg:
- Description: >-
- Put a space between a method name and the first argument
- in a method call without parentheses.
- Enabled: false
-
-Lint/StringConversionInInterpolation:
- Description: 'Checks for Object#to_s usage in string interpolation.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
- Enabled: false
-
-Lint/UnderscorePrefixedVariableName:
- Description: 'Do not use prefix `_` for a variable that is used.'
- Enabled: true
-
-Lint/UnusedBlockArgument:
- Description: 'Checks for unused block arguments.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
- Enabled: false
-
-Lint/UnusedMethodArgument:
- Description: 'Checks for unused method arguments.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
- Enabled: false
-
-Lint/UnreachableCode:
- Description: 'Unreachable code.'
- Enabled: false
-
-Lint/UselessAccessModifier:
- Description: 'Checks for useless access modifiers.'
- Enabled: false
-
-Lint/UselessAssignment:
- Description: 'Checks for useless assignment to a local variable.'
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
- Enabled: false
-
-Lint/UselessComparison:
- Description: 'Checks for comparison of something with itself.'
- Enabled: false
-
-Lint/UselessElseWithoutRescue:
- Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
- Enabled: false
-
-Lint/UselessSetterCall:
- Description: 'Checks for useless setter call to a local variable.'
- Enabled: false
-
-Lint/Void:
- Description: 'Possible use of operator/literal/variable in void context.'
- Enabled: false
-
-
-# Exclude some of GitLab files
-#
-#
-AllCops:
- Exclude:
- - 'spec/**/*'
- - 'features/**/*'
- - 'vendor/**/*'
- - 'db/**/*'
- - 'tmp/**/*'
- - 'bin/**/*'
- - 'lib/backup/**/*'
- - 'lib/tasks/**/*'
- - 'lib/email_validator.rb'
- - 'lib/gitlab/upgrader.rb'
- - 'lib/gitlab/seeder.rb'
- - 'lib/vendor/**/*'
- - 'Guardfile'
diff --git a/lib/gitlab_access_status.rb b/lib/gitlab_access_status.rb
index 0b32dc9..783bc0c 100644
--- a/lib/gitlab_access_status.rb
+++ b/lib/gitlab_access_status.rb
@@ -14,12 +14,12 @@ class GitAccessStatus
def self.create_from_json(json)
values = JSON.parse(json)
- self.new(values["status"],
- values["message"],
- gl_repository: values["gl_repository"],
- gl_username: values["gl_username"],
- repository_path: values["repository_path"],
- gitaly: values["gitaly"])
+ new(values["status"],
+ values["message"],
+ gl_repository: values["gl_repository"],
+ gl_username: values["gl_username"],
+ repository_path: values["repository_path"],
+ gitaly: values["gitaly"])
end
def allowed?
diff --git a/lib/gitlab_custom_hook.rb b/lib/gitlab_custom_hook.rb
index b151e29..67096df 100644
--- a/lib/gitlab_custom_hook.rb
+++ b/lib/gitlab_custom_hook.rb
@@ -47,7 +47,7 @@ class GitlabCustomHook
# Submit changes to the hook via its stdin.
begin
IO.copy_stream(StringIO.new(changes), stdin_writer)
- rescue Errno::EPIPE
+ rescue Errno::EPIPE # rubocop:disable Lint/HandleExceptions
# It is not an error if the hook does not consume all of its input.
end
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb
index e6dfd99..9c38fc5 100644
--- a/lib/gitlab_keys.rb
+++ b/lib/gitlab_keys.rb
@@ -4,19 +4,26 @@ require_relative 'gitlab_config'
require_relative 'gitlab_logger'
require_relative 'gitlab_metrics'
-class GitlabKeys
- class KeyError < StandardError ; end
+class GitlabKeys # rubocop:disable Metrics/ClassLength
+ class KeyError < StandardError; end
attr_accessor :auth_file, :key
def self.command(key_id)
- raise KeyError.new("Invalid key_id: #{key_id.inspect}") unless /\A[a-z0-9-]+\z/ =~ key_id
+ unless /\A[a-z0-9-]+\z/ =~ key_id
+ raise KeyError, "Invalid key_id: #{key_id.inspect}"
+ end
+
"#{ROOT_PATH}/bin/gitlab-shell #{key_id}"
end
def self.key_line(key_id, public_key)
public_key.chomp!
- raise KeyError.new("Invalid public_key: #{public_key.inspect}") if public_key.include?("\n")
+
+ if public_key.include?("\n")
+ raise KeyError, "Invalid public_key: #{public_key.inspect}"
+ end
+
"command=\"#{command(key_id)}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty #{public_key}"
end
@@ -31,19 +38,19 @@ class GitlabKeys
def exec
GitlabMetrics.measure("command-#{@command}") do
case @command
- when 'add-key';
+ when 'add-key'
add_key
- when 'batch-add-keys';
+ when 'batch-add-keys'
batch_add_keys
- when 'rm-key';
+ when 'rm-key'
rm_key
- when 'list-keys';
+ when 'list-keys'
list_keys
- when 'list-key-ids';
+ when 'list-key-ids'
list_key_ids
- when 'clear';
+ when 'clear'
clear
- when 'check-permissions';
+ when 'check-permissions'
check_permissions
else
$logger.warn "Attempt to execute invalid gitlab-keys command #{@command.inspect}."
@@ -111,7 +118,7 @@ class GitlabKeys
lock do
$logger.info "Removing key #{@key_id}"
open_auth_file('r+') do |f|
- while line = f.gets do
+ while line = f.gets # rubocop:disable Style/AssignmentInCondition
next unless line.start_with?("command=\"#{self.class.command(@key_id)}\"")
f.seek(-line.length, IO::SEEK_CUR)
# Overwrite the line with #'s. Because the 'line' variable contains
@@ -145,7 +152,7 @@ class GitlabKeys
File.open(lock_file, "w+") do |f|
begin
f.flock File::LOCK_EX
- Timeout::timeout(timeout) { yield }
+ Timeout.timeout(timeout) { yield }
ensure
f.flock File::LOCK_UN
end
diff --git a/lib/gitlab_lfs_authentication.rb b/lib/gitlab_lfs_authentication.rb
index 96d06d8..ccd6d69 100644
--- a/lib/gitlab_lfs_authentication.rb
+++ b/lib/gitlab_lfs_authentication.rb
@@ -11,12 +11,10 @@ class GitlabLfsAuthentication
end
def self.build_from_json(json)
- begin
- values = JSON.parse(json)
- self.new(values['username'], values['lfs_token'], values['repository_http_path'])
- rescue
- nil
- end
+ values = JSON.parse(json)
+ new(values['username'], values['lfs_token'], values['repository_http_path'])
+ rescue
+ nil
end
def authentication_payload
diff --git a/lib/gitlab_logger.rb b/lib/gitlab_logger.rb
index 4b87e27..872d3ed 100644
--- a/lib/gitlab_logger.rb
+++ b/lib/gitlab_logger.rb
@@ -2,7 +2,7 @@ require 'logger'
require_relative 'gitlab_config'
-def convert_log_level log_level
+def convert_log_level(log_level)
Logger.const_get(log_level.upcase)
rescue NameError
$stderr.puts "WARNING: Unrecognized log level #{log_level.inspect}."
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index 9a88b4b..a5736d6 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -8,7 +8,7 @@ require_relative 'gitlab_access'
require_relative 'gitlab_lfs_authentication'
require_relative 'httpunix'
-class GitlabNet
+class GitlabNet # rubocop:disable Metrics/ClassLength
class ApiUnreachableError < StandardError; end
class NotFound < StandardError; end
@@ -16,7 +16,7 @@ class GitlabNet
READ_TIMEOUT = 300
def check_access(cmd, gl_repository, repo, actor, changes, protocol, env: {})
- changes = changes.join("\n") unless changes.kind_of?(String)
+ changes = changes.join("\n") unless changes.is_a?(String)
params = {
action: cmd,
@@ -73,7 +73,7 @@ class GitlabNet
end
def merge_request_urls(gl_repository, repo_path, changes)
- changes = changes.join("\n") unless changes.kind_of?(String)
+ changes = changes.join("\n") unless changes.is_a?(String)
changes = changes.encode('UTF-8', 'ASCII', invalid: :replace, replace: '')
url = "#{host}/merge_request_urls?project=#{URI.escape(repo_path)}&changes=#{URI.escape(changes)}"
url += "&gl_repository=#{URI.escape(gl_repository)}" if gl_repository
@@ -152,7 +152,7 @@ class GitlabNet
"#{config.gitlab_url}/api/v4/internal"
end
- def http_client_for(uri, options={})
+ def http_client_for(uri, options = {})
http = if uri.is_a?(URI::HTTPUNIX)
Net::HTTPUNIX.new(uri.hostname)
else
@@ -189,7 +189,7 @@ class GitlabNet
request
end
- def request(method, url, params = {}, options={})
+ def request(method, url, params = {}, options = {})
$logger.debug "Performing #{method.to_s.upcase} #{url}"
uri = URI.parse(url)
@@ -205,7 +205,7 @@ class GitlabNet
raise ApiUnreachableError
ensure
$logger.info do
- sprintf('%s %s %0.5f', method.to_s.upcase, url, Time.new - start_time)
+ sprintf('%s %s %0.5f', method.to_s.upcase, url, Time.new - start_time) # rubocop:disable Style/FormatString
end
end
@@ -218,7 +218,7 @@ class GitlabNet
response
end
- def get(url, options={})
+ def get(url, options = {})
request(:get, url, {}, options)
end
@@ -231,13 +231,11 @@ class GitlabNet
store = OpenSSL::X509::Store.new
store.set_default_paths
- if ca_file = config.http_settings['ca_file']
- store.add_file(ca_file)
- end
+ ca_file = config.http_settings['ca_file']
+ store.add_file(ca_file) if ca_file
- if ca_path = config.http_settings['ca_path']
- store.add_path(ca_path)
- end
+ ca_path = config.http_settings['ca_path']
+ store.add_path(ca_path) if ca_path
store
end
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb
index bd289b7..6009b19 100644
--- a/lib/gitlab_post_receive.rb
+++ b/lib/gitlab_post_receive.rb
@@ -50,9 +50,9 @@ class GitlabPostReceive
def print_merge_request_link(merge_request)
message =
if merge_request["new_merge_request"]
- "To create a merge request for #{merge_request["branch_name"]}, visit:"
+ "To create a merge request for #{merge_request['branch_name']}, visit:"
else
- "View merge request for #{merge_request["branch_name"]}:"
+ "View merge request for #{merge_request['branch_name']}:"
end
puts message
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index 0d2531f..01b6af4 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -4,7 +4,7 @@ require 'pathname'
require_relative 'gitlab_net'
require_relative 'gitlab_metrics'
-class GitlabShell
+class GitlabShell # rubocop:disable Metrics/ClassLength
class AccessDeniedError < StandardError; end
class DisallowedCommandError < StandardError; end
class InvalidRepositoryPathError < StandardError; end
@@ -12,7 +12,7 @@ class GitlabShell
GIT_COMMANDS = %w(git-upload-pack git-receive-pack git-upload-archive git-lfs-authenticate).freeze
GITALY_MIGRATED_COMMANDS = {
'git-upload-pack' => File.join(ROOT_PATH, 'bin', 'gitaly-upload-pack'),
- 'git-receive-pack' => File.join(ROOT_PATH, 'bin', 'gitaly-receive-pack'),
+ 'git-receive-pack' => File.join(ROOT_PATH, 'bin', 'gitaly-receive-pack')
}.freeze
API_COMMANDS = %w(2fa_recovery_codes).freeze
GL_PROTOCOL = 'ssh'.freeze
@@ -44,7 +44,7 @@ class GitlabShell
process_cmd(args)
true
- rescue GitlabNet::ApiUnreachableError => ex
+ rescue GitlabNet::ApiUnreachableError
$stderr.puts "GitLab: Failed to authorize your Git request: internal API unreachable"
false
rescue AccessDeniedError => ex
@@ -53,13 +53,13 @@ class GitlabShell
$stderr.puts "GitLab: #{ex.message}"
false
- rescue DisallowedCommandError => ex
+ rescue DisallowedCommandError
message = "gitlab-shell: Attempt to execute disallowed command <#{origin_cmd}> by #{log_username}."
$logger.warn message
$stderr.puts "GitLab: Disallowed command"
false
- rescue InvalidRepositoryPathError => ex
+ rescue InvalidRepositoryPathError
$stderr.puts "GitLab: Invalid repository path"
false
end
@@ -113,7 +113,7 @@ class GitlabShell
end
def process_cmd(args)
- return self.send("api_#{@command}") if API_COMMANDS.include?(@command)
+ return send("api_#{@command}") if API_COMMANDS.include?(@command)
if @command == 'git-lfs-authenticate'
GitlabMetrics.measure('lfs-authenticate') do
@@ -126,7 +126,7 @@ class GitlabShell
executable = @command
args = [repo_path]
- if GITALY_MIGRATED_COMMANDS.has_key?(executable) && @gitaly
+ if GITALY_MIGRATED_COMMANDS.key?(executable) && @gitaly
executable = GITALY_MIGRATED_COMMANDS[executable]
gitaly_address = @gitaly['address']
@@ -172,15 +172,15 @@ class GitlabShell
end
if git_trace_available?
- env.merge!({
+ env.merge!(
'GIT_TRACE' => @config.git_trace_log_file,
'GIT_TRACE_PACKET' => @config.git_trace_log_file,
- 'GIT_TRACE_PERFORMANCE' => @config.git_trace_log_file,
- })
+ 'GIT_TRACE_PERFORMANCE' => @config.git_trace_log_file
+ )
end
# We use 'chdir: ROOT_PATH' to let the next executable know where config.yml is.
- Kernel::exec(env, *args, unsetenv_others: true, chdir: ROOT_PATH)
+ Kernel.exec(env, *args, unsetenv_others: true, chdir: ROOT_PATH)
end
def api
diff --git a/lib/httpunix.rb b/lib/httpunix.rb
index db160eb..7d00f71 100644
--- a/lib/httpunix.rb
+++ b/lib/httpunix.rb
@@ -11,7 +11,7 @@ module URI
class HTTPUNIX < HTTP
def hostname
# decode %XX from path to file
- v = self.host
+ v = host
URI.decode(v)
end
@@ -30,7 +30,7 @@ end
# - Net::HTTP::connect
module Net
class HTTPUNIX < HTTP
- def initialize(socketpath, port=nil)
+ def initialize(socketpath, port = nil)
super(socketpath, port)
@port = nil # HTTP will set it to default - override back -> set DEFAULT_PORT
end
diff --git a/support/go-format b/support/go-format
index d74fc46..b5f47b7 100755
--- a/support/go-format
+++ b/support/go-format
@@ -5,7 +5,7 @@ def main(check)
cmd = %w[gofmt -s -l]
cmd << '-w' unless check
cmd += go_files
- output = IO.popen(cmd, 'r') { |io| io.read }
+ output = IO.popen(cmd, 'r', &:read)
$stdout.write(output)
abort 'gofmt failed' unless $?.success?
if check && output.lines.any? { |l| l != "\n" }
diff --git a/support/go_build.rb b/support/go_build.rb
index 1202dd2..30a6b71 100644
--- a/support/go_build.rb
+++ b/support/go_build.rb
@@ -12,7 +12,7 @@ module GoBuild
GO_ENV = {
'GOPATH' => BUILD_DIR,
- 'GO15VENDOREXPERIMENT' => '1',
+ 'GO15VENDOREXPERIMENT' => '1'
}.freeze
def create_fresh_build_dir
@@ -26,7 +26,7 @@ module GoBuild
raise "env must be a hash" unless env.is_a?(Hash)
raise "cmd must be an array" unless cmd.is_a?(Array)
- if !system(env, *cmd)
+ unless system(env, *cmd)
abort "command failed: #{env.inspect} #{cmd.join(' ')}"
end
end