You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by vs...@apache.org on 2009/03/05 13:36:28 UTC

svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Author: vsiveton
Date: Thu Mar  5 12:36:27 2009
New Revision: 750442

URL: http://svn.apache.org/viewvc?rev=750442&view=rev
Log:
o improved the TODO with the issue

Modified:
    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java?rev=750442&r1=750441&r2=750442&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java Thu Mar  5 12:36:27 2009
@@ -136,7 +136,7 @@
   public PipelinedData substitute(Substitutions substituter) {
     return new PipelinedData(this, substituter);
   }
-  
+
   public interface Batch {
     Map<String, Object> getSocialPreloads();
     Map<String, RequestAuthenticationInfo> getHttpPreloads();
@@ -147,7 +147,7 @@
    * Gets the first batch of preload requests.  Preloads that require root
    * objects not yet available will not be executed in this batch, but may
    * become available in subsequent batches.
-   * 
+   *
    * @param rootObjects an ELResolver that can evaluate currently available
    *     root objects.
    * @see GadgetELResolver
@@ -156,7 +156,7 @@
   public Batch getBatch(ELResolver rootObjects) {
     return getBatch(rootObjects, socialPreloads, httpPreloads);
   }
-  
+
   /**
    * Create a Batch of preload requests
    * @param rootObjects an ELResolver that can evaluate currently available
@@ -168,11 +168,11 @@
       Map<String, HttpData> currentHttpPreloads) {
     Expressions expressions = Expressions.sharedInstance();
     ELContext elContext = expressions.newELContext(rootObjects);
- 
+
     // Evaluate all existing social preloads
     Map<String, Object> evaluatedSocialPreloads = Maps.newHashMap();
     Map<String, SocialData> pendingSocialPreloads = null;
-    
+
     if (currentSocialPreloads != null) {
       for (Map.Entry<String, SocialData> preload : currentSocialPreloads.entrySet()) {
         try {
@@ -189,11 +189,11 @@
           throw new RuntimeException(e);
         }
       }
-    }    
+    }
     // And evaluate all existing HTTP preloads
     Map<String, RequestAuthenticationInfo> evaluatedHttpPreloads = Maps.newHashMap();
     Map<String, HttpData> pendingHttpPreloads = null;
-    
+
     if (currentHttpPreloads != null) {
       for (Map.Entry<String, HttpData> preload : currentHttpPreloads.entrySet()) {
         try {
@@ -210,20 +210,20 @@
         }
       }
     }
-    
+
     // Nothing evaluated or pending;  return null for the batch.  Note that
-    // there may be multiple PipelinedData objects (e.g., from multiple 
+    // there may be multiple PipelinedData objects (e.g., from multiple
     // <script type="text/os-data"> elements), so even if all evaluations
     // fail here, evaluations might succeed elsewhere and free up pending preloads
     if (evaluatedSocialPreloads.isEmpty() && evaluatedHttpPreloads.isEmpty() &&
         pendingHttpPreloads == null && pendingSocialPreloads == null) {
       return null;
     }
-    
+
     return new BatchImpl(evaluatedSocialPreloads, evaluatedHttpPreloads,
         pendingSocialPreloads, pendingHttpPreloads);
   }
-  
+
   /** Batch implementation */
   class BatchImpl implements Batch {
 
@@ -244,7 +244,7 @@
     public Map<String, Object> getSocialPreloads() {
       return evaluatedSocialPreloads;
     }
-    
+
     public Map<String, RequestAuthenticationInfo> getHttpPreloads() {
       return evaluatedHttpPreloads;
     }
@@ -325,10 +325,10 @@
     copyAttribute("userId", child, expression, JSONArray.class);
     updateUserArrayState("userId", child);
     copyAttribute("appId", child, expression, String.class);
-    // TODO: should be activityIds?
+    // TODO: SHINDIG-711 should be activityIds?
     copyAttribute("activityId", child, expression, JSONArray.class);
     copyAttribute("fields", child, expression, JSONArray.class);
-    
+
     // TODO: add activity paging support
 
     return expression;
@@ -340,15 +340,15 @@
     if (method == null) {
       throw new SpecParserException("Missing @method attribute on os:DataRequest");
     }
-    
+
     // TODO: should we support anything that doesn't end in .get?
-    // i.e, should this be a whitelist not a blacklist? 
+    // i.e, should this be a whitelist not a blacklist?
     if (method.endsWith(".update")
         || method.endsWith(".create")
         || method.endsWith(".delete")) {
       throw new SpecParserException("Unsupported @method attribute \"" + method + "\" on os:DataRequest");
     }
-    
+
     SocialData expression = new SocialData(child.getAttribute("key"), method);
     NamedNodeMap nodeMap = child.getAttributes();
     for (int i = 0; i < nodeMap.getLength(); i++) {
@@ -357,13 +357,13 @@
       if (attrNode.getNamespaceURI() != null) {
         continue;
       }
-      
+
       String name = attrNode.getLocalName();
       // Skip the built-in names
       if ("method".equals(name) || "key".equals(name)) {
         continue;
       }
-      
+
       String value = attrNode.getNodeValue();
       expression.addProperty(name, value, Object.class);
     }
@@ -379,7 +379,7 @@
       if (data.signOwner) {
         needsOwner = true;
       }
-      
+
       if (data.signViewer) {
         needsViewer = true;
       }
@@ -446,7 +446,7 @@
       this.signViewer = booleanValue(element, "sign_viewer", true);
 
       Expressions expressions = Expressions.sharedInstance();
-      
+
       // TODO: many of these attributes should not be EL enabled
       Map<String, ValueExpression> attributes = Maps.newHashMap();
       for (int i = 0; i < element.getAttributes().getLength(); i++) {



Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Vincent Siveton <vi...@gmail.com>.
2009/3/8 Santiago Gala <sa...@gmail.com>:
> I think whitespace cleanup + tight specs for whitespace is useful as a
> whole. Quite often it is a nice byproduct of efforts to understand code
> or other refactorings. We clearly disagree here. But I'm about to stop

BTW our Checkstyle conf [1] avoids trailing space.

Cheers,

Vincent

[1] https://svn.apache.org/repos/asf/incubator/shindig/trunk/site/checkstyle.xml

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Santiago Gala <sa...@gmail.com>.
El dom, 08-03-2009 a las 09:15 -0700, Adam Winer escribió:
> On Sat, Mar 7, 2009 at 5:56 AM, Santiago Gala <sa...@gmail.com> wrote:
> > El vie, 06-03-2009 a las 08:13 -0800, Adam Winer escribió:
> >> What is the advantage of removing trailing whitespace?  I can't see a
> >> reason to do it at all.  Unlike removing unnecessary imports (say), it
> >> doesn't improve the codebase in any objective manner.
> >>
> >
> > The typical reason for removing whitespace is that whitespace changes
> > cause puzzling spurious diffs, where nothing changes but some whitespace
> > change gets committed. So, while it does not improve the codebase viewed
> > statically, useless whitespace are prone to change in time, and those
> > changes pollute the sequence of changesets that make the history of the
> > codebase. Hence the reason why Ian asked for a separate commit for
> > whitespace cleanup.
> 
> What creates spurious diffs isn't the presence of trailing whitespace,
> it's tools that remove trailing whitespace on lines you're not
> directly editing.  Eclipse, IntelliJ, and Emacs can all be configured
> not to do so.  (As best I can tell, they're all configured that way by
> default, too.)
> 

Lots of times it is also created by people inadvertently deleting or
adding invisible spaces, or having files with mix of tabs/spaces
processed automatically by editors. 

> > As for benefits of not having them, the simplest one is that codereview
> > and other diff tools won't flag trailing whitespace and whitespace
> > between tabs in red in ulterior diffs involving lines with them.
> 
> Code review tools should only flag diffs on lines that have been
> modified, so again we're back to "don't remove trailing whitespace on
> lines you're not otherwise touching".
> 

Most if not all diff tools are currently flagging "useless" whitespace
in red everywhere in the context shown, so I think you will need a lot
of evangelism to get this "should only" working.


> > But
> > whitespace cleanups are only worthwhile if new commits are disciplined
> > to not bring them in again.
> 
> Indeed, and a lot of the changes in these whitespace-removal commits
> are just removing "trailing" whitespace which is really just entirely
> blank lines between code.  That's much harder to stop, and IMO not
> worth trying to stop.
> 
> I really don't think we need any whitespace cleanup effort.
> 

I think whitespace cleanup + tight specs for whitespace is useful as a
whole. Quite often it is a nice byproduct of efforts to understand code
or other refactorings. We clearly disagree here. But I'm about to stop
being a mentor for Shindig, due to lack of time + lack of professional
incentive for gadgets, so my opinion should not be weighted too much
here.

Regards
Santiago

> -- Adam
> 
> 
> >
> > Regards
> > Santiago
> >
> >> Cheers,
> >> Adam
> >>
> >> On Fri, Mar 6, 2009 at 3:11 AM, Vincent Siveton <vs...@apache.org> wrote:
> >> > The majority of the source code had already removed trailing
> >> > whitespace. Some statistics:
> >> > - around 600 java files
> >> > - only around 140 java files don't removed trailing whitespace
> >> >
> >> > So, IMHO removing trailing whitespace is the way to go.
> >> >
> >> > WDYT?
> >> >
> >> > Cheers,
> >> >
> >> > Vincent
> >> >
> >> > 2009/3/5 Adam Winer <aw...@gmail.com>:
> >> >> Instead of 2 commits, could you change it to not remove trailing
> >> >> whitespaces?  It unnecessarily obfuscates history, especially when
> >> >> there's trailing whitespace on non-blank lines.  This is typically an
> >> >> option that can be adjusted in an IDE.
> >> >>
> >> >> -- Adam
> >> >>
> >> >>
> >> >> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vs...@apache.org> wrote:
> >> >>> Hi Adam,
> >> >>>
> >> >>> 2009/3/5 Adam Winer <aw...@google.com>:
> >> >>>> I see a lot of whitespace changes with each submission, apparently
> >> >>>> around blank lines.  Any way you could avoid making these changes?
> >> >>>> It's much harder to read diffs like this.
> >> >>>
> >> >>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits next time.
> >> >>>
> >> >>> Cheers,
> >> >>>
> >> >>> Vincent
> >> >>>
> >> >>
> >> >
> >
> >


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Adam Winer <aw...@gmail.com>.
On Sat, Mar 7, 2009 at 5:56 AM, Santiago Gala <sa...@gmail.com> wrote:
> El vie, 06-03-2009 a las 08:13 -0800, Adam Winer escribió:
>> What is the advantage of removing trailing whitespace?  I can't see a
>> reason to do it at all.  Unlike removing unnecessary imports (say), it
>> doesn't improve the codebase in any objective manner.
>>
>
> The typical reason for removing whitespace is that whitespace changes
> cause puzzling spurious diffs, where nothing changes but some whitespace
> change gets committed. So, while it does not improve the codebase viewed
> statically, useless whitespace are prone to change in time, and those
> changes pollute the sequence of changesets that make the history of the
> codebase. Hence the reason why Ian asked for a separate commit for
> whitespace cleanup.

What creates spurious diffs isn't the presence of trailing whitespace,
it's tools that remove trailing whitespace on lines you're not
directly editing.  Eclipse, IntelliJ, and Emacs can all be configured
not to do so.  (As best I can tell, they're all configured that way by
default, too.)

> As for benefits of not having them, the simplest one is that codereview
> and other diff tools won't flag trailing whitespace and whitespace
> between tabs in red in ulterior diffs involving lines with them.

Code review tools should only flag diffs on lines that have been
modified, so again we're back to "don't remove trailing whitespace on
lines you're not otherwise touching".

> But
> whitespace cleanups are only worthwhile if new commits are disciplined
> to not bring them in again.

Indeed, and a lot of the changes in these whitespace-removal commits
are just removing "trailing" whitespace which is really just entirely
blank lines between code.  That's much harder to stop, and IMO not
worth trying to stop.

I really don't think we need any whitespace cleanup effort.

-- Adam


>
> Regards
> Santiago
>
>> Cheers,
>> Adam
>>
>> On Fri, Mar 6, 2009 at 3:11 AM, Vincent Siveton <vs...@apache.org> wrote:
>> > The majority of the source code had already removed trailing
>> > whitespace. Some statistics:
>> > - around 600 java files
>> > - only around 140 java files don't removed trailing whitespace
>> >
>> > So, IMHO removing trailing whitespace is the way to go.
>> >
>> > WDYT?
>> >
>> > Cheers,
>> >
>> > Vincent
>> >
>> > 2009/3/5 Adam Winer <aw...@gmail.com>:
>> >> Instead of 2 commits, could you change it to not remove trailing
>> >> whitespaces?  It unnecessarily obfuscates history, especially when
>> >> there's trailing whitespace on non-blank lines.  This is typically an
>> >> option that can be adjusted in an IDE.
>> >>
>> >> -- Adam
>> >>
>> >>
>> >> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vs...@apache.org> wrote:
>> >>> Hi Adam,
>> >>>
>> >>> 2009/3/5 Adam Winer <aw...@google.com>:
>> >>>> I see a lot of whitespace changes with each submission, apparently
>> >>>> around blank lines.  Any way you could avoid making these changes?
>> >>>> It's much harder to read diffs like this.
>> >>>
>> >>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits next time.
>> >>>
>> >>> Cheers,
>> >>>
>> >>> Vincent
>> >>>
>> >>
>> >
>
>

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Vincent Siveton <vi...@gmail.com>.
2009/3/10 Paul Lindner <pl...@hi5.com>:
> Could we run these at svn commit time via a pre-commit hook?

Personally, I am not in favour of these kind of approach.

Cheers,

Vincent

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Upayavira <uv...@odoko.co.uk>.
On Tue, 2009-03-10 at 22:05 +0000, Ian Boston wrote:
> Does this help?
> 
> At the start of this thread, Adam was concerned that the commit  
> contained re-formatting.
> WIth the commit hook in place, every commit would be forced to fix all  
> formatting errors anywhere near the patched lines, which is exactly  
> what Adam was concerned about.
> That would continue until all the code was complaint, at which point  
> it might begin to serve the purpose.
> 
> I assume the commit hook would run against the patch rather than the  
> entire file, and presumably it would only be a set of regex's rather  
> than a full checkstyle run.

The entire ASF shares an SVN repo, which facilitates easy movement of
code between projects, etc. It does also mean that the entire ASF shares
a set of commit hooks. Therefore, regardless of whether they are a good
idea or not, we're not likely to get hooks set up just for us.

Upayavira



Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Ian Boston <ie...@tfd.co.uk>.
Does this help?

At the start of this thread, Adam was concerned that the commit  
contained re-formatting.
WIth the commit hook in place, every commit would be forced to fix all  
formatting errors anywhere near the patched lines, which is exactly  
what Adam was concerned about.
That would continue until all the code was complaint, at which point  
it might begin to serve the purpose.

I assume the commit hook would run against the patch rather than the  
entire file, and presumably it would only be a set of regex's rather  
than a full checkstyle run.

Ian

On 10 Mar 2009, at 21:51, Brian Eaton wrote:

> On Tue, Mar 10, 2009 at 1:12 PM, Paul Lindner <pl...@hi5.com>  
> wrote:
>
>> Could we run these at svn commit time via a pre-commit hook?
>>
>>
> That sounds good to me, not sure if we can do that with svn.


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Brian Eaton <be...@google.com>.
On Tue, Mar 10, 2009 at 1:12 PM, Paul Lindner <pl...@hi5.com> wrote:

> Could we run these at svn commit time via a pre-commit hook?
>
>
That sounds good to me, not sure if we can do that with svn.

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Paul Lindner <pl...@hi5.com>.
Could we run these at svn commit time via a pre-commit hook?

On Mar 10, 2009, at 11:24 AM, Vincent Siveton wrote:

> Hi Brian,
>
> 2009/3/10 Brian Eaton <be...@google.com>:
>> I'm already frustrated by how long it takes the rat checks to run  
>> during
>> build/test.
>
> I second your point.
> IMHO rat-maven-plugin/tools-maven-plugin should be declared in the
> release profile.
> Also, I don't think maven-source-plugin is very useful during the  
> development.
>
> We could save a lot of time moving them in a profile.
>
> Cheers,
>
> Vincent


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Vincent Siveton <vi...@gmail.com>.
Hi Brian,

2009/3/10 Brian Eaton <be...@google.com>:
> I'm already frustrated by how long it takes the rat checks to run during
> build/test.

I second your point.
IMHO rat-maven-plugin/tools-maven-plugin should be declared in the
release profile.
Also, I don't think maven-source-plugin is very useful during the development.

We could save a lot of time moving them in a profile.

Cheers,

Vincent

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Brian Eaton <be...@google.com>.
I'm already frustrated by how long it takes the rat checks to run during
build/test.

On Tue, Mar 10, 2009 at 10:51 AM, Paul Lindner <pl...@hi5.com> wrote:

> checkstyle runs in the reporting profile, which means that it's not really
> enforced.  If we run it during the build/test phase then we can enforce
> style.
>
>
>
> On Mar 10, 2009, at 9:51 AM, Vincent Siveton wrote:
>
>  Paul,
>>
>> 2009/3/10 Paul Lindner <pl...@hi5.com>:
>>
>>> If we're going to be pedantic about these sorts of things we should
>>> enforce
>>> them with checkstyle.  This way the checkin that activates the rule can
>>> include all the fixes to get the codebase in conformance.
>>>
>>
>> As I already mentioned in this thread, our Checkstyle conf [1] already
>> checks for trailing space.
>>
>> Cheers,
>>
>> Vincent
>>
>> [1]
>> http://svn.apache.org/repos/asf/incubator/shindig/trunk/site/checkstyle.xml
>>
>
>

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Ian Boston <ie...@tfd.co.uk>.
Would that be a bit OTT?
It would be very frustrating if the build failed all the time because  
of white space mistakes, I am thinking about local development rather  
than committed code.

Last time I looked
Social API had 204 style errors, 129 warnings and 1051 infos
Gadgets 595 errors, 351 warnings 2016 infos
Common 383 errors 66 warnings and 752 infos

That information is a bit old but if gives an idea of the distance  
between the checkstyle.xml and the code base. (BTW, I dont think that  
checkstyle.xml is correct at the moment, but it might be close)

Ian

On 10 Mar 2009, at 17:51, Paul Lindner wrote:

> checkstyle runs in the reporting profile, which means that it's not  
> really enforced.  If we run it during the build/test phase then we  
> can enforce style.
>
>
> On Mar 10, 2009, at 9:51 AM, Vincent Siveton wrote:
>
>> Paul,
>>
>> 2009/3/10 Paul Lindner <pl...@hi5.com>:
>>> If we're going to be pedantic about these sorts of things we  
>>> should enforce
>>> them with checkstyle.  This way the checkin that activates the  
>>> rule can
>>> include all the fixes to get the codebase in conformance.
>>
>> As I already mentioned in this thread, our Checkstyle conf [1]  
>> already
>> checks for trailing space.
>>
>> Cheers,
>>
>> Vincent
>>
>> [1] http://svn.apache.org/repos/asf/incubator/shindig/trunk/site/checkstyle.xml
>


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Paul Lindner <pl...@hi5.com>.
checkstyle runs in the reporting profile, which means that it's not  
really enforced.  If we run it during the build/test phase then we can  
enforce style.


On Mar 10, 2009, at 9:51 AM, Vincent Siveton wrote:

> Paul,
>
> 2009/3/10 Paul Lindner <pl...@hi5.com>:
>> If we're going to be pedantic about these sorts of things we should  
>> enforce
>> them with checkstyle.  This way the checkin that activates the rule  
>> can
>> include all the fixes to get the codebase in conformance.
>
> As I already mentioned in this thread, our Checkstyle conf [1] already
> checks for trailing space.
>
> Cheers,
>
> Vincent
>
> [1] http://svn.apache.org/repos/asf/incubator/shindig/trunk/site/checkstyle.xml


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Vincent Siveton <vi...@gmail.com>.
Paul,

2009/3/10 Paul Lindner <pl...@hi5.com>:
> If we're going to be pedantic about these sorts of things we should enforce
> them with checkstyle.  This way the checkin that activates the rule can
> include all the fixes to get the codebase in conformance.

As I already mentioned in this thread, our Checkstyle conf [1] already
checks for trailing space.

Cheers,

Vincent

[1] http://svn.apache.org/repos/asf/incubator/shindig/trunk/site/checkstyle.xml

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Paul Lindner <pl...@hi5.com>.
If we're going to be pedantic about these sorts of things we should  
enforce them with checkstyle.  This way the checkin that activates the  
rule can include all the fixes to get the codebase in conformance.

On Mar 10, 2009, at 2:24 AM, Ian Boston wrote:

>
>
> Here is my logic:
>
> 1. Patches should only change the lines that they relate to, if a  
> patch fixes a bug, thats all it should do.
> 2. To help achieve 1 we have a style guide, so we should not need to  
> change lines of code just for formatting or because its not the way  
> our IDE is configured to  do things.
> 3. The more we deviate from the style guide, the more effort is  
> going to be required to achieve patches satisfy 1.
> 4. No code base is perfect, all committers are human and every now  
> and again we are going to need a style amnesty to get the code base  
> back to a consistent form, so its probably better to do this in one  
> commit per module so that its easily identifiable as such.
>
> The deviations from style that exist in shindig may be tolerable,  
> but judging from the fact that this thread exists, they are not.
> There is tension between using IDE automation and keeping to 1.
>
>
> Ian
>
> On 9 Mar 2009, at 15:12, Adam Winer wrote:
>
>> What's your reason for favoring
>> cleanup?
>


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Ian Boston <ie...@tfd.co.uk>.

Here is my logic:

1. Patches should only change the lines that they relate to, if a  
patch fixes a bug, thats all it should do.
2. To help achieve 1 we have a style guide, so we should not need to  
change lines of code just for formatting or because its not the way  
our IDE is configured to  do things.
3. The more we deviate from the style guide, the more effort is going  
to be required to achieve patches satisfy 1.
4. No code base is perfect, all committers are human and every now and  
again we are going to need a style amnesty to get the code base back  
to a consistent form, so its probably better to do this in one commit  
per module so that its easily identifiable as such.

The deviations from style that exist in shindig may be tolerable, but  
judging from the fact that this thread exists, they are not.
There is tension between using IDE automation and keeping to 1.


Ian

On 9 Mar 2009, at 15:12, Adam Winer wrote:

> What's your reason for favoring
> cleanup?


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Adam Winer <aw...@gmail.com>.
On Mon, Mar 9, 2009 at 3:19 AM, Ian Boston <ie...@tfd.co.uk> wrote:
>
> On 7 Mar 2009, at 12:56, Santiago Gala wrote:
>
>> El vie, 06-03-2009 a las 08:13 -0800, Adam Winer escribió:
>>>
>>> What is the advantage of removing trailing whitespace?  I can't see a
>>> reason to do it at all.  Unlike removing unnecessary imports (say), it
>>> doesn't improve the codebase in any objective manner.
>>>
>>
>> The typical reason for removing whitespace is that whitespace changes
>> cause puzzling spurious diffs, where nothing changes but some whitespace
>> change gets committed. So, while it does not improve the codebase viewed
>> statically, useless whitespace are prone to change in time, and those
>> changes pollute the sequence of changesets that make the history of the
>> codebase. Hence the reason why Ian asked for a separate commit for
>> whitespace cleanup.
>
> You put it far better than I did.

A separate commit is undoubtedly better than repeated diffs in lots of
commits.  Hopefully no one disagrees with that.  And I'm fine with
tools that strip trailing whitespace on lines you're already editing.
But no-one has really explained why any cleanup is necessary, beyond
"some diff tools show red boxes"...  What's your reason for favoring
cleanup?

> Thank you
> Ian
>
>
>>
>>
>>
>> As for benefits of not having them, the simplest one is that codereview
>> and other diff tools won't flag trailing whitespace and whitespace
>> between tabs in red in ulterior diffs involving lines with them. But
>> whitespace cleanups are only worthwhile if new commits are disciplined
>> to not bring them in again.
>>
>> Regards
>> Santiago
>>
>>> Cheers,
>>> Adam
>>>
>>> On Fri, Mar 6, 2009 at 3:11 AM, Vincent Siveton <vs...@apache.org>
>>> wrote:
>>>>
>>>> The majority of the source code had already removed trailing
>>>> whitespace. Some statistics:
>>>> - around 600 java files
>>>> - only around 140 java files don't removed trailing whitespace
>>>>
>>>> So, IMHO removing trailing whitespace is the way to go.
>>>>
>>>> WDYT?
>>>>
>>>> Cheers,
>>>>
>>>> Vincent
>>>>
>>>> 2009/3/5 Adam Winer <aw...@gmail.com>:
>>>>>
>>>>> Instead of 2 commits, could you change it to not remove trailing
>>>>> whitespaces?  It unnecessarily obfuscates history, especially when
>>>>> there's trailing whitespace on non-blank lines.  This is typically an
>>>>> option that can be adjusted in an IDE.
>>>>>
>>>>> -- Adam
>>>>>
>>>>>
>>>>> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vs...@apache.org>
>>>>> wrote:
>>>>>>
>>>>>> Hi Adam,
>>>>>>
>>>>>> 2009/3/5 Adam Winer <aw...@google.com>:
>>>>>>>
>>>>>>> I see a lot of whitespace changes with each submission, apparently
>>>>>>> around blank lines.  Any way you could avoid making these changes?
>>>>>>> It's much harder to read diffs like this.
>>>>>>
>>>>>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits next
>>>>>> time.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Vincent
>>>>>>
>>>>>
>>>>
>>
>
>

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Ian Boston <ie...@tfd.co.uk>.
On 7 Mar 2009, at 12:56, Santiago Gala wrote:

> El vie, 06-03-2009 a las 08:13 -0800, Adam Winer escribió:
>> What is the advantage of removing trailing whitespace?  I can't see a
>> reason to do it at all.  Unlike removing unnecessary imports (say),  
>> it
>> doesn't improve the codebase in any objective manner.
>>
>
> The typical reason for removing whitespace is that whitespace changes
> cause puzzling spurious diffs, where nothing changes but some  
> whitespace
> change gets committed. So, while it does not improve the codebase  
> viewed
> statically, useless whitespace are prone to change in time, and those
> changes pollute the sequence of changesets that make the history of  
> the
> codebase. Hence the reason why Ian asked for a separate commit for
> whitespace cleanup.

You put it far better than I did.
Thank you
Ian


>
>
>
> As for benefits of not having them, the simplest one is that  
> codereview
> and other diff tools won't flag trailing whitespace and whitespace
> between tabs in red in ulterior diffs involving lines with them. But
> whitespace cleanups are only worthwhile if new commits are disciplined
> to not bring them in again.
>
> Regards
> Santiago
>
>> Cheers,
>> Adam
>>
>> On Fri, Mar 6, 2009 at 3:11 AM, Vincent Siveton  
>> <vs...@apache.org> wrote:
>>> The majority of the source code had already removed trailing
>>> whitespace. Some statistics:
>>> - around 600 java files
>>> - only around 140 java files don't removed trailing whitespace
>>>
>>> So, IMHO removing trailing whitespace is the way to go.
>>>
>>> WDYT?
>>>
>>> Cheers,
>>>
>>> Vincent
>>>
>>> 2009/3/5 Adam Winer <aw...@gmail.com>:
>>>> Instead of 2 commits, could you change it to not remove trailing
>>>> whitespaces?  It unnecessarily obfuscates history, especially when
>>>> there's trailing whitespace on non-blank lines.  This is  
>>>> typically an
>>>> option that can be adjusted in an IDE.
>>>>
>>>> -- Adam
>>>>
>>>>
>>>> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vsiveton@apache.org 
>>>> > wrote:
>>>>> Hi Adam,
>>>>>
>>>>> 2009/3/5 Adam Winer <aw...@google.com>:
>>>>>> I see a lot of whitespace changes with each submission,  
>>>>>> apparently
>>>>>> around blank lines.  Any way you could avoid making these  
>>>>>> changes?
>>>>>> It's much harder to read diffs like this.
>>>>>
>>>>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits  
>>>>> next time.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Vincent
>>>>>
>>>>
>>>
>


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Santiago Gala <sa...@gmail.com>.
El vie, 06-03-2009 a las 08:13 -0800, Adam Winer escribió:
> What is the advantage of removing trailing whitespace?  I can't see a
> reason to do it at all.  Unlike removing unnecessary imports (say), it
> doesn't improve the codebase in any objective manner.
> 

The typical reason for removing whitespace is that whitespace changes
cause puzzling spurious diffs, where nothing changes but some whitespace
change gets committed. So, while it does not improve the codebase viewed
statically, useless whitespace are prone to change in time, and those
changes pollute the sequence of changesets that make the history of the
codebase. Hence the reason why Ian asked for a separate commit for
whitespace cleanup. 


As for benefits of not having them, the simplest one is that codereview
and other diff tools won't flag trailing whitespace and whitespace
between tabs in red in ulterior diffs involving lines with them. But
whitespace cleanups are only worthwhile if new commits are disciplined
to not bring them in again.

Regards
Santiago

> Cheers,
> Adam
> 
> On Fri, Mar 6, 2009 at 3:11 AM, Vincent Siveton <vs...@apache.org> wrote:
> > The majority of the source code had already removed trailing
> > whitespace. Some statistics:
> > - around 600 java files
> > - only around 140 java files don't removed trailing whitespace
> >
> > So, IMHO removing trailing whitespace is the way to go.
> >
> > WDYT?
> >
> > Cheers,
> >
> > Vincent
> >
> > 2009/3/5 Adam Winer <aw...@gmail.com>:
> >> Instead of 2 commits, could you change it to not remove trailing
> >> whitespaces?  It unnecessarily obfuscates history, especially when
> >> there's trailing whitespace on non-blank lines.  This is typically an
> >> option that can be adjusted in an IDE.
> >>
> >> -- Adam
> >>
> >>
> >> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vs...@apache.org> wrote:
> >>> Hi Adam,
> >>>
> >>> 2009/3/5 Adam Winer <aw...@google.com>:
> >>>> I see a lot of whitespace changes with each submission, apparently
> >>>> around blank lines.  Any way you could avoid making these changes?
> >>>> It's much harder to read diffs like this.
> >>>
> >>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits next time.
> >>>
> >>> Cheers,
> >>>
> >>> Vincent
> >>>
> >>
> >


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Adam Winer <aw...@gmail.com>.
What is the advantage of removing trailing whitespace?  I can't see a
reason to do it at all.  Unlike removing unnecessary imports (say), it
doesn't improve the codebase in any objective manner.

Cheers,
Adam

On Fri, Mar 6, 2009 at 3:11 AM, Vincent Siveton <vs...@apache.org> wrote:
> The majority of the source code had already removed trailing
> whitespace. Some statistics:
> - around 600 java files
> - only around 140 java files don't removed trailing whitespace
>
> So, IMHO removing trailing whitespace is the way to go.
>
> WDYT?
>
> Cheers,
>
> Vincent
>
> 2009/3/5 Adam Winer <aw...@gmail.com>:
>> Instead of 2 commits, could you change it to not remove trailing
>> whitespaces?  It unnecessarily obfuscates history, especially when
>> there's trailing whitespace on non-blank lines.  This is typically an
>> option that can be adjusted in an IDE.
>>
>> -- Adam
>>
>>
>> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vs...@apache.org> wrote:
>>> Hi Adam,
>>>
>>> 2009/3/5 Adam Winer <aw...@google.com>:
>>>> I see a lot of whitespace changes with each submission, apparently
>>>> around blank lines.  Any way you could avoid making these changes?
>>>> It's much harder to read diffs like this.
>>>
>>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits next time.
>>>
>>> Cheers,
>>>
>>> Vincent
>>>
>>
>

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Vincent Siveton <vs...@apache.org>.
Hi Ian,

2009/3/6 Ian Boston <ie...@tfd.co.uk>:
> Could this be done in a single separate commit ?

I was my original point.

Cheers,

Vincent

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Ian Boston <ie...@tfd.co.uk>.
Could this be done in a single separate commit ?
Although it will disrupt the history, at least it will keep patches  
precise going forwards.
(I think I might have been guilty on one or two occasions in the past  
with javadoc, I had some bad code templates at one point)
Ian

On 6 Mar 2009, at 11:11, Vincent Siveton wrote:

> The majority of the source code had already removed trailing
> whitespace. Some statistics:
> - around 600 java files
> - only around 140 java files don't removed trailing whitespace
>
> So, IMHO removing trailing whitespace is the way to go.
>
> WDYT?
>
> Cheers,
>
> Vincent
>
> 2009/3/5 Adam Winer <aw...@gmail.com>:
>> Instead of 2 commits, could you change it to not remove trailing
>> whitespaces?  It unnecessarily obfuscates history, especially when
>> there's trailing whitespace on non-blank lines.  This is typically an
>> option that can be adjusted in an IDE.
>>
>> -- Adam
>>
>>
>> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton  
>> <vs...@apache.org> wrote:
>>> Hi Adam,
>>>
>>> 2009/3/5 Adam Winer <aw...@google.com>:
>>>> I see a lot of whitespace changes with each submission, apparently
>>>> around blank lines.  Any way you could avoid making these changes?
>>>> It's much harder to read diffs like this.
>>>
>>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits  
>>> next time.
>>>
>>> Cheers,
>>>
>>> Vincent
>>>
>>


Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Vincent Siveton <vs...@apache.org>.
The majority of the source code had already removed trailing
whitespace. Some statistics:
- around 600 java files
- only around 140 java files don't removed trailing whitespace

So, IMHO removing trailing whitespace is the way to go.

WDYT?

Cheers,

Vincent

2009/3/5 Adam Winer <aw...@gmail.com>:
> Instead of 2 commits, could you change it to not remove trailing
> whitespaces?  It unnecessarily obfuscates history, especially when
> there's trailing whitespace on non-blank lines.  This is typically an
> option that can be adjusted in an IDE.
>
> -- Adam
>
>
> On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vs...@apache.org> wrote:
>> Hi Adam,
>>
>> 2009/3/5 Adam Winer <aw...@google.com>:
>>> I see a lot of whitespace changes with each submission, apparently
>>> around blank lines.  Any way you could avoid making these changes?
>>> It's much harder to read diffs like this.
>>
>> Yeah, my IDE removes trailing whitespaces. I will do 2 commits next time.
>>
>> Cheers,
>>
>> Vincent
>>
>

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Adam Winer <aw...@gmail.com>.
Instead of 2 commits, could you change it to not remove trailing
whitespaces?  It unnecessarily obfuscates history, especially when
there's trailing whitespace on non-blank lines.  This is typically an
option that can be adjusted in an IDE.

-- Adam


On Thu, Mar 5, 2009 at 3:21 PM, Vincent Siveton <vs...@apache.org> wrote:
> Hi Adam,
>
> 2009/3/5 Adam Winer <aw...@google.com>:
>> I see a lot of whitespace changes with each submission, apparently
>> around blank lines.  Any way you could avoid making these changes?
>> It's much harder to read diffs like this.
>
> Yeah, my IDE removes trailing whitespaces. I will do 2 commits next time.
>
> Cheers,
>
> Vincent
>

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Vincent Siveton <vs...@apache.org>.
Hi Adam,

2009/3/5 Adam Winer <aw...@google.com>:
> I see a lot of whitespace changes with each submission, apparently
> around blank lines.  Any way you could avoid making these changes?
> It's much harder to read diffs like this.

Yeah, my IDE removes trailing whitespaces. I will do 2 commits next time.

Cheers,

Vincent

Re: svn commit: r750442 - /incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java

Posted by Adam Winer <aw...@google.com>.
Vincent,

I see a lot of whitespace changes with each submission, apparently
around blank lines.  Any way you could avoid making these changes?
It's much harder to read diffs like this.

Thanks,
Adam


On Thu, Mar 5, 2009 at 4:36 AM,  <vs...@apache.org> wrote:
> Author: vsiveton
> Date: Thu Mar  5 12:36:27 2009
> New Revision: 750442
>
> URL: http://svn.apache.org/viewvc?rev=750442&view=rev
> Log:
> o improved the TODO with the issue
>
> Modified:
>    incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java
>
> Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java
> URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java?rev=750442&r1=750441&r2=750442&view=diff
> ==============================================================================
> --- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java (original)
> +++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/PipelinedData.java Thu Mar  5 12:36:27 2009
> @@ -136,7 +136,7 @@
>   public PipelinedData substitute(Substitutions substituter) {
>     return new PipelinedData(this, substituter);
>   }
> -
> +
>   public interface Batch {
>     Map<String, Object> getSocialPreloads();
>     Map<String, RequestAuthenticationInfo> getHttpPreloads();
> @@ -147,7 +147,7 @@
>    * Gets the first batch of preload requests.  Preloads that require root
>    * objects not yet available will not be executed in this batch, but may
>    * become available in subsequent batches.
> -   *
> +   *
>    * @param rootObjects an ELResolver that can evaluate currently available
>    *     root objects.
>    * @see GadgetELResolver
> @@ -156,7 +156,7 @@
>   public Batch getBatch(ELResolver rootObjects) {
>     return getBatch(rootObjects, socialPreloads, httpPreloads);
>   }
> -
> +
>   /**
>    * Create a Batch of preload requests
>    * @param rootObjects an ELResolver that can evaluate currently available
> @@ -168,11 +168,11 @@
>       Map<String, HttpData> currentHttpPreloads) {
>     Expressions expressions = Expressions.sharedInstance();
>     ELContext elContext = expressions.newELContext(rootObjects);
> -
> +
>     // Evaluate all existing social preloads
>     Map<String, Object> evaluatedSocialPreloads = Maps.newHashMap();
>     Map<String, SocialData> pendingSocialPreloads = null;
> -
> +
>     if (currentSocialPreloads != null) {
>       for (Map.Entry<String, SocialData> preload : currentSocialPreloads.entrySet()) {
>         try {
> @@ -189,11 +189,11 @@
>           throw new RuntimeException(e);
>         }
>       }
> -    }
> +    }
>     // And evaluate all existing HTTP preloads
>     Map<String, RequestAuthenticationInfo> evaluatedHttpPreloads = Maps.newHashMap();
>     Map<String, HttpData> pendingHttpPreloads = null;
> -
> +
>     if (currentHttpPreloads != null) {
>       for (Map.Entry<String, HttpData> preload : currentHttpPreloads.entrySet()) {
>         try {
> @@ -210,20 +210,20 @@
>         }
>       }
>     }
> -
> +
>     // Nothing evaluated or pending;  return null for the batch.  Note that
> -    // there may be multiple PipelinedData objects (e.g., from multiple
> +    // there may be multiple PipelinedData objects (e.g., from multiple
>     // <script type="text/os-data"> elements), so even if all evaluations
>     // fail here, evaluations might succeed elsewhere and free up pending preloads
>     if (evaluatedSocialPreloads.isEmpty() && evaluatedHttpPreloads.isEmpty() &&
>         pendingHttpPreloads == null && pendingSocialPreloads == null) {
>       return null;
>     }
> -
> +
>     return new BatchImpl(evaluatedSocialPreloads, evaluatedHttpPreloads,
>         pendingSocialPreloads, pendingHttpPreloads);
>   }
> -
> +
>   /** Batch implementation */
>   class BatchImpl implements Batch {
>
> @@ -244,7 +244,7 @@
>     public Map<String, Object> getSocialPreloads() {
>       return evaluatedSocialPreloads;
>     }
> -
> +
>     public Map<String, RequestAuthenticationInfo> getHttpPreloads() {
>       return evaluatedHttpPreloads;
>     }
> @@ -325,10 +325,10 @@
>     copyAttribute("userId", child, expression, JSONArray.class);
>     updateUserArrayState("userId", child);
>     copyAttribute("appId", child, expression, String.class);
> -    // TODO: should be activityIds?
> +    // TODO: SHINDIG-711 should be activityIds?
>     copyAttribute("activityId", child, expression, JSONArray.class);
>     copyAttribute("fields", child, expression, JSONArray.class);
> -
> +
>     // TODO: add activity paging support
>
>     return expression;
> @@ -340,15 +340,15 @@
>     if (method == null) {
>       throw new SpecParserException("Missing @method attribute on os:DataRequest");
>     }
> -
> +
>     // TODO: should we support anything that doesn't end in .get?
> -    // i.e, should this be a whitelist not a blacklist?
> +    // i.e, should this be a whitelist not a blacklist?
>     if (method.endsWith(".update")
>         || method.endsWith(".create")
>         || method.endsWith(".delete")) {
>       throw new SpecParserException("Unsupported @method attribute \"" + method + "\" on os:DataRequest");
>     }
> -
> +
>     SocialData expression = new SocialData(child.getAttribute("key"), method);
>     NamedNodeMap nodeMap = child.getAttributes();
>     for (int i = 0; i < nodeMap.getLength(); i++) {
> @@ -357,13 +357,13 @@
>       if (attrNode.getNamespaceURI() != null) {
>         continue;
>       }
> -
> +
>       String name = attrNode.getLocalName();
>       // Skip the built-in names
>       if ("method".equals(name) || "key".equals(name)) {
>         continue;
>       }
> -
> +
>       String value = attrNode.getNodeValue();
>       expression.addProperty(name, value, Object.class);
>     }
> @@ -379,7 +379,7 @@
>       if (data.signOwner) {
>         needsOwner = true;
>       }
> -
> +
>       if (data.signViewer) {
>         needsViewer = true;
>       }
> @@ -446,7 +446,7 @@
>       this.signViewer = booleanValue(element, "sign_viewer", true);
>
>       Expressions expressions = Expressions.sharedInstance();
> -
> +
>       // TODO: many of these attributes should not be EL enabled
>       Map<String, ValueExpression> attributes = Maps.newHashMap();
>       for (int i = 0; i < element.getAttributes().getLength(); i++) {
>
>
>