I just realized this is the minimum *.java eol=lf
However this would be could to have in all repos: * text=auto *.java eol=lf onsdag den 25. juli 2018 kl. 14.26.22 UTC+2 skrev Joseph P: > > The action needed to avoid line endings being messed with is > * text=auto > > However this would be enough for the formatter > *.java text eol=lf > > But I would recommend the text=auto > > And if the maintainer needs something more fancy they can customise it > further but lucky shouldn't have anything like Visual Studio > *.sln text eol=crlf > > If a maintainer mess it up the answer would be to add the .gitattributes > and run > git add --renormalize . > > Like I did in the first PR. > > onsdag den 25. juli 2018 kl. 14.06.31 UTC+2 skrev Mark Waite: >> >> >> >> On Wed, Jul 25, 2018 at 4:44 AM Joseph P <[email protected]> wrote: >> >>> Just to touch on the line endings issue... See >>> https://github.com/jenkinsci/vstestrunner-plugin/pull/16 when it >>> becomes an issue. I just wanted to fix a minor thing but because of the >>> maintainer did a commit where they messed with line endings it screwed up >>> the history for https://github.com/jenkinsci/vstestrunner-plugin/pull/17 >>> >>> >> I see the changes in line endings between those two commits but am not >> clear on the actions which are needed by a maintainer to avoid the problem. >> >> Is it enough to have the .gitattributes file that sets the line endings >> of files that will be automatically formatted? >> >> If that's not enough, could you explain further what is needed? >> >> Mark Waite >> >> >>> tirsdag den 24. juli 2018 kl. 14.30.01 UTC+2 skrev Mark Waite: >>>> >>>> On Tue, Jul 24, 2018 at 1:48 AM Joseph P <[email protected]> wrote: >>>> >>>>> The problem I have noticed with FMT Maven plugin. The formatter does >>>>> not handle CR LF line endings rather it converts everything to LF which >>>>> will mess with commits because it causes high rewrites. So you would need >>>>> to ensure that git attributes is in all repos as well to avoid incorrect >>>>> commit history. >>>>> >>>>> Tomas Bjerre is using it on his repos: >>>>> https://github.com/jenkinsci/violation-comments-to-stash-plugin >>>>> See this commit message: >>>>> https://github.com/jenkinsci/violation-comments-to-stash-plugin/pull/50/commits/1f2fd46632aaf65493f41bf74e660710221fd70f >>>>> >>>>> >>>> I like the idea of including a .gitattributes file as part of the >>>> transition to optional automatic formatting in a repository. I'll include >>>> that in the proposal. Additional files were needed with the transition to >>>> support incrementals and that transition seems to be progressing very well. >>>> >>>> I prefer (and accept) the intentional setting of line endings. I >>>> consider that part of the standardization of the formatting. I think that >>>> maintainers that don't want line endings standardized or that cannot >>>> accept >>>> LF as the standard would choose to not enable automatic formatting in the >>>> plugins they maintain. >>>> >>>> Thanks, >>>> Mark Waite >>>> >>>> >>> >>>>> tirsdag den 24. juli 2018 kl. 03.36.42 UTC+2 skrev Mark Waite: >>>>>> >>>>>> I'd like to submit a Jenkins Enhancement Proposal for optional >>>>>> automated source code formatting available from the plugin pom so that >>>>>> plugins which build with maven could choose to "opt-in" to automated >>>>>> source >>>>>> code formatting. >>>>>> >>>>>> Key attributes of the idea: >>>>>> >>>>>> - *Optional* - plugins only get source code formatting if they >>>>>> enable it >>>>>> - *Automatic* - when source code formatting is enabled, it >>>>>> happens automatically as part of the maven compile phase >>>>>> - *Common* - when source code formatting is enabled, the source >>>>>> code formatting settings are not intended to be altered by the plugin >>>>>> >>>>>> I've implemented a sample in the platformlabeler plugin >>>>>> <https://github.com/jenkinsci/platformlabeler-plugin/blob/fcae9d81f557c4fdcb1b991487e28113f718a81d/pom.xml#L76> >>>>>> >>>>>> using the "FMT Maven plugin >>>>>> <https://mvnrepository.com/artifact/com.coveo/fmt-maven-plugin>" >>>>>> which uses google-java-format >>>>>> <https://github.com/google/google-java-format> to format Java source >>>>>> code to Google Java Style >>>>>> <https://google.github.io/styleguide/javaguide.html>. >>>>>> >>>>>> Key questions that need discussion (especially considering my feeble >>>>>> skills with maven): >>>>>> >>>>>> - Is optional automated source formatting of interest to a few >>>>>> plugin developers that would be willing to test drive it? If so, who >>>>>> are >>>>>> the plugin developers that are willing to test drive it, and which >>>>>> plugins >>>>>> will be involved in the test drive? I'll use platformlabeler as one >>>>>> of the >>>>>> test drive plugins. Others will be needed >>>>>> - How would a prototype of optional automated source formatting >>>>>> be evaluated? By releasing a beta version of the plugin parent >>>>>> pom >>>>>> >>>>>> <https://github.com/jenkinsci/plugin-pom/blob/8224b204a5646d4292da7b3e38876ca6fbde9c33/pom.xml#L580>? >>>>>> >>>>>> Some other means? >>>>>> - Would automated formatting be integrated into the plugin parent >>>>>> pom using techniques similar to the findbugs integration >>>>>> >>>>>> <https://github.com/jenkinsci/plugin-pom/blob/8224b204a5646d4292da7b3e38876ca6fbde9c33/pom.xml#L580> >>>>>> >>>>>> into the plugin parent pom, or is there a better way? >>>>>> - Is "google java format" an acceptable code format for those >>>>>> plugin authors that are willing to adopt automated code formatting? >>>>>> - Are there other issues that need to be addressed before a >>>>>> Jenkins Enhancement Proposal is submitted for optional automated >>>>>> source >>>>>> code formatting? >>>>>> >>>>>> A plugin maintainer that chooses to adopt automated source code >>>>>> formatting needs to understand that automated source code formatting >>>>>> creates a "diff wall" due to the many changes made by the formatting >>>>>> process. That is one of the penalties associated with automated source >>>>>> code formatting. >>>>>> >>>>>> Plugins with many open pull requests (git plugin, git client plugin) >>>>>> should not enable automated formatting until they've reduced the number >>>>>> of >>>>>> open pull requests to very few. Otherwise, most open pull requests for >>>>>> the >>>>>> plugin will have many conflicts as soon as the automated formatting is >>>>>> committed. That is another of the penalties of automated source code >>>>>> formatting. >>>>>> >>>>>> Plugins that adopt automated source code formatting will likely find >>>>>> it easier to read the source code and easier to submit clean pull >>>>>> requests. Automated formatting avoids the poor experience of pull >>>>>> request >>>>>> submitters being asked to fix the white space diffs introduced by their >>>>>> pull request. >>>>>> >>>>>> Thanks, >>>>>> Mark Waite >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Jenkins Developers" group. >>>>> >>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>> >>>> >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/jenkinsci-dev/c3ef8d20-8332-47f6-9803-68178421aac0%40googlegroups.com >>>>> >>>>> <https://groups.google.com/d/msgid/jenkinsci-dev/c3ef8d20-8332-47f6-9803-68178421aac0%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Jenkins Developers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/jenkinsci-dev/a78c887f-e3ed-4d8a-a750-9ea71865c9a5%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/jenkinsci-dev/a78c887f-e3ed-4d8a-a750-9ea71865c9a5%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/00162a1b-9aa8-4f26-9612-53646b0b14bb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
