You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2018/06/28 23:35:30 UTC

[whimsy] branch master updated: Check for duplicate email addresses

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 8963624  Check for duplicate email addresses
8963624 is described below

commit 8963624509aab743911ff7b1eff761fb161e968b
Author: Sebb <se...@apache.org>
AuthorDate: Fri Jun 29 00:35:29 2018 +0100

    Check for duplicate email addresses
---
 www/secretary/icla-lint.cgi | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/www/secretary/icla-lint.cgi b/www/secretary/icla-lint.cgi
index 3870f69..4b18c3b 100755
--- a/www/secretary/icla-lint.cgi
+++ b/www/secretary/icla-lint.cgi
@@ -100,6 +100,7 @@ _html do
 
   seen=Hash.new(0) # iclas.txt CLA stem values
   icla_ids=Hash.new{ |h,k| h[k] = []} # to check for duplicates and missing entries
+  icla_mails=Hash.new{ |h,k| h[k] = []} # to check for duplicates
 
   _h2_ 'Issues'
 
@@ -117,6 +118,7 @@ _html do
     document.scan(/^((\w.*?):.*?:(.*?):(.*?):(.*))/) do |(line, id, name, email, comment)|
       issue, note = nil, nil
       comment2 = comment.dup
+      claRef = nil
 
       if comment.sub!(/\s*(\(.*?\))\s*/, '')
         issue, note = 'comment', "parenthetical comment: #{$1.inspect}"
@@ -136,8 +138,9 @@ _html do
         issue, note = 'notinldap', 'not in LDAP'
       end
       if comment =~ /Signed CLA;(.*)/
+        claRef = $1
         # to be valid, the entry must exist; remove matched entries
-        missing = $1.split(',').select {|path| seen[path] += 1; iclas.delete(path) == nil}
+        missing = claRef.split(',').select {|path| seen[path] += 1; iclas.delete(path) == nil}
 
         if not missing.empty?
           issue, note = 'error', "missing icla: #{missing.first.inspect}"
@@ -154,6 +157,8 @@ _html do
         issue, note = 'mismatch', "comment doesn't match pattern"
       end
 
+      icla_mails[email] << [id, claRef, line]
+
       if issue
         issue = "#{issue} notinavail" if id =='notinavail'
 
@@ -263,6 +268,44 @@ _html do
     end
   end
 
+  #  Check if there are any duplicate mails
+  mdups=icla_mails.select{|k,v| v.size > 1}
+  if mdups.size > 0
+    _h2_ 'Duplicate mails in iclas.txt'
+    _table do
+      _tr do
+        _th 'Email'
+        _th 'Availid'
+        _th 'ICLA'
+        _th 'Entry'
+      end
+      mdups.each do |k,v|
+        v.each do |l|
+          id_, icla_, line_ = l
+          _tr do
+            _td k
+            _td do
+              if id_ != 'notinavail'
+                _a id_, href: '/roster/committer/' + k
+              else
+                _ id_
+              end
+            end
+            _td do
+              file = ASF::ICLAFiles.match_claRef(icla_)
+              if file
+                _a icla_, href: "https://svn.apache.org/repos/private/documents/iclas/#{file}"
+              else
+                _ icla_
+              end
+            end
+            _td line_
+          end
+        end
+      end
+    end
+  end
+
   _script do
     inputs = document.querySelectorAll('input')
     for i in 0...inputs.length