From f70f6a04ddc2b39435478e0fbaca34bced10494c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Mon, 29 May 2017 20:35:04 +0100 Subject: [PATCH] Fix RuboCop warnings. Using the new rules in Homebrew/brew#2679 and check them on new PRs. --- .travis.yml | 3 ++- cmd/brew-formula-analytics.rb | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c82f450..046eac5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,17 +12,18 @@ before_install: - HOMEBREW_REPOSITORY="$(brew --repo)" - sudo chown -R "$USER" "$HOMEBREW_REPOSITORY" - git -C "$HOMEBREW_REPOSITORY" reset --hard origin/master + - export HOMEBREW_DEVELOPER="1" - brew update || brew update - HOMEBREW_TAP_DIR="$(brew --repo "$TRAVIS_REPO_SLUG")" - mkdir -p "$HOMEBREW_TAP_DIR" - rm -rf "$HOMEBREW_TAP_DIR" - ln -s "$PWD" "$HOMEBREW_TAP_DIR" - - export HOMEBREW_DEVELOPER="1" - ulimit -n 1024 - export PATH="$HOME/.gem/ruby/2.0.0/bin:$PATH" - gem install --user bundler script: + - brew style "$TRAVIS_REPO_SLUG" - brew formula-analytics --help notifications: diff --git a/cmd/brew-formula-analytics.rb b/cmd/brew-formula-analytics.rb index 5ef79aa..76d9530 100755 --- a/cmd/brew-formula-analytics.rb +++ b/cmd/brew-formula-analytics.rb @@ -21,7 +21,7 @@ # Configure RubyGems. REPO_ROOT = Pathname.new "#{File.dirname(__FILE__)}/.." -VENDOR_RUBY = "#{REPO_ROOT}/vendor/ruby" +VENDOR_RUBY = "#{REPO_ROOT}/vendor/ruby".freeze BUNDLER_SETUP = Pathname.new "#{VENDOR_RUBY}/bundler/setup.rb" unless BUNDLER_SETUP.exist? Homebrew.install_gem_setup_path! "bundler" @@ -48,6 +48,8 @@ # Using a service account: # https://developers.google.com/api-client-library/ruby/auth/service-accounts credentials = ServiceAccountCredentials.make_creds( + # Need to pass an open file descriptor here + # rubocop:disable Style/AutoResourceCleanup json_key_io: File.open(CREDENTIALS_PATH), scope: API_SCOPE, )