But then we should also provide a code style profile for Eclipse and have to keep them in sync.
On Tue, Jun 9, 2015 at 12:33 PM Aljoscha Krettek <aljos...@apache.org> wrote: > <code_scheme name="Flink"> > <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="100" /> > <option name="RIGHT_MARGIN" value="100" /> > <XML> > <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" /> > </XML> > <codeStyleSettings language="JAVA"> > <option name="ALIGN_MULTILINE_PARAMETERS" value="false" /> > <option name="CALL_PARAMETERS_WRAP" value="5" /> > <option name="METHOD_PARAMETERS_WRAP" value="5" /> > <indentOptions> > <option name="USE_TAB_CHARACTER" value="true" /> > <option name="SMART_TABS" value="true" /> > </indentOptions> > </codeStyleSettings> > </code_scheme> > > This is the contents of Flink.xml in ~/Library/Preferences/IdeaIC14/ > codestyles which is the folder for codestyles on OS X. It is pretty much > the standard IntelliJ code style except that I changed it not to align in > parameter lists. So it seems possible to get rid of the alignment. Maybe we > can tweak such an IntelliJ code style and put it on the website somewhere. > > On Tue, Jun 9, 2015 at 12:10 PM, Pieter-Jan Van Aeken < > pieterjan.vanae...@euranova.eu> wrote: > > > Hi Aljoscha, > > > > Yes, I get the style errors in my IDE (although I set the level to > > warning rather than error). I try to pay close attention to writing my > > code without checkstyle errors but I simply cannot resist pressing > > auto format shortkey every now and then. That way all my effort into > > writing properly styled code goes undone. > > > > I am modifying my auto format settings to prevent this and it works > > for Scala but I have not been able to do this for Java. Whenever a > > line gets wrapped in Java, IntelliJ auto aligns the next line, and > > uses spaces to do so when the required indent is not dividable by 4. > > > > Regards, > > > > Pieter-Jan Van Aeken > > > > Op Dinsdag, 09/06/2015 om 12:04 schreef Aljoscha Krettek: > > > > By the way, do you have the Flink checkstyle and scalastyle profiles > > set in IntelliJ? This way you at least get red errors directly in the > > IDE. For checkstyle there is Checkstyle-IDEA and for scalastyle you > > can put the scalastyle config of Flink into the .idea directory to > > have it recognised: > > > > cp tools/maven/scalastyle-config.xml .idea/scalastyle_config.xml > > > > On Tue, Jun 9, 2015 at 11:55 AM, Maximilian Michels wrote: > > > Hi Pieter-Jan, > > > > > > It would be great to have a plugin for IntelliJ/Eclipse to make new > > code > > > stylecheck-compliant. However, as Till mentioned, the problem is > > that most > > > such plugins touch more lines than necessary. We try to only commit > > changes > > > to the Git repository which are related to the feature/pull request. > > That > > > way, commits are more readable and code fragments can be more easily > > > attributed to the person that originally created it (instead of the > > one > > > reformatting it). > > > > > > Let us know if you find a useful plugin or method to deal with the > > > mentioned problems. > > > > > > Best regards, > > > Max > > > > > > On Tue, Jun 9, 2015 at 11:30 AM, Pieter-Jan Van Aeken < > > > pieterjan.vanae...@euranova.eu> wrote: > > > > > >> Hi Till, > > >> > > >> If I recall correctly, there is a possibility to import checkstyle > > >> XML's into Eclipse so that the auto format feature would result in > > >> style compliant code. This imported Eclipse config could then be > > >> exported and reimported into IntelliJ but you can imagine that is > > not > > >> a reason for me to install Eclipse. > > >> > > >> That being said, I understand your concerns with auto-format but it > > >> also has its benefits. I've used auto format succesfully to ensure > > >> maximum line length, removal of star imports, ... The only thing I > > had > > >> an issue with was leading spaces when wrapping lines. I just > > removed > > >> manually about 100 leading spaces but if I auto format again (it's > > a > > >> hard habbit to get rid off) I will have to do the same thing all > > over > > >> again. After a while it just becomes silly and a real waste of > > >> development time. > > >> > > >> If we were to provide a common Eclipse and IntelliJ style config, > > we > > >> could resolve all the style issues with just one shortcut. Git > > should > > >> take care of the rest really. If you auto format a file that has > > >> already been formatted, it will show up changed in IntelliJ but Git > > >> will recognize that it is in fact unmodified. That way, we would no > > >> longer "touch" files we've not actually modified. > > >> > > >> Regards, > > >> > > >> Pieter-Jan Van Aeken > > >> > > >> Op Dinsdag, 09/06/2015 om 11:10 schreef Till Rohrmann: > > >> > > >> Hi Pieter-Jan, > > >> > > >> I'm not aware of an Eclipse or IntellJ auto format profile. I think > > >> that > > >> all Flink contributors apply their style changes manually. The > > maven > > >> output > > >> should tell you quite precisely what's wrong and in which file the > > >> checkstyle errors occur. Moreover, applying an IDE auto format is > > in > > >> general discouraged because due to the absence of a common style > > >> profile, > > >> this would change also code which you haven't actually touched. As > > a > > >> consequence it's no longer possible to see who worked on what part > > of > > >> the > > >> code. > > >> > > >> Cheers, > > >> Till > > >> > > >> On Tue, Jun 9, 2015 at 10:50 AM Pieter-Jan Van Aeken < > > >> pieterjan.vanae...@euranova.eu> wrote: > > >> > > >> > Hi Flink Community, > > >> > > > >> > I would like to contribute to the code base of Flink but I find > > >> myself > > >> > unable to built my changed project due to errors in my "code > > style". > > >> > > > >> > My IDE of choice is IntelliJ and unfortunately, I can not import > > >> > "tools/maven/checkstyle.xml" nor > > >> "tools/maven/scalastyle-config.xml". > > >> > From what I understand, this is only possible in Eclipse? Can > > anyone > > >> > perhaps provide me with the Eclipse Profile XML files so that I > > can > > >> > use the auto-format function in IntelliJ to make my code comply > > with > > >> > the style standards? My additions are written in Scala and Java. > > >> > > > >> > Regards, > > >> > > > >> > Pieter-Jan Van Aeken > > >> > > > >> > > > >> > > > >> > > >> > > >> > > > > > > >