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 2020/11/22 01:04:39 UTC

[whimsy] branch master updated: Tidy code

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 1369a77  Tidy code
1369a77 is described below

commit 1369a777d48e819972fd90db3f0db6896bd45c69
Author: Sebb <se...@apache.org>
AuthorDate: Sun Nov 22 01:04:28 2020 +0000

    Tidy code
---
 lib/whimsy/asf/auth.rb      |  8 ++--
 lib/whimsy/asf/committee.rb |  2 +-
 lib/whimsy/asf/documents.rb |  6 +--
 lib/whimsy/asf/forms.rb     | 21 ++++++----
 lib/whimsy/asf/forms2.rb    | 21 ++++++----
 lib/whimsy/asf/icla.rb      | 14 +++----
 lib/whimsy/asf/ldap.rb      | 72 ++++++++++++++++-----------------
 lib/whimsy/asf/mail.rb      |  4 +-
 lib/whimsy/asf/memapps.rb   |  9 ++---
 lib/whimsy/asf/member.rb    | 24 +++++------
 lib/whimsy/asf/mlist.rb     | 97 ++++++++++++++++++++++-----------------------
 11 files changed, 142 insertions(+), 136 deletions(-)

diff --git a/lib/whimsy/asf/auth.rb b/lib/whimsy/asf/auth.rb
index 135814f..a5d1935 100644
--- a/lib/whimsy/asf/auth.rb
+++ b/lib/whimsy/asf/auth.rb
@@ -9,7 +9,7 @@ module ASF
 
     # Return the set of authorizations a given user (availid) has access to.
     def self.find_by_id(value)
-      new.select {|auth, ids| ids.include? value}.map(&:first)
+      new.select {|_auth, ids| ids.include? value}.map(&:first)
     end
 
     # Select a given <tt>-authorization-template</tt>, valid values are
@@ -35,7 +35,7 @@ module ASF
       groups = read_auth.scan(/^([-\w]+)=\{auth\}/).flatten
       # extract the group = list details and return the appropriate ones
       read_conf.scan(/^([-\w]+) *= *(\w.*)?$/).each do |pmc, ids|
-        yield pmc, (ids||'').split(' ') if groups.include? pmc
+        yield pmc, (ids || '').split(' ') if groups.include? pmc
       end
     end
 
@@ -48,12 +48,12 @@ module ASF
 
     # read the config file - extract the [explicit] section
     def read_conf
-      File.read(File.join(@auth,'auth.conf')).scan(/^\[explicit\].*(?:^\[)?/m).first rescue ''
+      File.read(File.join(@auth, 'auth.conf')).scan(/^\[explicit\].*(?:^\[)?/m).first rescue ''
     end
 
     # read the auth template; extract [groups]
     def read_auth
-      File.read(File.join(@auth,"#{@file}-authorization-template")).scan(/^\[groups\].*^\[/m).first rescue ''
+      File.read(File.join(@auth, "#{@file}-authorization-template")).scan(/^\[groups\].*^\[/m).first rescue ''
     end
   end
 
diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index 8bb3ae7..2021b43 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -88,7 +88,7 @@ module ASF
       'travel assistance'              => 'tac',
       'web services'                   => 'ws'
 
-    @@namemap = Proc.new do |name|
+    @@namemap = proc do |name|
       # Drop parenthesized comments and downcase before lookup; drop all spaces after lookup
       # So aliases table does not need to contain entries for Traffic Server and XML Graphics.
       # Also compress white-space before lookup so tabs etc from index.html don't matter
diff --git a/lib/whimsy/asf/documents.rb b/lib/whimsy/asf/documents.rb
index 79bf2d5..532d08d 100644
--- a/lib/whimsy/asf/documents.rb
+++ b/lib/whimsy/asf/documents.rb
@@ -53,7 +53,7 @@ module ASF
     # Returns the basename or nil if no match
     def self.match_claRef(claRef)
       unless @@h_claRef
-        h_claRef = Hash.new
+        h_claRef = {}
         listnames.map do |l|
           # Match either full name (e.g. directory) or stem (e.g. name.pdf)
           if l.end_with? '/'
@@ -105,7 +105,7 @@ module ASF
   class EmeritusFiles
     @base = 'emeritus'
     def self.listnames(getDates=false)
-      _, list = ASF::SVN.getlisting(@base,nil,true,getDates)
+      _, list = ASF::SVN.getlisting(@base, nil, true, getDates)
       list
     end
 
@@ -115,7 +115,7 @@ module ASF
     def self.find(person, getDate=false)
       # TODO use common stem name method
       name = (person.attrs['cn'].first rescue person.member_name).force_encoding('utf-8').
-        downcase.gsub(' ','-').gsub(/[^a-z0-9-]+/,'') rescue nil
+        downcase.gsub(' ', '-').gsub(/[^a-z0-9-]+/, '') rescue nil
       id = person.id
       files = self.listnames(getDate).find_all do |file|
         if file.is_a?(Array) # we have [epoch, file]
diff --git a/lib/whimsy/asf/forms.rb b/lib/whimsy/asf/forms.rb
index 709e693..d6741b3 100644
--- a/lib/whimsy/asf/forms.rb
+++ b/lib/whimsy/asf/forms.rb
@@ -80,11 +80,13 @@ class Wunderbar::HtmlMarkup
     _whimsy_control_wrapper(args) do
       args[:class] = 'form-control'
       if args[:rows]
-        _textarea! type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class], aria_describedby: args[:aria_describedby], rows: args[:rows] do
+        _textarea! type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class],
+                   aria_describedby: args[:aria_describedby], rows: args[:rows] do
           _! args[:value]
         end
       else
-        _input type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class], aria_describedby: args[:aria_describedby]
+        _input type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class],
+               aria_describedby: args[:aria_describedby]
       end
     end
   end
@@ -105,7 +107,8 @@ class Wunderbar::HtmlMarkup
       if args[:multiple]
         args[:multiple] = 'true'
       end
-      _select.form_control type: args[:type], name: args[:name], id: args[:id], value: args[:value], aria_describedby: args[:aria_describedby], multiple: args[:multiple] do
+      _select.form_control type: args[:type], name: args[:name], id: args[:id], value: args[:value],
+                           aria_describedby: args[:aria_describedby], multiple: args[:multiple] do
         if ''.eql?(args[:placeholder])
           _option '', value: '', selected: 'selected'
         else
@@ -154,18 +157,20 @@ class Wunderbar::HtmlMarkup
       # Construct list of all :options; mark any that are in :selected
       if args[:options].kind_of?(Array)
         args[:options].each do |val|
-          checked = true if args[:selected] && args[:selected].include?(val.to_s)
+          checked = true if args[:selected]&.include?(val.to_s)
           _label class: "#{args[:type]}-inline" do
-            _input! type: args[:type], name: args[:name], id: args[:id], value: val, class: args[:class], aria_describedby: args[:aria_describedby], checked: checked do
+            _input! type: args[:type], name: args[:name], id: args[:id], value: val, class: args[:class],
+                    aria_describedby: args[:aria_describedby], checked: checked do
               _! val
             end
           end
         end
       elsif args[:options].kind_of?(Hash)
         args[:options].each do |val, disp|
-          checked = true if args[:selected] && args[:selected].include?(val.to_s)
+          checked = true if args[:selected]&.include?(val.to_s)
           _label class: "#{args[:type]}-inline" do
-            _input! type: args[:type], name: args[:name], id: args[:id], value: val, class: args[:class], aria_describedby: args[:aria_describedby], checked: checked do
+            _input! type: args[:type], name: args[:name], id: args[:id], value: val, class: args[:class],
+                    aria_describedby: args[:aria_describedby], checked: checked do
               _! disp
             end
           end
@@ -178,7 +183,7 @@ class Wunderbar::HtmlMarkup
   # @returns {field: 'string', field2: ['array', 'only for', 'multivalue'] ...}
   def _whimsy_params2formdata(params)
     formdata = {}
-    params.each do |k,v|
+    params.each do |k, v|
       v && (v.length == 1) ? formdata[k] = v[0] : formdata[k] = v
     end
     return formdata
diff --git a/lib/whimsy/asf/forms2.rb b/lib/whimsy/asf/forms2.rb
index 185e4f4..54bdef5 100644
--- a/lib/whimsy/asf/forms2.rb
+++ b/lib/whimsy/asf/forms2.rb
@@ -76,11 +76,13 @@ class Wunderbar::HtmlMarkup
     _whimsy_control_wrapper(args) do
       args['class'] = 'form-control'
       if args['rows']
-        _textarea! type: args['type'], name: args['name'], id: args['id'], value: args['value'], class: args['class'], aria_describedby: args['aria_describedby'], rows: args['rows'] do
+        _textarea! type: args['type'], name: args['name'], id: args['id'], value: args['value'], class: args['class'],
+                   aria_describedby: args['aria_describedby'], rows: args['rows'] do
           _! args['value']
         end
       else
-        _input type: args['type'], name: args['name'], id: args['id'], value: args['value'], class: args['class'], aria_describedby: args['aria_describedby']
+        _input type: args['type'], name: args['name'], id: args['id'], value: args['value'], class: args['class'],
+               aria_describedby: args['aria_describedby']
       end
     end
   end
@@ -100,7 +102,8 @@ class Wunderbar::HtmlMarkup
       if args['multiple']
         args['multiple'] = 'true'
       end
-      _select.form_control type: args['type'], name: args['name'], id: args['id'], value: args['value'], aria_describedby: args['aria_describedby'], multiple: args['multiple'] do
+      _select.form_control type: args['type'], name: args['name'], id: args['id'], value: args['value'],
+                           aria_describedby: args['aria_describedby'], multiple: args['multiple'] do
         if ''.eql?(args['placeholder'])
           _option '', value: '', selected: 'selected'
         else
@@ -149,15 +152,17 @@ class Wunderbar::HtmlMarkup
       # Construct list of all :options; mark any that are in :selected
       if args['options'].kind_of?(Array)
         args['options'].each do |val|
-          checked = true if args['selected'] && args['selected'].include?(val.to_s)
-          _input type: args['type'], name: args['name'], id: args['id'], value: val, class: args['class'], aria_describedby: args['aria_describedby'], checked: checked do
+          checked = true if args['selected']&.include?(val.to_s)
+          _input type: args['type'], name: args['name'], id: args['id'], value: val, class: args['class'],
+                 aria_describedby: args['aria_describedby'], checked: checked do
             _! val
           end
         end
       elsif args['options'].kind_of?(Hash)
         args['options'].each do |val, disp|
-          checked = true if args['selected'] && args['selected'].include?(val.to_s)
-          _input type: args['type'], name: args['name'], id: args['id'], value: val, class: args['class'], aria_describedby: args['aria_describedby'], checked: checked do
+          checked = true if args['selected']&.include?(val.to_s)
+          _input type: args['type'], name: args['name'], id: args['id'], value: val, class: args['class'],
+                 aria_describedby: args['aria_describedby'], checked: checked do
             _! disp
           end
         end
@@ -169,7 +174,7 @@ class Wunderbar::HtmlMarkup
   # @returns {field: 'string', field2: ['array', 'only for', 'multivalue'] ...}
   def _whimsy_params2formdata(params)
     formdata = {}
-    params.each do |k,v|
+    params.each do |k, v|
       v && (v.length == 1) ? formdata[k] = v[0] : formdata[k] = v
     end
     return formdata
diff --git a/lib/whimsy/asf/icla.rb b/lib/whimsy/asf/icla.rb
index b9df4ed..560d920 100644
--- a/lib/whimsy/asf/icla.rb
+++ b/lib/whimsy/asf/icla.rb
@@ -59,7 +59,7 @@ module ASF
     def self.svn_change
       self.refresh
       if SOURCE
-        @@svn_change ||= Time.parse(ASF::SVN.getInfoItem(SOURCE,'last-changed-date')).gmtime
+        @@svn_change ||= Time.parse(ASF::SVN.getInfoItem(SOURCE, 'last-changed-date')).gmtime
       end
     end
 
@@ -151,18 +151,18 @@ module ASF
 
     # show the original entry (reconstructed for now)
     def as_line
-      [id,legal_name,name,email,form].join(':')
+      [id, legal_name, name, email, form].join(':')
     end
 
     # rearrange line in an order suitable for sorting
     def self.lname(line)
       return '' if line.start_with? '#'
-      _, name, rest = line.split(':',3)
+      _, name, rest = line.split(':', 3)
       return '' unless name
 
       # Drop trailing (comment string) or /* comment */
-      name.sub! /\(.+\)$/,''
-      name.sub! /\/\*.+\*\/$/,''
+      name.sub!(/\(.+\)$/, '')
+      name.sub!(/\/\*.+\*\/$/, '')
       return '' if name.strip.empty?
 
       name = ASF::Person.sortable_name(name)
@@ -220,7 +220,7 @@ module ASF
 
     # list of all availids that are are taken or reserved
     # See also ASF::Mail.taken?
-    def self.availids_taken()
+    def self.availids_taken
       self.availids_reserved + self.availids
     end
 
@@ -234,7 +234,7 @@ module ASF
     # is the id available?
     # See also ASF::Mail.taken?
     def self.available?(id)
-      return ! self.taken?(id)
+      return !self.taken?(id)
     end
 
     # does the entry not have an id?
diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 22c4e1f..ca10493 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -189,7 +189,7 @@ module ASF
       hosts = ASF::LDAP::RO_HOSTS if hosts.empty?
 
       hosts.shuffle!
-      #Wunderbar.debug "Hosts:\n#{hosts.join(' ')}"
+      # Wunderbar.debug "Hosts:\n#{hosts.join(' ')}"
       @hosts = hosts
     end
 
@@ -210,7 +210,7 @@ module ASF
       cert = Dir["#{ETCLDAP}/asf*-ldap-client.pem"].first
 
       # verify/obtain/write the cert
-      if not cert
+      unless cert
         cert = "#{ETCLDAP}/asf-ldap-client.pem"
         File.write cert, ASF::LDAP.puppet_cert || self.extract_cert
       end
@@ -451,25 +451,25 @@ module ASF
     # return the collection of instances of this class, as a hash.  Note the
     # values are weak references, so may have already been reclaimed.
     def self.collection
-      @collection ||= Hash.new
+      @collection ||= {}
     end
 
     # Find an instance of this class, given a name
-    def self.[] name
+    def self.[](name)
       new(name)
     end
 
     # Find an instance of this class, given a name
-    def self.find name
+    def self.find(name)
       new(name)
     end
 
     # Create an instance of this class, given a name.  Note: if an instance
     # already exists, it will return a handle to the existing object.
-    def self.new name
+    def self.new(name)
       begin
         object = collection[name]
-        return object.reference if object and object.weakref_alive?
+        return object.reference if object&.weakref_alive?
       rescue
       end
 
@@ -479,7 +479,7 @@ module ASF
     # create an instance of this class, returning a weak reference to the
     # object for reuse.  Note: self.new will check for such a reference and
     # return it in favor of allocating a new object.
-    def initialize name
+    def initialize(name)
       self.class.collection[name] = WeakRef.new(self)
       @name = name
     end
@@ -530,6 +530,7 @@ module ASF
   class LazyHash < Hash
     # capture an initializer to be called only if necessary.
     def initialize(&initializer)
+      super
       @initializer = initializer
     end
 
@@ -553,15 +554,15 @@ module ASF
     @base = 'ou=role,ou=groups,dc=apache,dc=org'
 
     # get a list of committers
-    def self.list()
+    def self.list
       ASF.search_one(base, 'cn=committers', 'member').flatten.
-        map {|uid| Person.find uid[/uid=(.*?),/,1]}
+        map {|uid| Person.find uid[/uid=(.*?),/, 1]}
     end
 
     # get a list of committers (ids only)
-    def self.listids()
+    def self.listids
       ASF.search_one(base, 'cn=committers', 'member').flatten.
-        map {|uid| uid[/uid=(.*?),/,1]}
+        map {|uid| uid[/uid=(.*?),/, 1]}
     end
 
     # create a new person and add as a new committer to LDAP.
@@ -625,7 +626,7 @@ module ASF
       ASF::Group['committers'].remove(person) rescue nil
 
       # remove person from 'new' committers list, ignoring exceptions
-      ASF::LDAP.modify("cn=committers,#@base",
+      ASF::LDAP.modify("cn=committers,#{@base}",
         [ASF::Base.mod_delete('member', [person.dn])]) rescue nil
 
       # remove person from LDAP (should almost never be done)
@@ -641,7 +642,7 @@ module ASF
       end
 
       # add person to 'new' committers list
-      ASF::LDAP.modify("cn=committers,#@base",
+      ASF::LDAP.modify("cn=committers,#{@base}",
         [ASF::Base.mod_add('member', [person.dn])])
 
       # add person to 'legacy' committers list
@@ -660,7 +661,7 @@ module ASF
       ASF::Group['committers'].remove(person)
 
       # remove person from 'new' committers list
-      ASF::LDAP.modify("cn=committers,#@base",
+      ASF::LDAP.modify("cn=committers,#{@base}",
         [ASF::Base.mod_delete('member', [person.dn])])
     end
 
@@ -697,7 +698,7 @@ module ASF
         filter = "(|#{people.map {|person| "(uid=#{person.name})"}.join})"
       end
 
-      zero = Hash[attributes.map {|attribute| [attribute,nil]}]
+      zero = Hash[attributes.map {|attribute| [attribute, nil]}]
 
       data = ASF.search_one(base, filter, attributes + ['uid'])
       data = Hash[data.map! {|hash| [list[hash['uid'].first], hash]}]
@@ -713,7 +714,7 @@ module ASF
     end
 
     # return person only if it actually exits
-    def self.[] id
+    def self.[](id)
       person = super
       person.attrs['dn'] ? person : nil
     end
@@ -732,7 +733,7 @@ module ASF
 
     # Is this person listed in the committers LDAP group?
     def asf_committer?
-       ASF::Group.new('committers').include? self
+      ASF::Group.new('committers').include? self
     end
 
     # determine if the person is banned.  If scanning a large list, consider
@@ -800,7 +801,7 @@ module ASF
 
       # add in projects
       # Get list of project names where the person is an owner
-      projects = self.projects.select{|prj| prj.owners.include? self}.map(&:name)
+      projects = self.projects.select {|prj| prj.owners.include? self}.map(&:name)
       committees += ASF::Committee.pmcs.select do |pmc|
         projects.include? pmc.name
       end
@@ -825,7 +826,7 @@ module ASF
 
     # list of Podlings that this individual is a member (owner) of
     def podlings
-      ASF::Podling.current.select{|pod| project_owners.map(&:name).include? pod.name}
+      ASF::Podling.current.select {|pod| project_owners.map(&:name).include? pod.name}
     end
 
     # list of LDAP groups that this individual is a member of
@@ -921,7 +922,7 @@ module ASF
         'gidNumber' => nextuid.to_s,
         'asf-committer-email' => "#{availid}@apache.org",
         'objectClass' => %w(person top posixAccount organizationalPerson
-           inetOrgPerson asf-committer hostObject ldapPublicKey)
+                            inetOrgPerson asf-committer hostObject ldapPublicKey)
       })
 
       # defaults
@@ -934,7 +935,7 @@ module ASF
       attrs = ASF::Person.ldap_name(attrs['cn']).merge(attrs)
 
       # generate a password that is between 8 and 16 alphanumeric characters
-      if not attrs['userPassword']
+      unless attrs['userPassword']
         while attrs['userPassword'].to_s.length < 8
           attrs['userPassword'] = SecureRandom.base64(12).gsub(/\W+/, '')
         end
@@ -996,7 +997,7 @@ module ASF
         group = ASF::Group.find(cn)
         group.modifyTimestamp = results['modifyTimestamp'].first # it is returned as an array of 1 entry
         group.createTimestamp = results['createTimestamp'].first # it is returned as an array of 1 entry
-        members = results['memberUid']  || []
+        members = results['memberUid'] || []
         group.members = members
         [group, members]
       end]
@@ -1009,7 +1010,7 @@ module ASF
     attr_accessor :createTimestamp
 
     # return group only if it actually exits
-    def self.[] name
+    def self.[](name)
       group = super
       group.dn ? group : nil
     end
@@ -1096,7 +1097,7 @@ module ASF
     end
 
     # return project only if it actually exits
-    def self.[] name
+    def self.[](name)
       project = super
       project.dn ? project : nil
     end
@@ -1170,7 +1171,7 @@ module ASF
       members = weakref(:members) do
         ASF.search_one(base, "cn=#{name}", 'member').flatten
       end
-      members.map {|uid| uid[/uid=(.*?),/,1]}
+      members.map {|uid| uid[/uid=(.*?),/, 1]}
     end
 
     # list of owners on this project.  Stored in LDAP as a <tt>owners</tt>
@@ -1184,10 +1185,9 @@ module ASF
       owners = weakref(:owners) do
         ASF.search_one(base, "cn=#{name}", 'owner').flatten
       end
-      owners.map {|uid| uid[/uid=(.*?),/,1]}
+      owners.map {|uid| uid[/uid=(.*?),/, 1]}
     end
 
-
     # remove people from a project as owners and members in LDAP
     def remove(people)
       remove_owners(people)
@@ -1251,10 +1251,10 @@ module ASF
     @base = nil # not sure it makes sense to define base here
 
     # return committee only if it actually exists
-    def self.[] name
+    def self.[](name)
       committee = super
       # Cannot rely on presence/absence of LDAP record as projects includes podlings
-      (ASF::Committee.pmcs+ASF::Committee.nonpmcs).map(&:name).include?(name) ? committee : nil
+      (ASF::Committee.pmcs + ASF::Committee.nonpmcs).map(&:name).include?(name) ? committee : nil
     end
 
     # Date this committee was last modified in LDAP.
@@ -1383,7 +1383,7 @@ module ASF
         ASF.search_one(base, "cn=#{name}", 'member').flatten
       end
 
-      members.map {|uid| Person.find uid[/uid=(.*?),/,1]}
+      members.map {|uid| Person.find uid[/uid=(.*?),/, 1]}
     end
 
     # list of memberids for this service in LDAP
@@ -1392,7 +1392,7 @@ module ASF
         ASF.search_one(base, "cn=#{name}", 'member').flatten
       end
 
-      members.map {|uid| uid[/uid=(.*?),/,1]}
+      members.map {|uid| uid[/uid=(.*?),/, 1]}
     end
 
     # remove people from this service in LDAP
@@ -1464,16 +1464,16 @@ end
 if __FILE__ == $0
   $LOAD_PATH.unshift '/srv/whimsy/lib'
   require 'whimsy/asf/config'
-  mem=ASF.members()
+  mem = ASF.members()
   puts mem.length
   puts mem.first.inspect
-  memids=ASF.memberids()
+  memids = ASF.memberids()
   puts memids.length
   puts memids.first
-  new=ASF.committers()
+  new = ASF.committers()
   puts new.length
   puts new.first.inspect
-  newids=ASF.committerids()
+  newids = ASF.committerids()
   puts newids.length
   puts newids.first
   ASF::RoleGroup.listcns.map {|g| puts ASF::RoleGroup.find(g).dn}
diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index 402fc5d..a4cb4ed 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -11,7 +11,7 @@ module ASF
       rescue NoMethodError, WeakRef::RefError
       end
 
-      list = Hash.new
+      list = {}
 
       # load info from LDAP
       people = ASF::Person.preload(['mail', 'asf-altEmail'])
@@ -137,7 +137,6 @@ module ASF
       allowed
     end
 
-
     # common configuration for sending mail; loads <tt>:sendmail</tt>
     # configuration from <tt>~/.whimsy</tt> if available; otherwise default
     # to disable openssl verification as that is what it required in order
@@ -229,7 +228,6 @@ module ASF
       end
     end
 
-
     # Load the flags file
     def self._load_flags
       # flags for each mailing list
diff --git a/lib/whimsy/asf/memapps.rb b/lib/whimsy/asf/memapps.rb
index c06af10..27a4317 100644
--- a/lib/whimsy/asf/memapps.rb
+++ b/lib/whimsy/asf/memapps.rb
@@ -15,10 +15,9 @@ module ASF
     # list the stems of the files
     def self.stems
       refresh
-      apps = @@files.map do |file|
+      @@files.map do |file|
         file.sub(/\.\w+$/, '')
       end
-      apps
     end
 
     # list the names of the files (excluding any ones which record emeritus)
@@ -29,7 +28,7 @@ module ASF
 
     def self.sanitize(name)
       # Don't transform punctation into '-'
-      ASF::Person.asciize(name.strip.downcase.gsub(/[.,()"]/,''))
+      ASF::Person.asciize(name.strip.downcase.gsub(/[.,()"]/, ''))
     end
 
     # search for file name
@@ -56,8 +55,8 @@ module ASF
     # find the memapp for a person; return an array:
     # - [array of files that matched (possibly empty), array of stems that were tried]
     def self.find(person)
-      found=[] # matches we found
-      names=[] # names we tried
+      found = [] # matches we found
+      names = [] # names we tried
       [
         (person.icla.legal_name rescue nil),
         (person.icla.name rescue nil),
diff --git a/lib/whimsy/asf/member.rb b/lib/whimsy/asf/member.rb
index 4cb3770..b8ce310 100644
--- a/lib/whimsy/asf/member.rb
+++ b/lib/whimsy/asf/member.rb
@@ -13,7 +13,7 @@ module ASF
     # Return the members.txt value associated with a given id
     def self.find_text_by_id(value)
       new.each do |id, text|
-        return text if id==value
+        return text if id == value
       end
       nil
     end
@@ -25,7 +25,7 @@ module ASF
 
     # extract 1st line and remove any trailing /* comment */
     def self.get_name(txt)
-      txt[/(.*?)\n/, 1].sub(/\s+\/\*.*/,'')
+      txt[/(.*?)\n/, 1].sub(/\s+\/\*.*/, '')
     end
 
     # return a list of <tt>members.txt</tt> entries as a Hash.  Keys are
@@ -72,7 +72,7 @@ module ASF
       sections = ASF::Member.text.to_s.split(/(.*\n===+)/)
       sections.shift(3)
       sections.each_slice(2) do |header, text|
-        header.sub!(/s\n=+/,'')
+        header.sub!(/s\n=+/, '')
         text.scan(/Avail ID: (.*)/).flatten.each {|id| status[id] = header}
       end
 
@@ -82,14 +82,14 @@ module ASF
 
     # Return a list of availids of emeritus members
     def self.emeritus
-      status.select{|k,v| v.start_with? 'Emeritus'}.keys
+      status.select {|_k, v| v.start_with? 'Emeritus'}.keys
     end
 
     # An iterator that returns a list of ids and associated members.txt entries.
     def each
       ASF::Member.text.to_s.split(/^ \*\) /).each do |section|
-        id = section[/Avail ID: (.*)/,1]
-        yield id, section.sub(/\n.*\n===+\s*?\n(.*\n)+.*/,'').strip if id
+        id = section[/Avail ID: (.*)/, 1]
+        yield id, section.sub(/\n.*\n===+\s*?\n(.*\n)+.*/, '').strip if id
       end
       nil
     end
@@ -112,7 +112,7 @@ module ASF
     # a <tt>Time</tt> object.
     def self.svn_change
       file = File.join(ASF::SVN['foundation'], 'members.txt')
-      return Time.parse(ASF::SVN.getInfoItem(file,'last-changed-date')).gmtime
+      return Time.parse(ASF::SVN.getInfoItem(file, 'last-changed-date')).gmtime
     end
 
     # sort an entire members.txt file
@@ -210,9 +210,9 @@ module ASF
       [
         fullname, # will be prefixed by ' *) '
         # Each line of address is indented
-        (address.gsub(/^/,'    ').gsub(/\r/,'')),
+        (address.gsub(/^/, '    ').gsub(/\r/, '')),
         ("    #{country}"     unless country.empty?),
-         "    Email: #{email}",
+        "    Email: #{email}",
         ("      Tel: #{tele}" unless tele.empty?),
         ("      Fax: #{fax}"  unless fax.empty?),
         " Forms on File: ASF Membership Application",
@@ -256,7 +256,7 @@ if __FILE__ == $0
   puts ASF::Member.list.size
   puts ASF::Member.status.size
   puts ASF::Member.text.size
-  ids=0
-  ASF::Member.each{|id,txt| ids+= 1}
+  ids = 0
+  ASF::Member.each {|_| ids += 1}
   puts ids
-end
\ No newline at end of file
+end
diff --git a/lib/whimsy/asf/mlist.rb b/lib/whimsy/asf/mlist.rb
index 792d84b..753b406 100644
--- a/lib/whimsy/asf/mlist.rb
+++ b/lib/whimsy/asf/mlist.rb
@@ -22,8 +22,8 @@ module ASF
     # Note that the data files don't provide information on whether a list is
     # public or private.
 
-    @@file_times  = Hash.new # Key=type, value = modtime
-    @@file_parsed = Hash.new # Key=type, value = cache hash
+    @@file_times  = {} # Key=type, value = modtime
+    @@file_parsed = {} # Key=type, value = cache hash
 
     # Return an array of board subscribers followed by the file update time
     def self.board_subscribers(archivers=true)
@@ -40,7 +40,7 @@ module ASF
     # pmc can either be a pmc name, in which case it uses private@<pmc>.apache.org
     # or it can be an ASF list name, e.g. w3c@apache.org
     def self.private_subscribers(pmc, archivers=false)
-      return [] unless Dir.exists? LIST_BASE
+      return [] unless Dir.exist? LIST_BASE
       parts = pmc.split('@', 3) # want to detect trailing '@'
       if parts.length == 1
         return list_filter('sub', "#{pmc}.apache.org", 'private', archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS))
@@ -52,7 +52,7 @@ module ASF
     end
 
     def self.security_subscribers(pmc, archivers=false)
-      return [] unless Dir.exists? LIST_BASE
+      return [] unless Dir.exist? LIST_BASE
       return list_filter('sub', "#{pmc}.apache.org", 'security', archivers), (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS))
     end
 
@@ -63,15 +63,15 @@ module ASF
     # N.B. not the same format as the moderates() method
     def self.subscriptions(emails, response = {})
 
-      return response unless File.exists? LIST_SUBS
+      return response unless File.exist? LIST_SUBS
 
       response[:subscriptions] = []
       response[:subtime] = (File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS))
 
-      _emails = emails.map{|email| ASF::Mail.to_canonical(email.downcase)}
+      emailslc = emails.map {|email| ASF::Mail.to_canonical(email.downcase)}
       list_parse('sub') do |dom, list, subs|
         subs.each do |sub|
-          if _emails.include? ASF::Mail.to_canonical(sub.downcase)
+          if emailslc.include? ASF::Mail.to_canonical(sub.downcase)
             response[:subscriptions] << ["#{list}@#{dom}", sub]
           end
         end
@@ -86,15 +86,15 @@ module ASF
     # N.B. not the same format as the moderates() method
     def self.digests(emails, response = {})
 
-      return response unless File.exists? LIST_DIGS
+      return response unless File.exist? LIST_DIGS
 
       response[:digests] = []
       response[:digtime] = (File.mtime(LIST_TIME) rescue File.mtime(LIST_DIGS))
 
-      _emails = emails.map{|email| ASF::Mail.to_canonical(email.downcase)}
+      emailslc = emails.map {|email| ASF::Mail.to_canonical(email.downcase)}
       list_parse('dig') do |dom, list, subs|
         subs.each do |sub|
-          if _emails.include? ASF::Mail.to_canonical(sub.downcase)
+          if emailslc.include? ASF::Mail.to_canonical(sub.downcase)
             response[:digests] << ["#{list}@#{dom}", sub]
           end
         end
@@ -109,13 +109,13 @@ module ASF
     # N.B. not the same format as the subscriptions() method
     def self.moderates(user_emails, response = {})
 
-      return response unless File.exists? LIST_MODS
+      return response unless File.exist? LIST_MODS
 
       response[:moderates] = {}
       response[:modtime] = (File.mtime(LIST_TIME) rescue File.mtime(LIST_MODS))
-      umails = user_emails.map{|m| ASF::Mail.to_canonical(m.downcase)} # outside loop
+      umails = user_emails.map {|m| ASF::Mail.to_canonical(m.downcase)} # outside loop
       list_parse('mod') do |dom, list, emails|
-        matching = emails.select{|m| umails.include? ASF::Mail.to_canonical(m.downcase)}
+        matching = emails.select {|m| umails.include? ASF::Mail.to_canonical(m.downcase)}
         response[:moderates]["#{list}@#{dom}"] = matching unless matching.empty?
       end
       response
@@ -144,7 +144,7 @@ module ASF
         #Apache lists (e.g. some non-PMCs)
         #/home/apmail/lists/apache.org/list/mod
         next unless "#{mail_domain}.apache.org" == dom or
-           (dom == 'apache.org' &&  list =~ /^#{mail_domain}(-|$)/) or
+           (dom == 'apache.org' && list =~ /^#{mail_domain}(-|$)/) or
            (podling && dom == 'incubator.apache.org' && list =~ /^#{mail_domain}-/)
         moderators["#{list}@#{dom}"] = subs.sort
       end
@@ -187,11 +187,11 @@ module ASF
         #/home/apmail/lists/apache.org/list/mod
 
         next unless "#{mail_domain}.apache.org" == dom or
-           (dom == 'apache.org' &&  list =~ /^#{mail_domain}(-|$)/) or
+           (dom == 'apache.org' && list =~ /^#{mail_domain}(-|$)/) or
            (podling && dom == 'incubator.apache.org' && list =~ /^#{mail_domain}-/)
 
         if skip_archivers
-          subscribers["#{list}@#{dom}"] = list_subs ? subs.reject{|sub| is_archiver?(sub)}.sort : subs.reject{|sub| is_archiver?(sub)}.size
+          subscribers["#{list}@#{dom}"] = list_subs ? subs.reject {|sub| is_archiver?(sub)}.sort : subs.reject {|sub| is_archiver?(sub)}.size
         else
           subscribers["#{list}@#{dom}"] = list_subs ? subs.sort : subs.size
         end
@@ -213,10 +213,9 @@ module ASF
     # incubator.apache.org/{mail_domain}-.* (if podling==true)
     # Returns: {list}@{dom}
     def self.list_subs(mail_domain, podling=false, list_subs=false)
-      self.list_subscribers(mail_domain,podling,list_subs,true)
+      self.list_subscribers(mail_domain, podling, list_subs, true)
     end
 
-
     # returns the list time (defaulting to list-subs time if the marker is not present)
     def self.list_time
       File.mtime(LIST_TIME) rescue File.mtime(LIST_SUBS)
@@ -224,14 +223,14 @@ module ASF
 
     def self.list_archivers
       list_parse('sub') do |dom, list, subs|
-        yield [dom, list, subs.select {|s| is_archiver? s}.map{|m| [m,archiver_type(m,dom,list)].flatten}]
+        yield [dom, list, subs.select {|s| is_archiver? s}.map {|m| [m, archiver_type(m, dom, list)].flatten}]
       end
     end
 
     # return the [domain, list] for all entries in the subscriber listings
     # the subscribers are not included
     def self.each_list
-      list_parse('sub') do |dom, list, subs|
+      list_parse('sub') do |dom, list, _subs|
         yield [dom, list]
       end
     end
@@ -240,7 +239,7 @@ module ASF
 
     # return the archiver type as array: [:MBOX|:PONY|:MINO|:MAIL_ARCH|:MARKMAIL|:WHIMSY, 'public'|'private'|'alias'|'direct']
     # minotaur archiver names do not include any public/private indication as that is in bin/.archives
-    def self.archiver_type(email, dom,list)
+    def self.archiver_type(email, dom, list)
       case email
         when ARCH_MBOX_PUB then return [:MBOX, 'public']
         when ARCH_MBOX_PRV then return [:MBOX, 'private']
@@ -252,39 +251,39 @@ module ASF
         when "#{list}-archive@#{dom}" then return [:MINO, 'alias']
         # Direct mail to minotaur
         when "apmail-#{dom.split('.').first}-#{list}-archive@www.apache.org" then return [:MINO, 'direct']
-      else
-        return [:MARKMAIL, 'public'] if is_markmail_archiver?(email)
-        # Whimsy currently only 'archives' private lists
-        return [:WHIMSY, 'private'] if is_whimsy_archiver?(email)
+        else
+          return [:MARKMAIL, 'public'] if is_markmail_archiver?(email)
+          # Whimsy currently only 'archives' private lists
+          return [:WHIMSY, 'private'] if is_whimsy_archiver?(email)
       end
       raise "Unexpected archiver email #{email} for #{list}@#{dom}" # Should not happen?
     end
 
     # Is the email a minotaur archiver?
-    def self.is_mino_archiver? (e)
+    def self.is_mino_archiver?(e)
       e =~ /.-archive@([^.]+\.)?(apache\.org|apachecon\.com)$/
     end
 
     # Is the email a Whimsy archiver?
-    def self.is_whimsy_archiver? (e)
+    def self.is_whimsy_archiver?(e)
       e =~ /@whimsy(-vm\d+)?\.apache\.org$/
     end
 
     # Is the email a markmail archiver?
-    def self.is_markmail_archiver? (e)
+    def self.is_markmail_archiver?(e)
       e =~ ARCH_EXT_MARKMAIL_RE
     end
 
-    def self.is_archiver? (e)
+    def self.is_archiver?(e)
       ARCHIVERS.include?(e) or is_mino_archiver?(e) or is_whimsy_archiver?(e) or is_markmail_archiver?(e)
     end
 
     def self.downcase(array)
-      array.map{|m| m.downcase}
+      array.map(&:downcase)
     end
 
     def self.isRecent(file)
-      return File.exist?(file) && ( Time.now - File.mtime(file) ) < 60*60*5
+      return File.exist?(file) && (Time.now - File.mtime(file)) < 60 * 60 * 5
     end
 
     # Filter the appropriate list, matching on domain and list
@@ -297,13 +296,13 @@ module ASF
     # If there is no match, then nil is returned
     def self.list_filter(type, matchdom, matchlist, archivers=true)
       list_parse(type) do |dom, list, emails|
-          if matchdom == dom && matchlist == list
-            if archivers
-              return emails
-            else
-            return emails.reject{|e| is_archiver?(e)}
-            end
+        if matchdom == dom && matchlist == list
+          if archivers
+            return emails
+          else
+            return emails.reject {|e| is_archiver?(e)}
           end
+        end
       end
       return nil
     end
@@ -333,7 +332,7 @@ module ASF
         cached = @@file_parsed[type]
         if cached
           begin
-            cached.each do |d,l,m|
+            cached.each do |d, l, m|
               # don't allow cache to be altered
               yield d.freeze, l.freeze, m.freeze
             end
@@ -345,7 +344,7 @@ module ASF
       else
         @@file_parsed[type] = nil
       end
-      cache = Array.new # see if this preserves mod cache
+      cache = [] # see if this preserves mod cache
       # split file into paragraphs
       File.read(path).split(/\n\n/).each do |stanza|
         # domain may start in column 1 or following a '/'
@@ -357,13 +356,13 @@ module ASF
           dom = match[1].downcase # just in case
           list = match[2].downcase # just in case
           # Keep original case of email addresses
-          mails = stanza.split(/\n/).select{|x| x =~ /@/}
+          mails = stanza.split(/\n/).select {|x| x =~ /@/}
           cache << [dom, list, mails]
           # don't allow cache to be altered
           yield dom.freeze, list.freeze, mails.freeze
         else
           # don't allow mismatches as that means the RE is wrong
-          line=stanza[0..(stanza.index("\n")|| -1)]
+          line = stanza[0..(stanza.index("\n") || -1)]
           raise ArgumentError.new("Unexpected section header #{line}")
         end
       end
@@ -404,17 +403,17 @@ module ASF
 end
 
 if __FILE__ == $0
-  $i=0
-  ASF::MLIST.list_flags() { |x| $i += 1 }
-    p $i
+  $i = 0
+  ASF::MLIST.list_flags() { $i += 1 }
+  p $i
   exit
-  domain = ARGV.shift||'whimsical'
+  domain = ARGV.shift || 'whimsical'
   p  ASF::MLIST.list_subscribers(domain)
-  p  ASF::MLIST.list_subscribers(domain,false,false,true)
+  p  ASF::MLIST.list_subscribers(domain, false, false, true)
   p  ASF::MLIST.list_subs(domain)
-  p  ASF::MLIST.list_subscribers(domain,false,true)
-  p  ASF::MLIST.list_subscribers(domain,false,true,true)
-  p  ASF::MLIST.list_subs(domain,false,true)
+  p  ASF::MLIST.list_subscribers(domain, false, true)
+  p  ASF::MLIST.list_subscribers(domain, false, true, true)
+  p  ASF::MLIST.list_subs(domain, false, true)
   p  ASF::MLIST.list_moderators(domain, true)
   p  ASF::MLIST.private_subscribers(domain)
   # Needed because these methods call ASF::Mail.to_canonical