You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@whimsical.apache.org by Sam Ruby <ru...@intertwingly.net> on 2020/01/12 22:28:02 UTC

Re: [whimsy] branch master updated: Simplify; drop unused vars

Um, members is not an unused variable.  See:

https://github.com/apache/whimsy/blob/master/lib/whimsy/asf/ldap.rb#L1020

- Sam Ruby

On Sun, Jan 12, 2020 at 5:22 PM <se...@apache.org> wrote:
>
> 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 8be2d6c  Simplify; drop unused vars
> 8be2d6c is described below
>
> commit 8be2d6ce151502714b0917a33dc4994de1723512
> Author: Sebb <se...@apache.org>
> AuthorDate: Sun Jan 12 22:21:50 2020 +0000
>
>     Simplify; drop unused vars
> ---
>  lib/whimsy/asf/ldap.rb | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
> index 49f0dbe..e2669aa 100644
> --- a/lib/whimsy/asf/ldap.rb
> +++ b/lib/whimsy/asf/ldap.rb
> @@ -198,7 +198,7 @@ module ASF
>      def self.extract_cert
>        host = hosts.sample[%r{//(.*?)(/|$)}, 1]
>        puts ['openssl', 's_client', '-connect', host, '-showcerts'].join(' ')
> -      out, err, rc = Open3.capture3 'openssl', 's_client',
> +      out, _, _ = Open3.capture3 'openssl', 's_client',
>          '-connect', host, '-showcerts'
>        out[/^-+BEGIN.*?\n-+END[^\n]+\n/m]
>      end
> @@ -1023,16 +1023,12 @@ module ASF
>
>      # return a list of ASF::People who are members of this group
>      def members
> -      members = weakref(:members) do
> -        ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> -      end
> -
> -      members.map {|uid| Person.find(uid)}
> +      memberids.map {|uid| Person.find(uid)}
>      end
>
>      # return a list of ids who are members of this group
>      def memberids
> -      members = weakref(:members) do
> +      weakref(:members) do
>          ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
>        end
>      end
>

Re: [whimsy] branch master updated: Simplify; drop unused vars

Posted by sebb <se...@gmail.com>.
On Mon, 13 Jan 2020 at 01:55, Sam Ruby <ru...@intertwingly.net> wrote:

> On Sun, Jan 12, 2020 at 5:37 PM sebb <se...@gmail.com> wrote:
> >
> > Oops - this was a complaint from ruby --debug, obviously a false positive
>
> It turns out that it was not a false positive.  Without the 'self.',
> it WAS being treated like a local variable.
>
>
Good catch in turn.


> Good catch!
>
> - Sam Ruby
>
> > On Sun, 12 Jan 2020 at 22:28, Sam Ruby <ru...@intertwingly.net> wrote:
> >
> > > Um, members is not an unused variable.  See:
> > >
> > >
> https://github.com/apache/whimsy/blob/master/lib/whimsy/asf/ldap.rb#L1020
> > >
> > > - Sam Ruby
> > >
> > > On Sun, Jan 12, 2020 at 5:22 PM <se...@apache.org> wrote:
> > > >
> > > > 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 8be2d6c  Simplify; drop unused vars
> > > > 8be2d6c is described below
> > > >
> > > > commit 8be2d6ce151502714b0917a33dc4994de1723512
> > > > Author: Sebb <se...@apache.org>
> > > > AuthorDate: Sun Jan 12 22:21:50 2020 +0000
> > > >
> > > >     Simplify; drop unused vars
> > > > ---
> > > >  lib/whimsy/asf/ldap.rb | 10 +++-------
> > > >  1 file changed, 3 insertions(+), 7 deletions(-)
> > > >
> > > > diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
> > > > index 49f0dbe..e2669aa 100644
> > > > --- a/lib/whimsy/asf/ldap.rb
> > > > +++ b/lib/whimsy/asf/ldap.rb
> > > > @@ -198,7 +198,7 @@ module ASF
> > > >      def self.extract_cert
> > > >        host = hosts.sample[%r{//(.*?)(/|$)}, 1]
> > > >        puts ['openssl', 's_client', '-connect', host,
> > > '-showcerts'].join(' ')
> > > > -      out, err, rc = Open3.capture3 'openssl', 's_client',
> > > > +      out, _, _ = Open3.capture3 'openssl', 's_client',
> > > >          '-connect', host, '-showcerts'
> > > >        out[/^-+BEGIN.*?\n-+END[^\n]+\n/m]
> > > >      end
> > > > @@ -1023,16 +1023,12 @@ module ASF
> > > >
> > > >      # return a list of ASF::People who are members of this group
> > > >      def members
> > > > -      members = weakref(:members) do
> > > > -        ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> > > > -      end
> > > > -
> > > > -      members.map {|uid| Person.find(uid)}
> > > > +      memberids.map {|uid| Person.find(uid)}
> > > >      end
> > > >
> > > >      # return a list of ids who are members of this group
> > > >      def memberids
> > > > -      members = weakref(:members) do
> > > > +      weakref(:members) do
> > > >          ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> > > >        end
> > > >      end
> > > >
> > >
>

Re: [whimsy] branch master updated: Simplify; drop unused vars

Posted by Sam Ruby <ru...@intertwingly.net>.
On Sun, Jan 12, 2020 at 5:37 PM sebb <se...@gmail.com> wrote:
>
> Oops - this was a complaint from ruby --debug, obviously a false positive

It turns out that it was not a false positive.  Without the 'self.',
it WAS being treated like a local variable.

Good catch!

- Sam Ruby

> On Sun, 12 Jan 2020 at 22:28, Sam Ruby <ru...@intertwingly.net> wrote:
>
> > Um, members is not an unused variable.  See:
> >
> > https://github.com/apache/whimsy/blob/master/lib/whimsy/asf/ldap.rb#L1020
> >
> > - Sam Ruby
> >
> > On Sun, Jan 12, 2020 at 5:22 PM <se...@apache.org> wrote:
> > >
> > > 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 8be2d6c  Simplify; drop unused vars
> > > 8be2d6c is described below
> > >
> > > commit 8be2d6ce151502714b0917a33dc4994de1723512
> > > Author: Sebb <se...@apache.org>
> > > AuthorDate: Sun Jan 12 22:21:50 2020 +0000
> > >
> > >     Simplify; drop unused vars
> > > ---
> > >  lib/whimsy/asf/ldap.rb | 10 +++-------
> > >  1 file changed, 3 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
> > > index 49f0dbe..e2669aa 100644
> > > --- a/lib/whimsy/asf/ldap.rb
> > > +++ b/lib/whimsy/asf/ldap.rb
> > > @@ -198,7 +198,7 @@ module ASF
> > >      def self.extract_cert
> > >        host = hosts.sample[%r{//(.*?)(/|$)}, 1]
> > >        puts ['openssl', 's_client', '-connect', host,
> > '-showcerts'].join(' ')
> > > -      out, err, rc = Open3.capture3 'openssl', 's_client',
> > > +      out, _, _ = Open3.capture3 'openssl', 's_client',
> > >          '-connect', host, '-showcerts'
> > >        out[/^-+BEGIN.*?\n-+END[^\n]+\n/m]
> > >      end
> > > @@ -1023,16 +1023,12 @@ module ASF
> > >
> > >      # return a list of ASF::People who are members of this group
> > >      def members
> > > -      members = weakref(:members) do
> > > -        ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> > > -      end
> > > -
> > > -      members.map {|uid| Person.find(uid)}
> > > +      memberids.map {|uid| Person.find(uid)}
> > >      end
> > >
> > >      # return a list of ids who are members of this group
> > >      def memberids
> > > -      members = weakref(:members) do
> > > +      weakref(:members) do
> > >          ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> > >        end
> > >      end
> > >
> >

Re: [whimsy] branch master updated: Simplify; drop unused vars

Posted by Sam Ruby <ru...@intertwingly.net>.
On Sun, Jan 12, 2020 at 5:37 PM sebb <se...@gmail.com> wrote:
>
> Oops - this was a complaint from ruby --debug, obviously a false positive

Would self.members = eliminate the warning?

- Sam Ruby


> On Sun, 12 Jan 2020 at 22:28, Sam Ruby <ru...@intertwingly.net> wrote:
>
> > Um, members is not an unused variable.  See:
> >
> > https://github.com/apache/whimsy/blob/master/lib/whimsy/asf/ldap.rb#L1020
> >
> > - Sam Ruby
> >
> > On Sun, Jan 12, 2020 at 5:22 PM <se...@apache.org> wrote:
> > >
> > > 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 8be2d6c  Simplify; drop unused vars
> > > 8be2d6c is described below
> > >
> > > commit 8be2d6ce151502714b0917a33dc4994de1723512
> > > Author: Sebb <se...@apache.org>
> > > AuthorDate: Sun Jan 12 22:21:50 2020 +0000
> > >
> > >     Simplify; drop unused vars
> > > ---
> > >  lib/whimsy/asf/ldap.rb | 10 +++-------
> > >  1 file changed, 3 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
> > > index 49f0dbe..e2669aa 100644
> > > --- a/lib/whimsy/asf/ldap.rb
> > > +++ b/lib/whimsy/asf/ldap.rb
> > > @@ -198,7 +198,7 @@ module ASF
> > >      def self.extract_cert
> > >        host = hosts.sample[%r{//(.*?)(/|$)}, 1]
> > >        puts ['openssl', 's_client', '-connect', host,
> > '-showcerts'].join(' ')
> > > -      out, err, rc = Open3.capture3 'openssl', 's_client',
> > > +      out, _, _ = Open3.capture3 'openssl', 's_client',
> > >          '-connect', host, '-showcerts'
> > >        out[/^-+BEGIN.*?\n-+END[^\n]+\n/m]
> > >      end
> > > @@ -1023,16 +1023,12 @@ module ASF
> > >
> > >      # return a list of ASF::People who are members of this group
> > >      def members
> > > -      members = weakref(:members) do
> > > -        ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> > > -      end
> > > -
> > > -      members.map {|uid| Person.find(uid)}
> > > +      memberids.map {|uid| Person.find(uid)}
> > >      end
> > >
> > >      # return a list of ids who are members of this group
> > >      def memberids
> > > -      members = weakref(:members) do
> > > +      weakref(:members) do
> > >          ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> > >        end
> > >      end
> > >
> >

Re: [whimsy] branch master updated: Simplify; drop unused vars

Posted by sebb <se...@gmail.com>.
Oops - this was a complaint from ruby --debug, obviously a false positive

On Sun, 12 Jan 2020 at 22:28, Sam Ruby <ru...@intertwingly.net> wrote:

> Um, members is not an unused variable.  See:
>
> https://github.com/apache/whimsy/blob/master/lib/whimsy/asf/ldap.rb#L1020
>
> - Sam Ruby
>
> On Sun, Jan 12, 2020 at 5:22 PM <se...@apache.org> wrote:
> >
> > 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 8be2d6c  Simplify; drop unused vars
> > 8be2d6c is described below
> >
> > commit 8be2d6ce151502714b0917a33dc4994de1723512
> > Author: Sebb <se...@apache.org>
> > AuthorDate: Sun Jan 12 22:21:50 2020 +0000
> >
> >     Simplify; drop unused vars
> > ---
> >  lib/whimsy/asf/ldap.rb | 10 +++-------
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> >
> > diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
> > index 49f0dbe..e2669aa 100644
> > --- a/lib/whimsy/asf/ldap.rb
> > +++ b/lib/whimsy/asf/ldap.rb
> > @@ -198,7 +198,7 @@ module ASF
> >      def self.extract_cert
> >        host = hosts.sample[%r{//(.*?)(/|$)}, 1]
> >        puts ['openssl', 's_client', '-connect', host,
> '-showcerts'].join(' ')
> > -      out, err, rc = Open3.capture3 'openssl', 's_client',
> > +      out, _, _ = Open3.capture3 'openssl', 's_client',
> >          '-connect', host, '-showcerts'
> >        out[/^-+BEGIN.*?\n-+END[^\n]+\n/m]
> >      end
> > @@ -1023,16 +1023,12 @@ module ASF
> >
> >      # return a list of ASF::People who are members of this group
> >      def members
> > -      members = weakref(:members) do
> > -        ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> > -      end
> > -
> > -      members.map {|uid| Person.find(uid)}
> > +      memberids.map {|uid| Person.find(uid)}
> >      end
> >
> >      # return a list of ids who are members of this group
> >      def memberids
> > -      members = weakref(:members) do
> > +      weakref(:members) do
> >          ASF.search_one(base, "cn=#{name}", 'memberUid').flatten
> >        end
> >      end
> >
>