From b19df676eaa5eef947c70121eb0d96407d32fb29 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Fri, 22 May 2020 20:07:52 -0700 Subject: [PATCH] Reformat Ruby files for line length of 120 The rubocop community has decided to standardize on 120 characters for default line length. https://github.com/rubocop-hq/rubocop/pull/7952 Update rubocop config and reformat ruby files to embrace this convention. --- .rubocop.yml | 1 + Rakefile | 11 +++-------- lib/tomo/plugin/sidekiq.rb | 3 --- lib/tomo/plugin/sidekiq/tasks.rb | 8 ++------ 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 6d28114..50f4e4b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -19,6 +19,7 @@ Layout/HashAlignment: - key Layout/LineLength: + Max: 120 Exclude: - "*.gemspec" diff --git a/Rakefile b/Rakefile index 84f2d60..b475fe7 100644 --- a/Rakefile +++ b/Rakefile @@ -31,12 +31,9 @@ namespace :bump do lowest_minor = RubyVersions.lowest_supported_minor latest = RubyVersions.latest - replace_in_file "tomo-plugin-sidekiq.gemspec", - /ruby_version = ">= (.*)"/ => lowest - + replace_in_file "tomo-plugin-sidekiq.gemspec", /ruby_version = ">= (.*)"/ => lowest replace_in_file ".rubocop.yml", /TargetRubyVersion: (.*)/ => lowest_minor - replace_in_file ".circleci/config.yml", - %r{circleci/ruby:([\d\.]+)} => latest + replace_in_file ".circleci/config.yml", %r{circleci/ruby:([\d\.]+)} => latest travis = YAML.safe_load(open(".travis.yml")) travis["rvm"] = RubyVersions.latest_supported_patches + ["ruby-head"] @@ -87,9 +84,7 @@ module RubyVersions def versions @_versions ||= begin - yaml = URI.open( - "https://raw.githubusercontent.com/ruby/www.ruby-lang.org/master/_data/downloads.yml" - ) + yaml = URI.open("https://raw.githubusercontent.com/ruby/www.ruby-lang.org/master/_data/downloads.yml") YAML.safe_load(yaml, symbolize_names: true) end end diff --git a/lib/tomo/plugin/sidekiq.rb b/lib/tomo/plugin/sidekiq.rb index 8a48e94..34ad46a 100644 --- a/lib/tomo/plugin/sidekiq.rb +++ b/lib/tomo/plugin/sidekiq.rb @@ -6,10 +6,7 @@ module Tomo::Plugin::Sidekiq extend Tomo::PluginDSL tasks Tomo::Plugin::Sidekiq::Tasks - - # rubocop:disable Layout/LineLength defaults sidekiq_systemd_service: "sidekiq_%{application}.service", sidekiq_systemd_service_path: ".config/systemd/user/%{sidekiq_systemd_service}", sidekiq_systemd_service_template_path: File.expand_path("sidekiq/service.erb", __dir__) - # rubocop:enable Layout/LineLength end diff --git a/lib/tomo/plugin/sidekiq/tasks.rb b/lib/tomo/plugin/sidekiq/tasks.rb index 50cf12b..9ab1bbd 100644 --- a/lib/tomo/plugin/sidekiq/tasks.rb +++ b/lib/tomo/plugin/sidekiq/tasks.rb @@ -19,9 +19,7 @@ def setup_systemd end def log - remote.attach "journalctl", "-q", - raw("--user-unit=#{service.name.shellescape}"), - *settings[:run_args] + remote.attach "journalctl", "-q", raw("--user-unit=#{service.name.shellescape}"), *settings[:run_args] end private @@ -35,9 +33,7 @@ def service end def linger_must_be_enabled! - linger_users = remote.list_files( - "/var/lib/systemd/linger", raise_on_error: false - ) + linger_users = remote.list_files("/var/lib/systemd/linger", raise_on_error: false) return if dry_run? || linger_users.include?(remote.host.user) die <<~ERROR.strip