Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 1/3] send-email: Don't use FQDNs without a '.'

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:35

Brian Gernhardt [off-list ref] writes:
 		$maildomain = $domain
-			unless $^O eq 'darwin' && $domain =~ /\.local$/;
+			unless $^O eq 'darwin' && $domain =~ /\.local$/
+				or $domain !~ /\./;
It would become *much* easier to read if we stop using the statement
modifier, and write it in a more straightforward way:

	unless (($^O eq 'darwin' && $domain =~ /\.local$/)
        	|| $domain !~ /\./) {
                $maildomain = $domain;
	}

as the condition seems to have grown large enough to exceed "by the way
don't do this under this narrow condition", which is what statement
modifiers are designed to be used.  Also mixing && and or that have
different precedence taxes readers' brainpower unnecessarily.

I also think that this particular exception logic should probably be in a
separate helper function that is called from the two places.

Jari, you are the last person who touched code around this area.  What do
you think?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help