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/23 12:09:44 UTC

[whimsy] branch travis-debug updated (9bd6462 -> eea99eb)

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

sebb pushed a change to branch travis-debug
in repository https://gitbox.apache.org/repos/asf/whimsy.git.


    from 9bd6462  Combine loops
     add 1369a77  Tidy code
     add 94a3e5a  Alignment
     add 0c7d557  Simplify conditional
     add c8673d2  Tidy
     add 7d92eff  Tidy: spacing etc
     add d5fafc1  title no longer needs to be consulted
     add f004ea8  call super with no arguments
     add fd23229  remove super entirely
     add 55cc6ca  add back in super, explicitly passing in no block
     new eea99eb  Don't misuse ===

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 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                             | 78 ++++++++---------
 lib/whimsy/asf/mail.rb                             |  4 +-
 lib/whimsy/asf/memapps.rb                          |  9 +-
 lib/whimsy/asf/member.rb                           | 24 +++---
 lib/whimsy/asf/mlist.rb                            | 97 +++++++++++-----------
 lib/whimsy/asf/nominees.rb                         |  6 +-
 lib/whimsy/asf/orgchart.rb                         |  2 +-
 lib/whimsy/asf/person.rb                           | 11 ++-
 lib/whimsy/asf/podling.rb                          | 27 +++---
 lib/whimsy/asf/svn.rb                              |  4 +-
 lib/whimsy/lockfile.rb                             |  2 +-
 www/board/agenda/daemon/wsc.rb                     |  2 +-
 www/board/agenda/routes.rb                         |  6 +-
 www/board/agenda/spec/spec_helper.rb               |  6 +-
 www/board/agenda/views/actions/financials.json.rb  |  2 +-
 .../agenda/views/actions/potential-actions.json.rb |  2 +-
 www/project/icla/views/actions/discuss.json.rb     |  2 +-
 www/project/icla/views/actions/vote.json.rb        |  2 +-
 www/secretary/workbench/helpers.rb                 |  4 +-
 www/secretary/workbench/models/events.rb           |  4 +-
 www/secretary/workbench/models/mailbox.rb          |  2 +-
 www/secretary/workbench/models/message.rb          |  6 +-
 www/secretary/workbench/server.rb                  |  4 +-
 www/status/monitors/git.rb                         |  2 +-
 www/status/monitors/svn.rb                         |  4 +-
 www/test/secretary/workbench/email.rb              |  2 +-
 32 files changed, 195 insertions(+), 191 deletions(-)


[whimsy] 01/01: Don't misuse ===

Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit eea99eb47b83096b54de9152cc71dc8315c93d5a
Author: Sebb <se...@apache.org>
AuthorDate: Mon Nov 23 12:08:13 2020 +0000

    Don't misuse ===
---
 lib/whimsy/asf/ldap.rb                                   | 6 +++---
 lib/whimsy/asf/svn.rb                                    | 4 ++--
 lib/whimsy/lockfile.rb                                   | 2 +-
 www/board/agenda/daemon/wsc.rb                           | 2 +-
 www/board/agenda/spec/spec_helper.rb                     | 6 +++---
 www/board/agenda/views/actions/financials.json.rb        | 2 +-
 www/board/agenda/views/actions/potential-actions.json.rb | 2 +-
 www/project/icla/views/actions/discuss.json.rb           | 2 +-
 www/project/icla/views/actions/vote.json.rb              | 2 +-
 www/secretary/workbench/helpers.rb                       | 4 ++--
 www/secretary/workbench/models/events.rb                 | 4 ++--
 www/secretary/workbench/models/mailbox.rb                | 2 +-
 www/secretary/workbench/models/message.rb                | 6 +++---
 www/secretary/workbench/server.rb                        | 4 ++--
 www/status/monitors/git.rb                               | 2 +-
 www/status/monitors/svn.rb                               | 4 ++--
 www/test/secretary/workbench/email.rb                    | 2 +-
 17 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index cac792a..512890b 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -340,7 +340,7 @@ module ASF
       end
     end
 
-    result.map! {|hash| hash[attrs]} if String === attrs
+    result.map! {|hash| hash[attrs]} if attrs.is_a? String
 
     result.compact
   end
@@ -510,7 +510,7 @@ module ASF
 
     # helper method to construct LDAP_MOD_REPLACE objects
     def self.mod_replace(attr, vals)
-      vals = Array(vals) unless Hash === vals
+      vals = Array(vals) unless vals.is_a? Hash
       ::LDAP::Mod.new(::LDAP::LDAP_MOD_REPLACE, attr.to_s, vals)
     end
 
@@ -864,7 +864,7 @@ module ASF
         return nil
       else
         result.map! do |value|
-          value = value.dup.force_encoding('utf-8') if String === value
+          value = value.dup.force_encoding('utf-8') if value.is_a? String
           value
         end
 
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 054de6d..9ab3c45 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -685,7 +685,7 @@ module ASF
     #   ASF::SVN.svnmucc_(commands,message,env,_,revision)
     def self.svnmucc_(commands, msg, env, _, revision, options={})
 
-      raise ArgumentError.new 'commands must be an array' unless Array === commands
+      raise ArgumentError.new 'commands must be an array' unless commands.is_a? Array
       raise ArgumentError.new 'msg must not be nil' unless msg
       raise ArgumentError.new 'env must not be nil' unless env
       raise ArgumentError.new '_ must not be nil' unless _
@@ -702,7 +702,7 @@ module ASF
         cmdfile = Tempfile.new('svnmucc_input', tmpdir)
         # add the commands
         commands.each do |cmd|
-          raise ArgumentError.new 'command entries must be an array' unless Array === cmd
+          raise ArgumentError.new 'command entries must be an array' unless cmd.is_a? Array
           cmd.each do |arg|
             cmdfile.puts(arg)
           end
diff --git a/lib/whimsy/lockfile.rb b/lib/whimsy/lockfile.rb
index 85069f8..7a758e6 100644
--- a/lib/whimsy/lockfile.rb
+++ b/lib/whimsy/lockfile.rb
@@ -97,7 +97,7 @@ if __FILE__ == $0
   puts ret.class.inspect
   puts ret.inspect
   if ret
-    if Errno::EEXIST === ret
+    if ret.is_a? Errno::EEXIST
       puts "Already exists!"
     else
       puts "Some other error"
diff --git a/www/board/agenda/daemon/wsc.rb b/www/board/agenda/daemon/wsc.rb
index b54e0a7..81620d1 100644
--- a/www/board/agenda/daemon/wsc.rb
+++ b/www/board/agenda/daemon/wsc.rb
@@ -103,7 +103,7 @@ EM.run do
       end
       response = http.request(request)
 
-      if Net::HTTPOK === response
+      if response.is_a? Net::HTTPOK
         session = JSON.parse(response.body)['session']
       else
         p response
diff --git a/www/board/agenda/spec/spec_helper.rb b/www/board/agenda/spec/spec_helper.rb
index fce60b9..fa8ee6d 100644
--- a/www/board/agenda/spec/spec_helper.rb
+++ b/www/board/agenda/spec/spec_helper.rb
@@ -42,8 +42,8 @@ module MockServer
     args.flatten!
     # Wunderbar .system accepts one or two trailing hashes; ignore them for now
     # TODO: do we need to handle :stdin?
-    args.pop if Hash === args.last
-    args.pop if Hash === args.last
+    args.pop if args.last.is_a? Hash
+    args.pop if args.last.is_a? Hash
     if args[1] == 'commit'
       @commits ||= {}
 
@@ -57,7 +57,7 @@ module MockServer
       `svn revert #{target}`
       0
     else
-      args.reject! {|arg| Array === arg}
+      args.reject! {|arg| arg.is_a? Array}
       @transcript ||= ''
       @transcript += `#{Shellwords.join(args)}`
       $?.exitstatus
diff --git a/www/board/agenda/views/actions/financials.json.rb b/www/board/agenda/views/actions/financials.json.rb
index afdbb5f..a928839 100644
--- a/www/board/agenda/views/actions/financials.json.rb
+++ b/www/board/agenda/views/actions/financials.json.rb
@@ -71,7 +71,7 @@ end
 # move headings from second to seventh row
 headings[2] = headings[6] = 'Budget'
 1.upto(7) do |i|
-  headings[i] = headings[i].strftime("%b-%y") if DateTime === headings[i]
+  headings[i] = headings[i].strftime("%b-%y") if headings[i].is_a? DateTime
   headings[i] = headings[i].rjust(12) if headings[i]
 end
 rows.insert(blank+1, headings)
diff --git a/www/board/agenda/views/actions/potential-actions.json.rb b/www/board/agenda/views/actions/potential-actions.json.rb
index 6ec0390..7e79b9f 100644
--- a/www/board/agenda/views/actions/potential-actions.json.rb
+++ b/www/board/agenda/views/actions/potential-actions.json.rb
@@ -13,7 +13,7 @@ minutes = File.basename(base).sub('agenda', 'minutes').sub('.txt', '.yml')
 date = minutes[/\d{4}_\d\d_\d\d/].gsub('_', '-')
 minutes = YAML.load_file("#{AGENDA_WORK}/#{minutes}") rescue {}
 minutes.each do |title, secnotes|
-  next unless String === secnotes
+  next unless secnotes.is_a? String
   secnotes.scan(pattern).each do |owner, text|
     text = text.reflow(6, 72).strip
     actions << {owner: owner, text: text, status: nil, pmc: title, date: date}
diff --git a/www/project/icla/views/actions/discuss.json.rb b/www/project/icla/views/actions/discuss.json.rb
index 5537ae9..c5ec1f9 100644
--- a/www/project/icla/views/actions/discuss.json.rb
+++ b/www/project/icla/views/actions/discuss.json.rb
@@ -80,7 +80,7 @@ err = LockFile.create_ex(file_name.untaint) do |f|
   f.write(JSON.pretty_generate(discussion))
 end
 if err
-  if Errno::EEXIST === err
+  if err.is_a? Errno::EEXIST
     _error 'There is already a file for that person!'
   else
     _error err.inspect
diff --git a/www/project/icla/views/actions/vote.json.rb b/www/project/icla/views/actions/vote.json.rb
index c7e55c1..f561bfc 100644
--- a/www/project/icla/views/actions/vote.json.rb
+++ b/www/project/icla/views/actions/vote.json.rb
@@ -79,7 +79,7 @@ err = LockFile.create_ex(file_name.untaint) do |f|
   f.write(JSON.pretty_generate(discussion))
 end
 if err
-  if Errno::EEXIST === err
+  if err.is_a? Errno::EEXIST
     _error 'There is already a file for that person!'
   else
     _error err.inspect
diff --git a/www/secretary/workbench/helpers.rb b/www/secretary/workbench/helpers.rb
index c9cc181..f583cbe 100644
--- a/www/secretary/workbench/helpers.rb
+++ b/www/secretary/workbench/helpers.rb
@@ -1,7 +1,7 @@
 helpers do
   # replace inline images (cid:) with references to attachments
   def fixup_images(node)
-    if Wunderbar::Node === node
+    if node.is_a? Wunderbar::Node
       if node.name == 'img'
         if node.attrs['src'] and node.attrs['src'].to_s.start_with? 'cid:'
           node.attrs['src'].value = node.attrs['src'].to_s.sub('cid:', '')
@@ -9,7 +9,7 @@ helpers do
       else
         fixup_images(node.search('img'))
       end
-    elsif Array === node
+    elsif node.is_a? Array
       node.each {|child| fixup_images(child)}
     end
   end
diff --git a/www/secretary/workbench/models/events.rb b/www/secretary/workbench/models/events.rb
index 42ad142..6e9d4e1 100644
--- a/www/secretary/workbench/models/events.rb
+++ b/www/secretary/workbench/models/events.rb
@@ -60,12 +60,12 @@ end
 
 # puma uses SIGUSR2
 restart_usr2 ||= trap 'SIGUSR2' do
-  restart_usr2.call if Proc === restart_usr2
+  restart_usr2.call if restart_usr2.is_a? Proc
   Events.shutdown
 end
 
 # thin uses SIGHUP
 restart_hup ||= trap 'SIGHUP' do
-  restart_hup.call if Proc === restart_hup
+  restart_hup.call if restart_hup.is_a? Proc
   Events.shutdown
 end
diff --git a/www/secretary/workbench/models/mailbox.rb b/www/secretary/workbench/models/mailbox.rb
index 784f32f..8171bfc 100644
--- a/www/secretary/workbench/models/mailbox.rb
+++ b/www/secretary/workbench/models/mailbox.rb
@@ -21,7 +21,7 @@ class Mailbox
     if mailboxes == nil
       options += %w(--delete --exclude=*.yml --exclude=*.mail)
       source = "#{SOURCE}/"
-    elsif Array === mailboxes
+    elsif mailboxes.is_a? Array
       host, path = SOURCE.split(':', 2)
       files = mailboxes.map {|name| "#{path}/#{name}*"}
       source = "#{host}:#{files.join(' ')}"
diff --git a/www/secretary/workbench/models/message.rb b/www/secretary/workbench/models/message.rb
index 556c186..9587246 100644
--- a/www/secretary/workbench/models/message.rb
+++ b/www/secretary/workbench/models/message.rb
@@ -77,7 +77,7 @@ class Message
   end
 
   def cc=(value)
-    value=value.split("\n") if String === value
+    value=value.split("\n") if value.is_a? String
     @headers[:cc]=value
   end
 
@@ -86,7 +86,7 @@ class Message
   end
 
   def bcc=(value)
-    value=value.split("\n") if String === value
+    value=value.split("\n") if value.is_a? String
     @headers[:bcc]=value
   end
 
@@ -172,7 +172,7 @@ class Message
     attachments = attachments.flatten.reject {|name| name.to_s.empty?}
 
     # if last argument is a Hash, treat it as name/value pairs
-    attachments += attachments.pop.to_a if Hash === attachments.last
+    attachments += attachments.pop.to_a if attachments.last.is_a? Hash
 
     if attachments.flatten.length == 1
       ext = File.extname(attachments.first).downcase
diff --git a/www/secretary/workbench/server.rb b/www/secretary/workbench/server.rb
index ec5cb4f..e583f32 100644
--- a/www/secretary/workbench/server.rb
+++ b/www/secretary/workbench/server.rb
@@ -160,7 +160,7 @@ patch %r{/(\d{6})/(\w+)/} do |month, hash|
 
       # special processing for entries with symbols as keys
       headers[hash].each do |key, value|
-        if Symbol === key and updates.has_key? key.to_s
+        if key.is_a? Symbol and updates.has_key? key.to_s
           headers[hash][key] = updates.delete(key.to_s)
         end
       end
@@ -296,7 +296,7 @@ get '/events', provides: 'text/event-stream' do
     loop do
       event = events.pop
 
-      if Hash === event or Array === event
+      if event.is_a? Hash or event.is_a? Array
         out << "data: #{JSON.dump(event)}\n\n"
       elsif event == :heartbeat
         out << ":\n"
diff --git a/www/status/monitors/git.rb b/www/status/monitors/git.rb
index 248076d..11e9dbe 100644
--- a/www/status/monitors/git.rb
+++ b/www/status/monitors/git.rb
@@ -103,7 +103,7 @@ def Monitor.git(previous_status)
         title = "partial response"
         level = 'warning'
         seen_level[level] = true
-      elsif String  === data
+      elsif data.is_a? String
         title = "No files updated"
       end
 
diff --git a/www/status/monitors/svn.rb b/www/status/monitors/svn.rb
index fb240b6..363acf6 100644
--- a/www/status/monitors/svn.rb
+++ b/www/status/monitors/svn.rb
@@ -40,7 +40,7 @@ def Monitor.svn(previous_status)
   updates.each do |update|
     level = 'success'
     title = nil
-    data = revision = update[REV_RE] # data === String
+    data = revision = update[REV_RE] # String.is_a? data
 
     lines = update.split("\n")
     repository = lines.shift.to_sym
@@ -65,7 +65,7 @@ def Monitor.svn(previous_status)
         title = "partial response"
         level = 'warning'
         seen_level[level] = true
-      elsif String  === data # only saw revision message
+      elsif data.is_a? String # only saw revision message
         title = "No files updated"
       elsif data.length == 1
         title = "1 file updated"
diff --git a/www/test/secretary/workbench/email.rb b/www/test/secretary/workbench/email.rb
index 2304580..a54ab11 100644
--- a/www/test/secretary/workbench/email.rb
+++ b/www/test/secretary/workbench/email.rb
@@ -22,7 +22,7 @@ class EmailTest < Test::Unit::TestCase
   def make_pending(*requests)
     # convert symbols into strings in each request
     requests.each do |vars|
-      vars.each_key {|key| vars[key.to_s] = vars.delete(key) if Symbol === key}
+      vars.each_key {|key| vars[key.to_s] = vars.delete(key) if key.is_a? Symbol}
     end
 
     # output pending