Return-Path: X-Original-To: apmail-apex-dev-archive@minotaur.apache.org Delivered-To: apmail-apex-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 45CD317364 for ; Thu, 29 Oct 2015 23:38:19 +0000 (UTC) Received: (qmail 32648 invoked by uid 500); 29 Oct 2015 23:38:19 -0000 Delivered-To: apmail-apex-dev-archive@apex.apache.org Received: (qmail 32579 invoked by uid 500); 29 Oct 2015 23:38:19 -0000 Mailing-List: contact dev-help@apex.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apex.incubator.apache.org Delivered-To: mailing list dev@apex.incubator.apache.org Received: (qmail 32567 invoked by uid 99); 29 Oct 2015 23:38:18 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Oct 2015 23:38:18 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 6216CC52D3 for ; Thu, 29 Oct 2015 23:38:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.001 X-Spam-Level: *** X-Spam-Status: No, score=3.001 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=datatorrent_com.20150623.gappssmtp.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id HoKkb93YHrFe for ; Thu, 29 Oct 2015 23:38:08 +0000 (UTC) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 3F45420633 for ; Thu, 29 Oct 2015 23:38:07 +0000 (UTC) Received: by wmll128 with SMTP id l128so179116wml.0 for ; Thu, 29 Oct 2015 16:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datatorrent_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=wYwuOUR4vHrnaeufzrn39+ykMz52rdUyiIrKpbKbTrM=; b=WpSMUbLwCSN+rd+LRm5gwNxuqfn7/RssuQuax+vOSRzsQeNSsJRgPVOEO25jhwkmN/ a934O8K1uucR9sn0MhIDGdYceC9OciCj/6osIrDiJ+b76uA/Ppsb8hKxJrk+X3ejVHPV Q7gJKMCUP6CVTGsSg151FNpf/ikDHVqThIeEXFmtPlmZK2PTDd3Ac67Eho3VA6LMy/R1 f5L5BIFeS6FITu77yTOoq9Z4vqDAkZrza1669sKzmdPXXrJoIxRA6GzsacmGAsx43lX8 zN+UGLG9Ot334iEfjFcAbUBLro6cD3KVp0qeCZWXcgj34BK8NMXdmWqp9rxl/U1QdNmK BI2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=wYwuOUR4vHrnaeufzrn39+ykMz52rdUyiIrKpbKbTrM=; b=F7tCvwW5iaT2nhG3wb/chEEgPG0qatcQ2ekxCRSIfPOPQVq2fbMhGChBPlhI1iNEib zGQ5PoDUZSYA0AJ2VyHig1vK+NN63b/+STbBlzagcWxPcVMBxBbdsB50pyLd2zyAuupz 1aCfM3xCertVUQNWx80m6yk0czXoqhW0dJ/BL5tsSffPeQCHwUuXUx88dpbYUedAskvU C4Z3U5UcWcANyjOlx2i/zx7oQoBzBT9mwMfEfsEUJDehJJO22F/jZroi/eOrniSe9v/x H7AVNSbWVN1yLDgMQhwwYfEf7BQ83/bBfjIKn1HKoyBu/aHf1JuMlKKY2TjwMn07LKP5 NFHw== X-Gm-Message-State: ALoCoQkcT+2S1F0szB6u2DyiPBrstfGz7OvrZJB4ToL+Y+bWRlQOEfIf6oKHF3i32AtyLz7ROyJ0 MIME-Version: 1.0 X-Received: by 10.28.139.208 with SMTP id n199mr6997087wmd.82.1446161885904; Thu, 29 Oct 2015 16:38:05 -0700 (PDT) Received: by 10.28.220.70 with HTTP; Thu, 29 Oct 2015 16:38:05 -0700 (PDT) In-Reply-To: References: Date: Thu, 29 Oct 2015 16:38:05 -0700 Message-ID: Subject: Re: [CodeStyle] Maximum length of a line From: Chandni Singh To: dev@apex.incubator.apache.org Content-Type: multipart/alternative; boundary=001a11443fe47f5912052346cdf9 --001a11443fe47f5912052346cdf9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi David, Wrapping indentation of '2' comes from the existing code in Apex core. I think in your example you can just add a blank line after while statement and that avoids confusion. while (baz() || foo() || bar()) { foo(); bar(); } Chandni On Thu, Oct 29, 2015 at 4:14 PM, David Yan wrote: > Sorry I might have missed the prior discussion about continuation > indentation. > I think continuation indentation should not be 2 because it would align > with the block indentation and can cause confusion. > For example: > > while (baz() || > foo() || > bar()) { > foo(); > bar(); > } > > vs > > while (baz() || > foo() || > bar()) { > foo(); > bar(); > } > > > > On Thu, Oct 29, 2015 at 4:10 PM, Chandni Singh > wrote: > > > The convention that we adopted for wrapping is > > public void test(int a, > > int b, > > int c) > > Continuation indentation is set to 2 more (4 from the start of line) > extra > > space. > > > > I don't think prematurely wrapping helps readability. In Ram's example > when > > there are comments then yes it helps but I am talking about scenarios > where > > there aren't comments. > > I think just seeing a lot of empty space and scrolling more doesn't > include > > readability. > > > > Chandni > > > > On Thu, Oct 29, 2015 at 3:58 PM, David Yan > wrote: > > > > > I'm +1 on 120 since I'm using a tall screen to code now. :) > > > > > > Did we discuss how the code should be indented for lines that break > > because > > > of the limit? > > > For example, > > > > > > public void test(int a, > > > int b, > > > int c) > > > > > > or > > > > > > public void test(int a, > > > int b, > > > int c) > > > > > > The first one uses a fixed width of 4 extra spaces to indent the > > > continuations, and you won't need to add spaces to the continuation > lines > > > if you rename "test" to be "foo" or "somelongfunctionname". > > > > > > But the second one looks better to the eye. > > > > > > Also, should the operator be at the end of the line or at the beginni= ng > > of > > > the line? > > > > > > For example: > > > > > > if (a || > > > b && > > > c) > > > > > > or > > > > > > if (a > > > || b > > > && c) > > > > > > David > > > > > > On Thu, Oct 29, 2015 at 3:57 PM, Siyuan Hua > > > wrote: > > > > > > > +1 for 160 for 4k monitors > > > > > > > > On Thu, Oct 29, 2015 at 3:55 PM, Timothy Farkas > > > > > wrote: > > > > > > > > > +1 for 120 > > > > > > > > > > On Thu, Oct 29, 2015 at 2:28 PM, Chandni Singh < > > > chandni@datatorrent.com> > > > > > wrote: > > > > > > > > > > > Hi all, > > > > > > > > > > > > As part of the discussion below it was brought out that we need > to > > > > > improve > > > > > > the readability of our code and therefore impose a maximum line > > > limit. > > > > > > > > > > > > If you have a preference for maximum length of a line in the > code, > > > then > > > > > > please voice it now. > > > > > > > > > > > > So far Brennon, Ram, Vlad prefer 120. > > > > > > I am with Thomas on 160. > > > > > > > > > > > > This rule can be enforced by checkstyle. However I have also > > noticed > > > > > > prematurely wrapping lines, for example, > > > > > > > > > > > > public void tes(int t, > > > > > > int x, > > > > > > int z); > > > > > > > > > > > > This shouldn't be allowed as well. However checkstyle cannot > > enforce > > > > > this. > > > > > > So it's the responsibility of developers and reviewers to corre= ct > > > this. > > > > > > > > > > > > Thanks, > > > > > > Chandni > > > > > > > > > > > > On Thu, Oct 29, 2015 at 10:55 AM, Chandni Singh < > > > > chandni@datatorrent.com > > > > > > > > > > > > wrote: > > > > > > > > > > > > > Hi All, > > > > > > > > > > > > > > Do we have a consensus on line length? > > > > > > > > > > > > > > Thanks, > > > > > > > Chandni > > > > > > > > > > > > > > On Tue, Oct 20, 2015 at 4:38 PM, Vlad Rozov < > > > v.rozov@datatorrent.com > > > > > > > > > > > > wrote: > > > > > > > > > > > > > >> It depends, some screen are tall, not wide :-) . I tried 160 > on > > my > > > > > tall > > > > > > >> screen and it looks OK, but I use smaller font size. My > > > > recommendation > > > > > > is > > > > > > >> to keep it to 120. > > > > > > >> > > > > > > >> Thank you, > > > > > > >> > > > > > > >> Vlad > > > > > > >> > > > > > > >> > > > > > > >> On 10/20/15 15:38, Thomas Weise wrote: > > > > > > >> > > > > > > >>> How about being a bit more generous with line length: 160? > > > Screens > > > > > are > > > > > > >>> pretty wide nowadays.. > > > > > > >>> > > > > > > >>> +1 for documentation as part of PR review. Documentation > should > > > not > > > > > > only > > > > > > >>> be > > > > > > >>> present but also helpful. Maybe we can enforce presence for > > newly > > > > > added > > > > > > >>> classes by tracking count of existing violations? > > > > > > >>> > > > > > > >>> On Tue, Oct 20, 2015 at 2:38 PM, Munagala Ramanath < > > > > > > ram@datatorrent.com> > > > > > > >>> wrote: > > > > > > >>> > > > > > > >>> Yes, 120 line length max is good. > > > > > > >>>> > > > > > > >>>> Yes, agree we need to find some way to enforce javadocs. > > > > > > >>>> > > > > > > >>>> Ram > > > > > > >>>> > > > > > > >>>> On Tue, Oct 20, 2015 at 11:45 AM, York, Brennon < > > > > > > >>>> Brennon.York@capitalone.com > > > > > > >>>> > > > > > > >>>>> wrote: > > > > > > >>>>> For 1 and 2 I=C2=B9ve made a JIRA to track > > > > > > >>>>> (https://malhar.atlassian.net/browse/APEX-204). > > > > > > >>>>> > > > > > > >>>>> For 3) I definitely agree we need line wraps. Understand > that > > > > > > everyone > > > > > > >>>>> > > > > > > >>>> has > > > > > > >>>> > > > > > > >>>>> different length monitors, but, as a community, we should > > agree > > > > on > > > > > a > > > > > > >>>>> standard moving forward as this becomes a community-owned > > > > project. > > > > > > How > > > > > > >>>>> does 120 sound? > > > > > > >>>>> > > > > > > >>>>> For 4) if we want to start treating Apex as an Apache > project > > > > owned > > > > > > by > > > > > > >>>>> > > > > > > >>>> the > > > > > > >>>> > > > > > > >>>>> community that uses it we need to start working *for* the > > > > > community / > > > > > > >>>>> developers who are going to contribute to it, not merely > > > continue > > > > > on > > > > > > as > > > > > > >>>>> > > > > > > >>>> if > > > > > > >>>> > > > > > > >>>>> the people currently working on it will be the only prima= ry > > > > > drivers. > > > > > > >>>>> That > > > > > > >>>>> won=C2=B9t engender growth or community engagement. If no= thing > > else > > > we > > > > > > >>>>> should > > > > > > >>>>> be prepared to open our doors to new ideas and > functionality > > to > > > > the > > > > > > >>>>> project, not make it more difficult through obfuscated > code. > > It > > > > > > hasn=C2=B9t > > > > > > >>>>> been done to this point and that=C2=B9s fine, but moving > forward I > > > > think > > > > > > we > > > > > > >>>>> should take a concerted look and take this as an > opportunity > > to > > > > > clean > > > > > > >>>>> it > > > > > > >>>>> up / document it. It will only get harder as the project > > gains > > > > > > >>>>> momentum. > > > > > > >>>>> And, if this causes failures, that=C2=B9s a problem for u= s to > > admit, > > > > > > accept, > > > > > > >>>>> and fix. > > > > > > >>>>> > > > > > > >>>>> On 10/20/15, 10:19 AM, "Chandni Singh" < > > > chandni@datatorrent.com> > > > > > > >>>>> wrote: > > > > > > >>>>> > > > > > > >>>>> 1) This is a bug and will fix this > > > > > > >>>>>> > > > > > > >>>>>> 2) Another bug and will fix this > > > > > > >>>>>> > > > > > > >>>>>> 3) We don't have a line limit because everyone uses > > different > > > > > length > > > > > > >>>>>> monitor and some prefer a much longer line. However I > think > > we > > > > > need > > > > > > to > > > > > > >>>>>> > > > > > > >>>>> at > > > > > > >>>> > > > > > > >>>>> least have a minimum length limit and only beyond this a > line > > > > > should > > > > > > be > > > > > > >>>>>> wrapped. > > > > > > >>>>>> > > > > > > >>>>>> 4) Earlier javadocs were strictly added to api and commo= n > > > > classes. > > > > > > >>>>>> There > > > > > > >>>>>> are hardly any for engine, bufferserver modules. Adding > this > > > > will > > > > > > mean > > > > > > >>>>>> much higher number of pre-existing failures. I am not mu= ch > > in > > > > > favor > > > > > > of > > > > > > >>>>>> this. > > > > > > >>>>>> > > > > > > >>>>>> As far as the lineage is concerned, these were mostly > taken > > > from > > > > > > >>>>>> google-checks and modified for the style we adopted. Als= o > > > > referred > > > > > > to > > > > > > >>>>>> sun_checks and picked a few from there which we needed. > > > > > > >>>>>> > > > > > > >>>>>> > > > > > > >>>>>> On Tue, Oct 20, 2015 at 8:42 AM, Ganelin, Ilya > > > > > > >>>>>> > > > > > > >>>>>> wrote: > > > > > > >>>>>> > > > > > > >>>>>> All - there are some issues I=C2=B9ve already run into w= ith the > > > > > > >>>>>>> CodeStyle/CheckStyle settings. I suggest we start a JIR= A > to > > > > track > > > > > > >>>>>>> > > > > > > >>>>>> these > > > > > > >>>> > > > > > > >>>>> unless you have a preferred approach. > > > > > > >>>>>>> > > > > > > >>>>>>> 1) CheckStyle dictates that chained method calls be on > > > > different > > > > > > >>>>>>> lines > > > > > > >>>>>>> but > > > > > > >>>>>>> also dictates that a space may not precede a period. Th= e > > > below > > > > is > > > > > > >>>>>>> thus > > > > > > >>>>>>> invalid: > > > > > > >>>>>>> Foo.bar > > > > > > >>>>>>> .cat > > > > > > >>>>>>> 2) Continuation Indent is set to 4 in CheckStyle but se= t > > to 2 > > > > by > > > > > > >>>>>>> > > > > > > >>>>>> default > > > > > > >>>> > > > > > > >>>>> in CodeStyle > > > > > > >>>>>>> 3) We should really enforce line limits (for the sake o= f > > > > > > readability) > > > > > > >>>>>>> and > > > > > > >>>>>>> should therefore amend the wrapping behavior of methods= . > > > > However, > > > > > > >>>>>>> this > > > > > > >>>>>>> will > > > > > > >>>>>>> require updating CheckStyle as well. > > > > > > >>>>>>> 4) We should enforce JavaDocs > > > > > > >>>>>>> > > > > > > >>>>>>> As an aside, could someone possibly speak to the lineag= e > of > > > the > > > > > > >>>>>>> CheckStyle > > > > > > >>>>>>> and CodeStyle settings that we=C2=B9re presently using = inside > > > Apex? > > > > > Did > > > > > > >>>>>>> > > > > > > >>>>>> these > > > > > > >>>> > > > > > > >>>>> come from published settings (e.g. Google) or are these a= ll > > > > > in-house? > > > > > > >>>>>>> > > > > > > >>>>>>> Appreciate any input, thanks! > > > > > > >>>>>>> _______________________________________________________= _ > > > > > > >>>>>>> > > > > > > >>>>>>> The information contained in this e-mail is confidentia= l > > > and/or > > > > > > >>>>>>> proprietary to Capital One and/or its affiliates and ma= y > > only > > > > be > > > > > > used > > > > > > >>>>>>> solely in performance of work or services for Capital > One. > > > The > > > > > > >>>>>>> information > > > > > > >>>>>>> transmitted herewith is intended only for use by the > > > individual > > > > > or > > > > > > >>>>>>> entity > > > > > > >>>>>>> to which it is addressed. If the reader of this message > is > > > not > > > > > the > > > > > > >>>>>>> intended > > > > > > >>>>>>> recipient, you are hereby notified that any review, > > > > > retransmission, > > > > > > >>>>>>> dissemination, distribution, copying or other use of, o= r > > > taking > > > > > of > > > > > > >>>>>>> any > > > > > > >>>>>>> action in reliance upon this information is strictly > > > > prohibited. > > > > > If > > > > > > >>>>>>> > > > > > > >>>>>> you > > > > > > >>>> > > > > > > >>>>> have received this communication in error, please contact > the > > > > > sender > > > > > > >>>>>>> > > > > > > >>>>>> and > > > > > > >>>> > > > > > > >>>>> delete the material from your computer. > > > > > > >>>>>>> > > > > > > >>>>>>> _______________________________________________________= _ > > > > > > >>>>>>> > > > > > > >>>>>>> The information contained in this e-mail is confidentia= l > > > and/or > > > > > > >>>>>>> proprietary to Capital One and/or its affiliates and ma= y > > only > > > > be > > > > > > used > > > > > > >>>>>>> solely in performance of work or services for Capital > One. > > > The > > > > > > >>>>>>> information > > > > > > >>>>>>> transmitted herewith is intended only for use by the > > > individual > > > > > or > > > > > > >>>>>>> entity > > > > > > >>>>>>> to which it is addressed. If the reader of this message > is > > > not > > > > > the > > > > > > >>>>>>> intended > > > > > > >>>>>>> recipient, you are hereby notified that any review, > > > > > retransmission, > > > > > > >>>>>>> dissemination, distribution, copying or other use of, o= r > > > taking > > > > > of > > > > > > >>>>>>> any > > > > > > >>>>>>> action in reliance upon this information is strictly > > > > prohibited. > > > > > If > > > > > > >>>>>>> > > > > > > >>>>>> you > > > > > > >>>> > > > > > > >>>>> have received this communication in error, please contact > the > > > > > sender > > > > > > >>>>>>> > > > > > > >>>>>> and > > > > > > >>>> > > > > > > >>>>> delete the material from your computer. > > > > > > >>>>>>> > > > > > > >>>>>>> > > > > > > >>>>>>> _______________________________________________________= _ > > > > > > >>>>> > > > > > > >>>>> The information contained in this e-mail is confidential > > and/or > > > > > > >>>>> proprietary to Capital One and/or its affiliates and may > only > > > be > > > > > used > > > > > > >>>>> solely in performance of work or services for Capital One= . > > The > > > > > > >>>>> > > > > > > >>>> information > > > > > > >>>> > > > > > > >>>>> transmitted herewith is intended only for use by the > > individual > > > > or > > > > > > >>>>> entity > > > > > > >>>>> to which it is addressed. If the reader of this message i= s > > not > > > > the > > > > > > >>>>> > > > > > > >>>> intended > > > > > > >>>> > > > > > > >>>>> recipient, you are hereby notified that any review, > > > > retransmission, > > > > > > >>>>> dissemination, distribution, copying or other use of, or > > taking > > > > of > > > > > > any > > > > > > >>>>> action in reliance upon this information is strictly > > > prohibited. > > > > If > > > > > > you > > > > > > >>>>> have received this communication in error, please contact > the > > > > > sender > > > > > > >>>>> and > > > > > > >>>>> delete the material from your computer. > > > > > > >>>>> > > > > > > >>>>> ________________________________________________________ > > > > > > >>>>> > > > > > > >>>>> The information contained in this e-mail is confidential > > and/or > > > > > > >>>>> proprietary to Capital One and/or its affiliates and may > only > > > be > > > > > used > > > > > > >>>>> solely in performance of work or services for Capital One= . > > The > > > > > > >>>>> > > > > > > >>>> information > > > > > > >>>> > > > > > > >>>>> transmitted herewith is intended only for use by the > > individual > > > > or > > > > > > >>>>> entity > > > > > > >>>>> to which it is addressed. If the reader of this message i= s > > not > > > > the > > > > > > >>>>> > > > > > > >>>> intended > > > > > > >>>> > > > > > > >>>>> recipient, you are hereby notified that any review, > > > > retransmission, > > > > > > >>>>> dissemination, distribution, copying or other use of, or > > taking > > > > of > > > > > > any > > > > > > >>>>> action in reliance upon this information is strictly > > > prohibited. > > > > If > > > > > > you > > > > > > >>>>> have received this communication in error, please contact > the > > > > > sender > > > > > > >>>>> and > > > > > > >>>>> delete the material from your computer. > > > > > > >>>>> > > > > > > >>>>> > > > > > > >>>>> > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > --001a11443fe47f5912052346cdf9--