From 446a4fd31de35f3494c63cd91545dd2bce0a70f3 Mon Sep 17 00:00:00 2001 From: Christopher Vollick <0@psycoti.ca> Date: Tue, 29 Jun 2021 09:53:17 -0400 Subject: [PATCH] Rubocop Since these files didn't have shebangs, rubocop didn't look at them. Once it started looking it found a bunch of stuff it didn't like, but the original commit where they were written is already merged, so I'm fixing those issues here. --- bin/check_electrum_wallet_completeness | 11 ++++++----- bin/correct_duplicate_addrs | 10 ++++++---- bin/detect_duplicate_addrs | 6 +++--- bin/reassert_electrum_notification | 11 ++++++----- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/bin/check_electrum_wallet_completeness b/bin/check_electrum_wallet_completeness index bfe12b5..4500ad7 100755 --- a/bin/check_electrum_wallet_completeness +++ b/bin/check_electrum_wallet_completeness @@ -1,10 +1,10 @@ #!/usr/bin/ruby # frozen_string_literal: true -require 'redis' -require 'dhall' -require_relative '../lib/redis_addresses' -require_relative '../lib/electrum' +require "redis" +require "dhall" +require_relative "../lib/redis_addresses" +require_relative "../lib/electrum" config = Dhall::Coder @@ -18,6 +18,7 @@ electrum_addrs = electrum.listaddresses get_addresses_with_users(redis).each do |addr, keys| unless electrum_addrs.include?(addr) - puts "The address #{addr} (included in #{keys.join(", ")}) isn't included in electrum's list" + puts "The address #{addr} (included in #{keys.join(', ')}) "\ + "isn't included in electrum's list" end end diff --git a/bin/correct_duplicate_addrs b/bin/correct_duplicate_addrs index 3911ef7..4bb8bfa 100755 --- a/bin/correct_duplicate_addrs +++ b/bin/correct_duplicate_addrs @@ -6,17 +6,19 @@ # run this after looking into why # Theoretically they could be piped together directly for automated fixing -require 'redis' +require "redis" redis = Redis.new -customer_id = ENV['DEFAULT_CUSTOMER_ID'] +customer_id = ENV["DEFAULT_CUSTOMER_ID"] unless customer_id - puts "The env-var DEFAULT_CUSTOMER_ID must be set to the ID of the customer who will receive the duplicated addrs, preferably a support customer or something linked to notifications when stray money is sent to these addresses" + puts "The env-var DEFAULT_CUSTOMER_ID must be set to the ID of the customer "\ + "who will receive the duplicated addrs, preferably a support customer or "\ + "something linked to notifications when stray money is sent to these "\ + "addresses" exit 1 end - STDIN.each_line do |line| match = line.match(/^(\w+) is used by the following \d+ keys: (.*)/) unless match diff --git a/bin/detect_duplicate_addrs b/bin/detect_duplicate_addrs index c68e5e5..4f47d34 100755 --- a/bin/detect_duplicate_addrs +++ b/bin/detect_duplicate_addrs @@ -1,13 +1,13 @@ #!/usr/bin/ruby # frozen_string_literal: true -require 'redis' -require_relative '../lib/redis_addresses' +require "redis" +require_relative "../lib/redis_addresses" redis = Redis.new get_addresses_with_users(redis).each do |addr, keys| if keys.length > 1 - puts "#{addr} is used by the following #{keys.length} keys: #{keys.join(" ")}" + puts "#{addr} is used by the following #{keys.length} keys: #{keys.join(' ')}" end end diff --git a/bin/reassert_electrum_notification b/bin/reassert_electrum_notification index af398eb..4b3d4f8 100755 --- a/bin/reassert_electrum_notification +++ b/bin/reassert_electrum_notification @@ -1,10 +1,10 @@ #!/usr/bin/ruby # frozen_string_literal: true -require 'redis' -require 'dhall' -require_relative '../lib/redis_addresses' -require_relative '../lib/electrum' +require "redis" +require "dhall" +require_relative "../lib/redis_addresses" +require_relative "../lib/electrum" config = Dhall::Coder @@ -22,7 +22,8 @@ get_addresses_with_users(redis).each do |addr, keys| end customer_id = match[1] - url = "https://pay.jmp.chat/electrum_notify?address=#{addr}&customer_id=#{customer_id}" + url = "https://pay.jmp.chat/electrum_notify?"\ + "address=#{addr}&customer_id=#{customer_id}" unless electrum.notify(addr, url) puts "Failed to setup #{addr} to notify #{url}. Skipping" -- 2.38.5