Giter Site home page Giter Site logo

Comments (6)

InsertCreativityHere avatar InsertCreativityHere commented on June 10, 2024 1

I agree that we shouldn't spend time tweaking and modifying the defaults.
My thinking was just switching which format-style we were using, but keeping it's defaults intact.

It looks like spotless supports a couple styles if you scroll to the "java" section of this:

  • java.GoogleJavaFormatStep
  • java.PalantirJavaFormatStep
  • java.EclipseJdtFormatterStep

The PalantirJavaFormat style seems like it was specifically made to "fix" the google style, after reading it's README. Maybe they're biased here though.


Also, it looks like spotless has support for other lints apart from just formatting:

  • java.RemoveUnusedImportsStep
  • java.ImportOrderStep
  • java.FormatAnnotationsStep

Should we try enabling any of these? If they work well, they seem like good checks to be performing.

from ice.

InsertCreativityHere avatar InsertCreativityHere commented on June 10, 2024

Also, to disavow myself of my biases here:
IMO, 4 space indentation is objectively easier to read than 2 spaces
spoken as someone who is currently editing large chunks of the Java tests.

from ice.

pepone avatar pepone commented on June 10, 2024

I'm fine with 4 or 2, I don't think it makes much of a difference. But I would prefer to keep the Google style default, which is the point of using a style, if we were to start tweaking things here and there we could keep the original style.

from ice.

externl avatar externl commented on June 10, 2024

It would be nice to be able to use the very common Language Support for Java(TM) by Red Hat Java extension for formatting in VS Code. It seems to use the eclipse formatter.

https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings

EDIT: This extension also supports the Google format. I'm going to open a PR to configure it for VS Code.
EDIT 2: Unfortunately these are not compatible. This recommendation from RedHat is quite bad as the XML they reference is abandoned.

from ice.

InsertCreativityHere avatar InsertCreativityHere commented on June 10, 2024

Unfortunately these are not compatible

Like the 2 tools don't format the code in the same way?
If so, that's indeed pretty lame.

Tomorrow I plan to at least look at enabling the other linting 'spotless' supports, and maybe checking out the other styles it supports. Assuming no one is working on anything big in Java right now (except me).

from ice.

bernardnormier avatar bernardnormier commented on June 10, 2024

Spotless itself uses tabs for indentation with indent-size = 4.
https://github.com/diffplug/spotless/blob/04d5f28c0401803323b3e8d82677fc081ab2b818/.editorconfig#L5

(I don't think we should use tabs)

from ice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.