Here we go, for the GeoTools code, limiting the start line to column 65 (leaves 35 chars to write a bit of code before wrapping happens): https://github.com/geotools/geotools/pull/3724
Did not try to go down to 60 but... it's likely quite a bit of extra effort, I started with 80 and went down, each step required more code changes to enforce the rule. Cheers Andrea On Thu, Dec 30, 2021 at 5:15 AM Jody Garnett <jody.garn...@gmail.com> wrote: > Thanks Andrea, I have also found some of the closures getting deeply > nested. > > Jody > > On Wed, Dec 29, 2021 at 6:06 AM Andrea Aime <andrea.a...@gmail.com> wrote: > >> Hi all, >> I'd like to introduce a Checkstyle check that verifies lines are not too >> deeply nested. >> The Google format we are using is indenting excessively long lines that >> are overflowing on the next line 8 chars instead of 4, >> I believe as a way to discourage too deep nesting. >> >> However, we have a lot of old code that has been reformatted blindly, and >> we have situations in the code like these: >> >> >> https://github.com/geotools/geotools/blob/f66689b5305eaf381e21dc2feec8011138d4cb24/modules/library/referencing/src/main/java/org/geotools/referencing/operation/transform/GeocentricTransform.java#L446 >> >> https://github.com/geotools/geotools/blob/f66689b5305eaf381e21dc2feec8011138d4cb24/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/TransverseMercator.java#L174 >> >> The first one can be easily fixed using Objects.hashCode(....) while the >> second is in need of a bit of expression splitting. >> There are other egregious cases around, mostly due to excessive usage of >> nested classes (e.g., Wicket GUI code). >> >> I've found a simple checkstyle configuration can spot all of them: >> >> <module name="RegexpSingleline"> >> <property name="format" value="^\s{70}"/> >> <property name="message" value="Excessive nesting found. Please try to >> factor out the deeply nested code using support variables, or in a separate >> methods, or classes"/> >> <property name="minimum" value="0"/> >> <property name="maximum" value="1"/> >> </module> >> >> This should make the code overall more readable, and stop new too deeply >> nested bits to show up in the codebase. >> Opinions? >> >> Cheers >> Andrea >> >> >> >> >> _______________________________________________ >> GeoTools-Devel mailing list >> geotools-de...@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/geotools-devel >> > -- > -- > Jody Garnett > _______________________________________________ > Geoserver-devel mailing list > Geoserver-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geoserver-devel > -- Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://bit.ly/gs-services-us for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions Group phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 333 8128928 https://www.geosolutionsgroup.com/ http://twitter.com/geosolutions_it ------------------------------------------------------- Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail
_______________________________________________ Geoserver-devel mailing list Geoserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-devel