From 13a223d5c241806f5a2d67b253317e8f86e8b067 Mon Sep 17 00:00:00 2001 From: dblock Date: Mon, 9 Oct 2023 17:44:30 -0400 Subject: [PATCH] Check dups in data files. Signed-off-by: dblock --- bin/project | 2 ++ lib/github/data.rb | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/bin/project b/bin/project index 4a23a8f..14cb21b 100755 --- a/bin/project +++ b/bin/project @@ -26,6 +26,8 @@ module Bin pre do |global_options, _command, _options, _args| GitHub::Progress.enabled = global_options['quiet'] ? false : true + GitHub::Data.check_dups! + if global_options['vcr-cassette-name'] require 'webmock' WebMock.enable! diff --git a/lib/github/data.rb b/lib/github/data.rb index 794eca2..a6ac322 100644 --- a/lib/github/data.rb +++ b/lib/github/data.rb @@ -46,6 +46,14 @@ def students @students ||= load_list(STUDENTS) end + def check_dups! + %i[members contractors students external_users].combination(2).each do |l, r| + send(l).intersection(send(r)).each do |user| + warn "WARNING: #{user} is found in both #{l} and #{r}" + end + end + end + def bots @bots ||= load_list(BOTS) end