eclipse auto formatting when saving a file

classic Classic list List threaded Threaded
13 messages Options
Darius Jazayeri-2 Darius Jazayeri-2
Reply | Threaded
Open this post in threaded view
|

eclipse auto formatting when saving a file

Hi Ben, Win, etc,

What's up with the fact that eclipse now auto-formats my java files when I save them. I wouldn't mind the feature except for the fact that it replaces several common things I do with uglier alternatives, and it does not format identically to what I get from control-shift-f.

In particular, I like to format my annotated controller methods like this:
public void showHierarchy(ModelMap model,
                          @RequestParam(required = false, value = "locationId") Location location,
                          other args, 
                          aligned here...) {

This new 'feature' won't let me do that, but instead removes my line breaks based on column widths.

Also it was seeming to break the indentation of the throws declaration of a function by moving it all the way to the left on the next line, but that magically stopped happening while I was typing this email.

Anyway, did I miss an email that we're auto-formatting our code now?

-Darius

[hidden email] from OpenMRS Developers' mailing list
Sy Haas Sy Haas
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

Yes, I get this too and it is quite annoying. I modified mine to not "correct indentation" and CTRL+SHIFT+F worked and saving didnt rearrange it.
-Sy


On Fri, May 14, 2010 at 15:59, Darius Jazayeri <[hidden email]> wrote:
Hi Ben, Win, etc,

What's up with the fact that eclipse now auto-formats my java files when I save them. I wouldn't mind the feature except for the fact that it replaces several common things I do with uglier alternatives, and it does not format identically to what I get from control-shift-f.

In particular, I like to format my annotated controller methods like this:
public void showHierarchy(ModelMap model,
                          @RequestParam(required = false, value = "locationId") Location location,
                          other args, 
                          aligned here...) {

This new 'feature' won't let me do that, but instead removes my line breaks based on column widths.

Also it was seeming to break the indentation of the throws declaration of a function by moving it all the way to the left on the next line, but that magically stopped happening while I was typing this email.

Anyway, did I miss an email that we're auto-formatting our code now?

-Darius

[hidden email] from OpenMRS Developers' mailing list


[hidden email] from OpenMRS Developers' mailing list
Ben Wolfe Ben Wolfe
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

In reply to this post by Darius Jazayeri-2
Yeah, I meant to send out a email abt this.  I first committed it a few days ago and turned off the autoindent as sy says with a commit yesterday because it wasn't doing the control-shiftsf indentation for some reason.

Ben
-----Original Message-----
From: Sy Haas <[hidden email]>
Date: Friday, May 14, 2010 4:03 pm
Subject: Re: eclipse auto formatting when saving a file
To: "[hidden email]" <[hidden email]>Reply-To: "[hidden email]" <[hidden email]>


>Yes, I get this too and it is quite annoying. I modified mine to not 'correct indentation' and CTRL+SHIFT+F worked and saving didnt rearrange it.
>-Sy
>
>On Fri, May 14, 2010 at 15:59, Darius Jazayeri <[hidden email]> wrote:
>Hi Ben, Win, etc,
>
>
>What's up with the fact that eclipse now auto-formats my java files when I save them. I wouldn't mind the feature except for the fact that it replaces several common things I do with uglier alternatives, and it does not format identically to what I get from control-shift-f.
>
>
>In particular, I like to format my annotated controller methods like this:
> public void showHierarchy(ModelMap model,                           @RequestParam(required = false, value = 'locationId') Location location,                           other args,                            aligned here...) {
>
>
>This new 'feature' won't let me do that, but instead removes my line breaks based on column widths.
>
>
>
>Also it was seeming to break the indentation of the throws declaration of a function by moving it all the way to the left on the next line, but that magically stopped happening while I was typing this email.
>
>
>Anyway, did I miss an email that we're auto-formatting our code now?
>
>
>-Darius  Click here to unsubscribe from OpenMRS Developers' mailing list
> Click here to unsubscribe from OpenMRS Developers' mailing list

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Umashanthi Pavalanathan Umashanthi Pavalanathan
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

In reply to this post by Sy Haas
I think it's better if someone provide with a codestyle configuration
for OpenMRS (probably a xml for Eclipse) so that every one can use the
same style...


~Umashanthi

On Sat, May 15, 2010 at 1:32 AM, Sy Haas <[hidden email]> wrote:

> Yes, I get this too and it is quite annoying. I modified mine to not
> "correct indentation" and CTRL+SHIFT+F worked and saving didnt rearrange it.
> -Sy
>
> On Fri, May 14, 2010 at 15:59, Darius Jazayeri <[hidden email]> wrote:
>>
>> Hi Ben, Win, etc,
>> What's up with the fact that eclipse now auto-formats my java files when I
>> save them. I wouldn't mind the feature except for the fact that it replaces
>> several common things I do with uglier alternatives, and it does not format
>> identically to what I get from control-shift-f.
>> In particular, I like to format my annotated controller methods like this:
>>>
>>> public void showHierarchy(ModelMap model,
>>>
>>>                           @RequestParam(required = false, value =
>>> "locationId") Location location,
>>>
>>>                           other args,
>>>
>>>                           aligned here...) {
>>
>> This new 'feature' won't let me do that, but instead removes my line
>> breaks based on column widths.
>> Also it was seeming to break the indentation of the throws declaration of
>> a function by moving it all the way to the left on the next line, but that
>> magically stopped happening while I was typing this email.
>> Anyway, did I miss an email that we're auto-formatting our code now?
>> -Darius
>> ________________________________
>> Click here to unsubscribe from OpenMRS Developers' mailing list
>
> ________________________________
> Click here to unsubscribe from OpenMRS Developers' mailing list

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Nyoman Ribeka Nyoman Ribeka
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

Hi all,

It works fine on my computer. The idea was to prevent us from code
reviewing code indentation in the code review.

About the exception, not sure why the formatter will format them like that.

Umashanti, we do have the code template and code formatter (but sadly
nobody seems to be able to find it in our wiki).

On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:

> I think it's better if someone provide with a codestyle configuration
> for OpenMRS (probably a xml for Eclipse) so that every one can use the
> same style...
>
>
> ~Umashanthi
>
> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>  wrote:
>> Yes, I get this too and it is quite annoying. I modified mine to not
>> "correct indentation" and CTRL+SHIFT+F worked and saving didnt rearrange it.
>> -Sy
>>
>> On Fri, May 14, 2010 at 15:59, Darius Jazayeri<[hidden email]>  wrote:
>>>
>>> Hi Ben, Win, etc,
>>> What's up with the fact that eclipse now auto-formats my java files when I
>>> save them. I wouldn't mind the feature except for the fact that it replaces
>>> several common things I do with uglier alternatives, and it does not format
>>> identically to what I get from control-shift-f.
>>> In particular, I like to format my annotated controller methods like this:
>>>>
>>>> public void showHierarchy(ModelMap model,
>>>>
>>>>                            @RequestParam(required = false, value =
>>>> "locationId") Location location,
>>>>
>>>>                            other args,
>>>>
>>>>                            aligned here...) {
>>>
>>> This new 'feature' won't let me do that, but instead removes my line
>>> breaks based on column widths.
>>> Also it was seeming to break the indentation of the throws declaration of
>>> a function by moving it all the way to the left on the next line, but that
>>> magically stopped happening while I was typing this email.
>>> Anyway, did I miss an email that we're auto-formatting our code now?
>>> -Darius
>>> ________________________________
>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>
>> ________________________________
>> Click here to unsubscribe from OpenMRS Developers' mailing list
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]

--
Thanks,

Nyoman Ribeka

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Umashanthi Pavalanathan Umashanthi Pavalanathan
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

Hi,

On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka <[hidden email]> wrote:
> Hi all,
>
> It works fine on my computer. The idea was to prevent us from code reviewing
> code indentation in the code review.
>
> About the exception, not sure why the formatter will format them like that.
>
> Umashanti, we do have the code template and code formatter (but sadly nobody
> seems to be able to find it in our wiki).

Sorry for not searching the wiki completely for this.

I found the code styles in :
http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style

Thank you  Riberka.


~Umashanthi




>
> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>
>> I think it's better if someone provide with a codestyle configuration
>> for OpenMRS (probably a xml for Eclipse) so that every one can use the
>> same style...
>>
>>
>> ~Umashanthi
>>
>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>  wrote:
>>>
>>> Yes, I get this too and it is quite annoying. I modified mine to not
>>> "correct indentation" and CTRL+SHIFT+F worked and saving didnt rearrange
>>> it.
>>> -Sy
>>>
>>> On Fri, May 14, 2010 at 15:59, Darius Jazayeri<[hidden email]>
>>>  wrote:
>>>>
>>>> Hi Ben, Win, etc,
>>>> What's up with the fact that eclipse now auto-formats my java files when
>>>> I
>>>> save them. I wouldn't mind the feature except for the fact that it
>>>> replaces
>>>> several common things I do with uglier alternatives, and it does not
>>>> format
>>>> identically to what I get from control-shift-f.
>>>> In particular, I like to format my annotated controller methods like
>>>> this:
>>>>>
>>>>> public void showHierarchy(ModelMap model,
>>>>>
>>>>>                           @RequestParam(required = false, value =
>>>>> "locationId") Location location,
>>>>>
>>>>>                           other args,
>>>>>
>>>>>                           aligned here...) {
>>>>
>>>> This new 'feature' won't let me do that, but instead removes my line
>>>> breaks based on column widths.
>>>> Also it was seeming to break the indentation of the throws declaration
>>>> of
>>>> a function by moving it all the way to the left on the next line, but
>>>> that
>>>> magically stopped happening while I was typing this email.
>>>> Anyway, did I miss an email that we're auto-formatting our code now?
>>>> -Darius
>>>> ________________________________
>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>
>>> ________________________________
>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
>> [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not
>> the subject) of your e-mail.
>>
>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>
> --
> Thanks,
>
> Nyoman Ribeka
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
> [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not
> the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Darius Jazayeri-3 Darius Jazayeri-3
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

Win, Do you know if we can distribute the code style within the project?

-Darius

On Fri, May 14, 2010 at 1:49 PM, Umashanthi Pavalanathan <[hidden email]> wrote:
Hi,

On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka <[hidden email]> wrote:
> Hi all,
>
> It works fine on my computer. The idea was to prevent us from code reviewing
> code indentation in the code review.
>
> About the exception, not sure why the formatter will format them like that.
>
> Umashanti, we do have the code template and code formatter (but sadly nobody
> seems to be able to find it in our wiki).

Sorry for not searching the wiki completely for this.

I found the code styles in :
http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style

Thank you  Riberka.


~Umashanthi




>
> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>
>> I think it's better if someone provide with a codestyle configuration
>> for OpenMRS (probably a xml for Eclipse) so that every one can use the
>> same style...
>>
>>
>> ~Umashanthi
>>
>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>  wrote:
>>>
>>> Yes, I get this too and it is quite annoying. I modified mine to not
>>> "correct indentation" and CTRL+SHIFT+F worked and saving didnt rearrange
>>> it.
>>> -Sy
>>>
>>> On Fri, May 14, 2010 at 15:59, Darius Jazayeri<[hidden email]>
>>>  wrote:
>>>>
>>>> Hi Ben, Win, etc,
>>>> What's up with the fact that eclipse now auto-formats my java files when
>>>> I
>>>> save them. I wouldn't mind the feature except for the fact that it
>>>> replaces
>>>> several common things I do with uglier alternatives, and it does not
>>>> format
>>>> identically to what I get from control-shift-f.
>>>> In particular, I like to format my annotated controller methods like
>>>> this:
>>>>>
>>>>> public void showHierarchy(ModelMap model,
>>>>>
>>>>>                           @RequestParam(required = false, value =
>>>>> "locationId") Location location,
>>>>>
>>>>>                           other args,
>>>>>
>>>>>                           aligned here...) {
>>>>
>>>> This new 'feature' won't let me do that, but instead removes my line
>>>> breaks based on column widths.
>>>> Also it was seeming to break the indentation of the throws declaration
>>>> of
>>>> a function by moving it all the way to the left on the next line, but
>>>> that
>>>> magically stopped happening while I was typing this email.
>>>> Anyway, did I miss an email that we're auto-formatting our code now?
>>>> -Darius
>>>> ________________________________
>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>
>>> ________________________________
>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
>> [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not
>> the subject) of your e-mail.
>>
>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>
> --
> Thanks,
>
> Nyoman Ribeka
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
> [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not
> the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]


[hidden email] from OpenMRS Developers' mailing list
Ben Wolfe Ben Wolfe
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

In reply to this post by Darius Jazayeri-2
I thought we did already with the .settings folder...

Ben
-----Original Message-----
From: Darius Jazayeri <[hidden email]>
Date: Friday, May 14, 2010 4:59 pm
Subject: Re: eclipse auto formatting when saving a file
To: "[hidden email]" <[hidden email]>Reply-To: "[hidden email]" <[hidden email]>

Win, Do you know if we can distribute the code style within the project?

>
>
>-Darius
>
>On Fri, May 14, 2010 at 1:49 PM, Umashanthi Pavalanathan <[hidden email]> wrote:
>Hi,
>
> On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka <[hidden email]> wrote:
>> Hi all,
>>
>> It works fine on my computer. The idea was to prevent us from code reviewing
>> code indentation in the code review.
>>
>> About the exception, not sure why the formatter will format them like that.
>>
>> Umashanti, we do have the code template and code formatter (but sadly nobody
>> seems to be able to find it in our wiki).
>
>Sorry for not searching the wiki completely for this.
>
> I found the code styles in :
>http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style
>
> Thank you  Riberka.
>
>
>~Umashanthi
>
>
>
>
>
>
>>
>> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>>
>>> I think it's better if someone provide with a codestyle configuration
>>> for OpenMRS (probably a xml for Eclipse) so that every one can use the
>>> same style...
>>>
>>>
>>> ~Umashanthi
>>>
>>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>  wrote:
>>>>
>>>> Yes, I get this too and it is quite annoying. I modified mine to not
>>>> 'correct indentation' and CTRL+SHIFT+F worked and saving didnt rearrange
>>>> it.
>>>> -Sy
>>>>
>>>> On Fri, May 14, 2010 at 15:59, Darius Jazayeri<[hidden email]>
>>>>  wrote:
>>>>>
>>>>> Hi Ben, Win, etc,
>>>>> What's up with the fact that eclipse now auto-formats my java files when
>>>>> I
>>>>> save them. I wouldn't mind the feature except for the fact that it
>>>>> replaces
>>>>> several common things I do with uglier alternatives, and it does not
>>>>> format
>>>>> identically to what I get from control-shift-f.
>>>>> In particular, I like to format my annotated controller methods like
>>>>> this:
>>>>>>
>>>>>> public void showHierarchy(ModelMap model,
>>>>>>
>>>>>>                           @RequestParam(required = false, value =
>>>>>> 'locationId') Location location,
>>>>>>
>>>>>>                           other args,
>>>>>>
>>>>>>                           aligned here...) {
>>>>>
>>>>> This new 'feature' won't let me do that, but instead removes my line
>>>>> breaks based on column widths.
>>>>> Also it was seeming to break the indentation of the throws declaration
>>>>> of
>>>>> a function by moving it all the way to the left on the next line, but
>>>>> that
>>>>> magically stopped happening while I was typing this email.
>>>>> Anyway, did I miss an email that we're auto-formatting our code now?
>>>>> -Darius
>>>>> ________________________________
>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>
>>>> ________________________________
>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>
>>> _________________________________________
>>>
>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in the  body (not
>>> the subject) of your e-mail.
>>>
>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>
>> --
>> Thanks,
>>
>> Nyoman Ribeka
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
>> [hidden email] with 'SIGNOFF openmrs-devel-l' in the  body (not
>> the

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Burke Mamlin Burke Mamlin
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

We have always included the format settings for eclipse in the  
repository so that the format shortcut key works the same for everyone.

I'd agree that a change that affects nearly all devs should be  
discussed on the dev list and/or on a dev call before it is made if at  
all possible.

Maybe there is a better solution for applying formatting prior to code  
review?  Eg, require that checkstyle be run (and passed) before  
anything is submitted for code review and add the formatting checks to  
the checkstyle config.

I will often avoid formatting code when I'm testing things anday have  
a chunk of code commented out or a list of text inserted in a comment  
temporarily. The formatting turns these comment sections into a big  
blob by removing new lines. But it would be trivial to right-click on  
the src folder and format everything before running checkstyle in  
preparation to submit code for review.

-Burke



On May 14, 2010, at 5:55 PM, Ben Wolfe <[hidden email]> wrote:

> I thought we did already with the .settings folder...
>
> Ben
> -----Original Message-----
> From: Darius Jazayeri <[hidden email]>
> Date: Friday, May 14, 2010 4:59 pm
> Subject: Re: eclipse auto formatting when saving a file
> To: "[hidden email]" <[hidden email]
> >Reply-To: "[hidden email]" <[hidden email]>
>
> Win, Do you know if we can distribute the code style within the  
> project?
>>
>>
>> -Darius
>>
>> On Fri, May 14, 2010 at 1:49 PM, Umashanthi Pavalanathan <[hidden email]
>> > wrote:
>> Hi,
>>
>> On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka <[hidden email]
>> > wrote:
>>> Hi all,
>>>
>>> It works fine on my computer. The idea was to prevent us from code  
>>> reviewing
>>> code indentation in the code review.
>>>
>>> About the exception, not sure why the formatter will format them  
>>> like that.
>>>
>>> Umashanti, we do have the code template and code formatter (but  
>>> sadly nobody
>>> seems to be able to find it in our wiki).
>>
>> Sorry for not searching the wiki completely for this.
>>
>> I found the code styles in :
>> http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style
>>
>> Thank you  Riberka.
>>
>>
>> ~Umashanthi
>>
>>
>>
>>
>>
>>
>>>
>>> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>>>
>>>> I think it's better if someone provide with a codestyle  
>>>> configuration
>>>> for OpenMRS (probably a xml for Eclipse) so that every one can  
>>>> use the
>>>> same style...
>>>>
>>>>
>>>> ~Umashanthi
>>>>
>>>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>  wrote:
>>>>>
>>>>> Yes, I get this too and it is quite annoying. I modified mine to  
>>>>> not
>>>>> 'correct indentation' and CTRL+SHIFT+F worked and saving didnt  
>>>>> rearrange
>>>>> it.
>>>>> -Sy
>>>>>
>>>>> On Fri, May 14, 2010 at 15:59, Darius  
>>>>> Jazayeri<[hidden email]>
>>>>>  wrote:
>>>>>>
>>>>>> Hi Ben, Win, etc,
>>>>>> What's up with the fact that eclipse now auto-formats my java  
>>>>>> files when
>>>>>> I
>>>>>> save them. I wouldn't mind the feature except for the fact that  
>>>>>> it
>>>>>> replaces
>>>>>> several common things I do with uglier alternatives, and it  
>>>>>> does not
>>>>>> format
>>>>>> identically to what I get from control-shift-f.
>>>>>> In particular, I like to format my annotated controller methods  
>>>>>> like
>>>>>> this:
>>>>>>>
>>>>>>> public void showHierarchy(ModelMap model,
>>>>>>>
>>>>>>>                           @RequestParam(required = false,  
>>>>>>> value =
>>>>>>> 'locationId') Location location,
>>>>>>>
>>>>>>>                           other args,
>>>>>>>
>>>>>>>                           aligned here...) {
>>>>>>
>>>>>> This new 'feature' won't let me do that, but instead removes my  
>>>>>> line
>>>>>> breaks based on column widths.
>>>>>> Also it was seeming to break the indentation of the throws  
>>>>>> declaration
>>>>>> of
>>>>>> a function by moving it all the way to the left on the next  
>>>>>> line, but
>>>>>> that
>>>>>> magically stopped happening while I was typing this email.
>>>>>> Anyway, did I miss an email that we're auto-formatting our code  
>>>>>> now?
>>>>>> -Darius
>>>>>> ________________________________
>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>
>>>>> ________________________________
>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>
>>>> _________________________________________
>>>>
>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>> mail to
>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in  
>>>> the  body (not
>>>> the subject) of your e-mail.
>>>>
>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>
>>> --
>>> Thanks,
>>>
>>> Nyoman Ribeka
>>>
>>> _________________________________________
>>>
>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>> mail to
>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in the  
>>> body (not
>>> the
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail  
> to [hidden email] with "SIGNOFF openmrs-devel-l" in  
> the  body (not the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Ben Wolfe Ben Wolfe
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

I agree that doing an automatic format (control-shift-f) of java files
would be annoying for those exact reasons you spelled out Burke.

However, the on-save action was doing an indent correction (control-i).
  Unfortunately eclipse's auto format and auto indent don't speak to
each other, because things were getting moved around when saving
correctly formatted files.

The only actions turned on now are:

Remove Unused Imports
Add missing @Override annotations
Add missing @Deprecated annotations
Remove unnecessary casts
Remove trailing whitespaces on non-empty lines

We're going to need to get checkstyle automated somehow and built into
the downloaded code like these .settings in order for it to be used.
Because its new patches from new developers that usually have these
minor problems.  Those developers are the ones that wouldn't have
necessarily read all documentation and/or installed all checkstyle routines.

Ben

On 05/14/2010 07:41 PM, Burke Mamlin wrote:

> We have always included the format settings for eclipse in the
> repository so that the format shortcut key works the same for everyone.
>
> I'd agree that a change that affects nearly all devs should be
> discussed on the dev list and/or on a dev call before it is made if at
> all possible.
>
> Maybe there is a better solution for applying formatting prior to code
> review?  Eg, require that checkstyle be run (and passed) before
> anything is submitted for code review and add the formatting checks to
> the checkstyle config.
>
> I will often avoid formatting code when I'm testing things anday have
> a chunk of code commented out or a list of text inserted in a comment
> temporarily. The formatting turns these comment sections into a big
> blob by removing new lines. But it would be trivial to right-click on
> the src folder and format everything before running checkstyle in
> preparation to submit code for review.
>
> -Burke
>
>
>
> On May 14, 2010, at 5:55 PM, Ben Wolfe<[hidden email]>  wrote:
>
>> I thought we did already with the .settings folder...
>>
>> Ben
>> -----Original Message-----
>> From: Darius Jazayeri<[hidden email]>
>> Date: Friday, May 14, 2010 4:59 pm
>> Subject: Re: eclipse auto formatting when saving a file
>> To: "[hidden email]"<[hidden email]
>>> Reply-To: "[hidden email]"<[hidden email]>
>>
>> Win, Do you know if we can distribute the code style within the
>> project?
>>>
>>>
>>> -Darius
>>>
>>> On Fri, May 14, 2010 at 1:49 PM, Umashanthi Pavalanathan<[hidden email]
>>>> wrote:
>>> Hi,
>>>
>>> On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka<[hidden email]
>>>> wrote:
>>>> Hi all,
>>>>
>>>> It works fine on my computer. The idea was to prevent us from code
>>>> reviewing
>>>> code indentation in the code review.
>>>>
>>>> About the exception, not sure why the formatter will format them
>>>> like that.
>>>>
>>>> Umashanti, we do have the code template and code formatter (but
>>>> sadly nobody
>>>> seems to be able to find it in our wiki).
>>>
>>> Sorry for not searching the wiki completely for this.
>>>
>>> I found the code styles in :
>>> http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style
>>>
>>> Thank you  Riberka.
>>>
>>>
>>> ~Umashanthi
>>>
>>>
>>>
>>>
>>>
>>>
>>>>
>>>> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>>>>
>>>>> I think it's better if someone provide with a codestyle
>>>>> configuration
>>>>> for OpenMRS (probably a xml for Eclipse) so that every one can
>>>>> use the
>>>>> same style...
>>>>>
>>>>>
>>>>> ~Umashanthi
>>>>>
>>>>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>   wrote:
>>>>>>
>>>>>> Yes, I get this too and it is quite annoying. I modified mine to
>>>>>> not
>>>>>> 'correct indentation' and CTRL+SHIFT+F worked and saving didnt
>>>>>> rearrange
>>>>>> it.
>>>>>> -Sy
>>>>>>
>>>>>> On Fri, May 14, 2010 at 15:59, Darius
>>>>>> Jazayeri<[hidden email]>
>>>>>>   wrote:
>>>>>>>
>>>>>>> Hi Ben, Win, etc,
>>>>>>> What's up with the fact that eclipse now auto-formats my java
>>>>>>> files when
>>>>>>> I
>>>>>>> save them. I wouldn't mind the feature except for the fact that
>>>>>>> it
>>>>>>> replaces
>>>>>>> several common things I do with uglier alternatives, and it
>>>>>>> does not
>>>>>>> format
>>>>>>> identically to what I get from control-shift-f.
>>>>>>> In particular, I like to format my annotated controller methods
>>>>>>> like
>>>>>>> this:
>>>>>>>>
>>>>>>>> public void showHierarchy(ModelMap model,
>>>>>>>>
>>>>>>>>                            @RequestParam(required = false,
>>>>>>>> value =
>>>>>>>> 'locationId') Location location,
>>>>>>>>
>>>>>>>>                            other args,
>>>>>>>>
>>>>>>>>                            aligned here...) {
>>>>>>>
>>>>>>> This new 'feature' won't let me do that, but instead removes my
>>>>>>> line
>>>>>>> breaks based on column widths.
>>>>>>> Also it was seeming to break the indentation of the throws
>>>>>>> declaration
>>>>>>> of
>>>>>>> a function by moving it all the way to the left on the next
>>>>>>> line, but
>>>>>>> that
>>>>>>> magically stopped happening while I was typing this email.
>>>>>>> Anyway, did I miss an email that we're auto-formatting our code
>>>>>>> now?
>>>>>>> -Darius
>>>>>>> ________________________________
>>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>>
>>>>>> ________________________________
>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>
>>>>> _________________________________________
>>>>>
>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>>> mail to
>>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in
>>>>> the  body (not
>>>>> the subject) of your e-mail.
>>>>>
>>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>>
>>>> --
>>>> Thanks,
>>>>
>>>> Nyoman Ribeka
>>>>
>>>> _________________________________________
>>>>
>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>> mail to
>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in the
>>>> body (not
>>>> the
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail
>> to [hidden email] with "SIGNOFF openmrs-devel-l" in
>> the  body (not the subject) of your e-mail.
>>
>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Burke Mamlin Burke Mamlin
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

If a new developer has skipped some of the documentation, then it sounds like a "teachable" moment. :-)

-Burke

On May 16, 2010, at 11:06 PM, Ben Wolfe wrote:

> I agree that doing an automatic format (control-shift-f) of java files would be annoying for those exact reasons you spelled out Burke.
>
> However, the on-save action was doing an indent correction (control-i).  Unfortunately eclipse's auto format and auto indent don't speak to each other, because things were getting moved around when saving correctly formatted files.
>
> The only actions turned on now are:
>
> Remove Unused Imports
> Add missing @Override annotations
> Add missing @Deprecated annotations
> Remove unnecessary casts
> Remove trailing whitespaces on non-empty lines
>
> We're going to need to get checkstyle automated somehow and built into the downloaded code like these .settings in order for it to be used. Because its new patches from new developers that usually have these minor problems.  Those developers are the ones that wouldn't have necessarily read all documentation and/or installed all checkstyle routines.
>
> Ben
>
> On 05/14/2010 07:41 PM, Burke Mamlin wrote:
>> We have always included the format settings for eclipse in the
>> repository so that the format shortcut key works the same for everyone.
>>
>> I'd agree that a change that affects nearly all devs should be
>> discussed on the dev list and/or on a dev call before it is made if at
>> all possible.
>>
>> Maybe there is a better solution for applying formatting prior to code
>> review?  Eg, require that checkstyle be run (and passed) before
>> anything is submitted for code review and add the formatting checks to
>> the checkstyle config.
>>
>> I will often avoid formatting code when I'm testing things anday have
>> a chunk of code commented out or a list of text inserted in a comment
>> temporarily. The formatting turns these comment sections into a big
>> blob by removing new lines. But it would be trivial to right-click on
>> the src folder and format everything before running checkstyle in
>> preparation to submit code for review.
>>
>> -Burke
>>
>>
>>
>> On May 14, 2010, at 5:55 PM, Ben Wolfe<[hidden email]>  wrote:
>>
>>> I thought we did already with the .settings folder...
>>>
>>> Ben
>>> -----Original Message-----
>>> From: Darius Jazayeri<[hidden email]>
>>> Date: Friday, May 14, 2010 4:59 pm
>>> Subject: Re: eclipse auto formatting when saving a file
>>> To: "[hidden email]"<[hidden email]
>>>> Reply-To: "[hidden email]"<[hidden email]>
>>>
>>> Win, Do you know if we can distribute the code style within the
>>> project?
>>>>
>>>>
>>>> -Darius
>>>>
>>>> On Fri, May 14, 2010 at 1:49 PM, Umashanthi Pavalanathan<[hidden email]
>>>>> wrote:
>>>> Hi,
>>>>
>>>> On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka<[hidden email]
>>>>> wrote:
>>>>> Hi all,
>>>>>
>>>>> It works fine on my computer. The idea was to prevent us from code
>>>>> reviewing
>>>>> code indentation in the code review.
>>>>>
>>>>> About the exception, not sure why the formatter will format them
>>>>> like that.
>>>>>
>>>>> Umashanti, we do have the code template and code formatter (but
>>>>> sadly nobody
>>>>> seems to be able to find it in our wiki).
>>>>
>>>> Sorry for not searching the wiki completely for this.
>>>>
>>>> I found the code styles in :
>>>> http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style
>>>>
>>>> Thank you  Riberka.
>>>>
>>>>
>>>> ~Umashanthi
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>
>>>>> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>>>>>
>>>>>> I think it's better if someone provide with a codestyle
>>>>>> configuration
>>>>>> for OpenMRS (probably a xml for Eclipse) so that every one can
>>>>>> use the
>>>>>> same style...
>>>>>>
>>>>>>
>>>>>> ~Umashanthi
>>>>>>
>>>>>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>   wrote:
>>>>>>>
>>>>>>> Yes, I get this too and it is quite annoying. I modified mine to
>>>>>>> not
>>>>>>> 'correct indentation' and CTRL+SHIFT+F worked and saving didnt
>>>>>>> rearrange
>>>>>>> it.
>>>>>>> -Sy
>>>>>>>
>>>>>>> On Fri, May 14, 2010 at 15:59, Darius
>>>>>>> Jazayeri<[hidden email]>
>>>>>>>  wrote:
>>>>>>>>
>>>>>>>> Hi Ben, Win, etc,
>>>>>>>> What's up with the fact that eclipse now auto-formats my java
>>>>>>>> files when
>>>>>>>> I
>>>>>>>> save them. I wouldn't mind the feature except for the fact that
>>>>>>>> it
>>>>>>>> replaces
>>>>>>>> several common things I do with uglier alternatives, and it
>>>>>>>> does not
>>>>>>>> format
>>>>>>>> identically to what I get from control-shift-f.
>>>>>>>> In particular, I like to format my annotated controller methods
>>>>>>>> like
>>>>>>>> this:
>>>>>>>>>
>>>>>>>>> public void showHierarchy(ModelMap model,
>>>>>>>>>
>>>>>>>>>                           @RequestParam(required = false,
>>>>>>>>> value =
>>>>>>>>> 'locationId') Location location,
>>>>>>>>>
>>>>>>>>>                           other args,
>>>>>>>>>
>>>>>>>>>                           aligned here...) {
>>>>>>>>
>>>>>>>> This new 'feature' won't let me do that, but instead removes my
>>>>>>>> line
>>>>>>>> breaks based on column widths.
>>>>>>>> Also it was seeming to break the indentation of the throws
>>>>>>>> declaration
>>>>>>>> of
>>>>>>>> a function by moving it all the way to the left on the next
>>>>>>>> line, but
>>>>>>>> that
>>>>>>>> magically stopped happening while I was typing this email.
>>>>>>>> Anyway, did I miss an email that we're auto-formatting our code
>>>>>>>> now?
>>>>>>>> -Darius
>>>>>>>> ________________________________
>>>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>>>
>>>>>>> ________________________________
>>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>>
>>>>>> _________________________________________
>>>>>>
>>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>>>> mail to
>>>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in
>>>>>> the  body (not
>>>>>> the subject) of your e-mail.
>>>>>>
>>>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>>>
>>>>> --
>>>>> Thanks,
>>>>>
>>>>> Nyoman Ribeka
>>>>>
>>>>> _________________________________________
>>>>>
>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>>> mail to
>>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in the
>>>>> body (not
>>>>> the
>>>
>>> _________________________________________
>>>
>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail
>>> to [hidden email] with "SIGNOFF openmrs-devel-l" in
>>> the  body (not the subject) of your e-mail.
>>>
>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>>
>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Ben Wolfe Ben Wolfe
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

Yes, but that leaves us in the same position we're in now.  I'm just
saying that checkstyle is not the cure-all that you're thinking it is
(unless we can completely integrate/automate it with the current
developer workflow without any extra work on their part).

Ben

On 05/17/2010 12:04 AM, Burke Mamlin wrote:

> If a new developer has skipped some of the documentation, then it sounds like a "teachable" moment. :-)
>
> -Burke
>
> On May 16, 2010, at 11:06 PM, Ben Wolfe wrote:
>
>> I agree that doing an automatic format (control-shift-f) of java files would be annoying for those exact reasons you spelled out Burke.
>>
>> However, the on-save action was doing an indent correction (control-i).  Unfortunately eclipse's auto format and auto indent don't speak to each other, because things were getting moved around when saving correctly formatted files.
>>
>> The only actions turned on now are:
>>
>> Remove Unused Imports
>> Add missing @Override annotations
>> Add missing @Deprecated annotations
>> Remove unnecessary casts
>> Remove trailing whitespaces on non-empty lines
>>
>> We're going to need to get checkstyle automated somehow and built into the downloaded code like these .settings in order for it to be used. Because its new patches from new developers that usually have these minor problems.  Those developers are the ones that wouldn't have necessarily read all documentation and/or installed all checkstyle routines.
>>
>> Ben
>>
>> On 05/14/2010 07:41 PM, Burke Mamlin wrote:
>>> We have always included the format settings for eclipse in the
>>> repository so that the format shortcut key works the same for everyone.
>>>
>>> I'd agree that a change that affects nearly all devs should be
>>> discussed on the dev list and/or on a dev call before it is made if at
>>> all possible.
>>>
>>> Maybe there is a better solution for applying formatting prior to code
>>> review?  Eg, require that checkstyle be run (and passed) before
>>> anything is submitted for code review and add the formatting checks to
>>> the checkstyle config.
>>>
>>> I will often avoid formatting code when I'm testing things anday have
>>> a chunk of code commented out or a list of text inserted in a comment
>>> temporarily. The formatting turns these comment sections into a big
>>> blob by removing new lines. But it would be trivial to right-click on
>>> the src folder and format everything before running checkstyle in
>>> preparation to submit code for review.
>>>
>>> -Burke
>>>
>>>
>>>
>>> On May 14, 2010, at 5:55 PM, Ben Wolfe<[hidden email]>   wrote:
>>>
>>>> I thought we did already with the .settings folder...
>>>>
>>>> Ben
>>>> -----Original Message-----
>>>> From: Darius Jazayeri<[hidden email]>
>>>> Date: Friday, May 14, 2010 4:59 pm
>>>> Subject: Re: eclipse auto formatting when saving a file
>>>> To: "[hidden email]"<[hidden email]
>>>>> Reply-To: "[hidden email]"<[hidden email]>
>>>>
>>>> Win, Do you know if we can distribute the code style within the
>>>> project?
>>>>>
>>>>>
>>>>> -Darius
>>>>>
>>>>> On Fri, May 14, 2010 at 1:49 PM, Umashanthi Pavalanathan<[hidden email]
>>>>>> wrote:
>>>>> Hi,
>>>>>
>>>>> On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka<[hidden email]
>>>>>> wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> It works fine on my computer. The idea was to prevent us from code
>>>>>> reviewing
>>>>>> code indentation in the code review.
>>>>>>
>>>>>> About the exception, not sure why the formatter will format them
>>>>>> like that.
>>>>>>
>>>>>> Umashanti, we do have the code template and code formatter (but
>>>>>> sadly nobody
>>>>>> seems to be able to find it in our wiki).
>>>>>
>>>>> Sorry for not searching the wiki completely for this.
>>>>>
>>>>> I found the code styles in :
>>>>> http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style
>>>>>
>>>>> Thank you  Riberka.
>>>>>
>>>>>
>>>>> ~Umashanthi
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>>>>>>
>>>>>>> I think it's better if someone provide with a codestyle
>>>>>>> configuration
>>>>>>> for OpenMRS (probably a xml for Eclipse) so that every one can
>>>>>>> use the
>>>>>>> same style...
>>>>>>>
>>>>>>>
>>>>>>> ~Umashanthi
>>>>>>>
>>>>>>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>    wrote:
>>>>>>>>
>>>>>>>> Yes, I get this too and it is quite annoying. I modified mine to
>>>>>>>> not
>>>>>>>> 'correct indentation' and CTRL+SHIFT+F worked and saving didnt
>>>>>>>> rearrange
>>>>>>>> it.
>>>>>>>> -Sy
>>>>>>>>
>>>>>>>> On Fri, May 14, 2010 at 15:59, Darius
>>>>>>>> Jazayeri<[hidden email]>
>>>>>>>>   wrote:
>>>>>>>>>
>>>>>>>>> Hi Ben, Win, etc,
>>>>>>>>> What's up with the fact that eclipse now auto-formats my java
>>>>>>>>> files when
>>>>>>>>> I
>>>>>>>>> save them. I wouldn't mind the feature except for the fact that
>>>>>>>>> it
>>>>>>>>> replaces
>>>>>>>>> several common things I do with uglier alternatives, and it
>>>>>>>>> does not
>>>>>>>>> format
>>>>>>>>> identically to what I get from control-shift-f.
>>>>>>>>> In particular, I like to format my annotated controller methods
>>>>>>>>> like
>>>>>>>>> this:
>>>>>>>>>>
>>>>>>>>>> public void showHierarchy(ModelMap model,
>>>>>>>>>>
>>>>>>>>>>                            @RequestParam(required = false,
>>>>>>>>>> value =
>>>>>>>>>> 'locationId') Location location,
>>>>>>>>>>
>>>>>>>>>>                            other args,
>>>>>>>>>>
>>>>>>>>>>                            aligned here...) {
>>>>>>>>>
>>>>>>>>> This new 'feature' won't let me do that, but instead removes my
>>>>>>>>> line
>>>>>>>>> breaks based on column widths.
>>>>>>>>> Also it was seeming to break the indentation of the throws
>>>>>>>>> declaration
>>>>>>>>> of
>>>>>>>>> a function by moving it all the way to the left on the next
>>>>>>>>> line, but
>>>>>>>>> that
>>>>>>>>> magically stopped happening while I was typing this email.
>>>>>>>>> Anyway, did I miss an email that we're auto-formatting our code
>>>>>>>>> now?
>>>>>>>>> -Darius
>>>>>>>>> ________________________________
>>>>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>>>>
>>>>>>>> ________________________________
>>>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>>>
>>>>>>> _________________________________________
>>>>>>>
>>>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>>>>> mail to
>>>>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in
>>>>>>> the  body (not
>>>>>>> the subject) of your e-mail.
>>>>>>>
>>>>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>>>>
>>>>>> --
>>>>>> Thanks,
>>>>>>
>>>>>> Nyoman Ribeka
>>>>>>
>>>>>> _________________________________________
>>>>>>
>>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>>>> mail to
>>>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in the
>>>>>> body (not
>>>>>> the
>>>>
>>>> _________________________________________
>>>>
>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail
>>>> to [hidden email] with "SIGNOFF openmrs-devel-l" in
>>>> the  body (not the subject) of your e-mail.
>>>>
>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>
>>> _________________________________________
>>>
>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>>>
>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>>
>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
Burke Mamlin Burke Mamlin
Reply | Threaded
Open this post in threaded view
|

Re: eclipse auto formatting when saving a file

I think the hope was that CheckStyle could be integrated into Eclipse as a background process, so you get the feedback as warnings/errors as you write the code & without adding checkstyle (a 10-second process) to the ANT compile.

It's very likely that the CI engine could scan for patches and auto-validate them in the future (once we're in JIRA & Crucible); however, in the meantime it's perfectly reasonable to require that submitted patches must pass checkstyle checks before they're considered for review.  Once a single hint appears during review that checkstyle was not run, then the code is sent back to the submitter with a link to our conventions for running checkstyle before submitting patches and you move on to the next code review.

-Burke

On May 17, 2010, at 9:23 AM, Ben Wolfe wrote:

> Yes, but that leaves us in the same position we're in now.  I'm just saying that checkstyle is not the cure-all that you're thinking it is (unless we can completely integrate/automate it with the current developer workflow without any extra work on their part).
>
> Ben
>
> On 05/17/2010 12:04 AM, Burke Mamlin wrote:
>> If a new developer has skipped some of the documentation, then it sounds like a "teachable" moment. :-)
>>
>> -Burke
>>
>> On May 16, 2010, at 11:06 PM, Ben Wolfe wrote:
>>
>>> I agree that doing an automatic format (control-shift-f) of java files would be annoying for those exact reasons you spelled out Burke.
>>>
>>> However, the on-save action was doing an indent correction (control-i).  Unfortunately eclipse's auto format and auto indent don't speak to each other, because things were getting moved around when saving correctly formatted files.
>>>
>>> The only actions turned on now are:
>>>
>>> Remove Unused Imports
>>> Add missing @Override annotations
>>> Add missing @Deprecated annotations
>>> Remove unnecessary casts
>>> Remove trailing whitespaces on non-empty lines
>>>
>>> We're going to need to get checkstyle automated somehow and built into the downloaded code like these .settings in order for it to be used. Because its new patches from new developers that usually have these minor problems.  Those developers are the ones that wouldn't have necessarily read all documentation and/or installed all checkstyle routines.
>>>
>>> Ben
>>>
>>> On 05/14/2010 07:41 PM, Burke Mamlin wrote:
>>>> We have always included the format settings for eclipse in the
>>>> repository so that the format shortcut key works the same for everyone.
>>>>
>>>> I'd agree that a change that affects nearly all devs should be
>>>> discussed on the dev list and/or on a dev call before it is made if at
>>>> all possible.
>>>>
>>>> Maybe there is a better solution for applying formatting prior to code
>>>> review?  Eg, require that checkstyle be run (and passed) before
>>>> anything is submitted for code review and add the formatting checks to
>>>> the checkstyle config.
>>>>
>>>> I will often avoid formatting code when I'm testing things anday have
>>>> a chunk of code commented out or a list of text inserted in a comment
>>>> temporarily. The formatting turns these comment sections into a big
>>>> blob by removing new lines. But it would be trivial to right-click on
>>>> the src folder and format everything before running checkstyle in
>>>> preparation to submit code for review.
>>>>
>>>> -Burke
>>>>
>>>>
>>>>
>>>> On May 14, 2010, at 5:55 PM, Ben Wolfe<[hidden email]>   wrote:
>>>>
>>>>> I thought we did already with the .settings folder...
>>>>>
>>>>> Ben
>>>>> -----Original Message-----
>>>>> From: Darius Jazayeri<[hidden email]>
>>>>> Date: Friday, May 14, 2010 4:59 pm
>>>>> Subject: Re: eclipse auto formatting when saving a file
>>>>> To: "[hidden email]"<[hidden email]
>>>>>> Reply-To: "[hidden email]"<[hidden email]>
>>>>>
>>>>> Win, Do you know if we can distribute the code style within the
>>>>> project?
>>>>>>
>>>>>>
>>>>>> -Darius
>>>>>>
>>>>>> On Fri, May 14, 2010 at 1:49 PM, Umashanthi Pavalanathan<[hidden email]
>>>>>>> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Sat, May 15, 2010 at 2:17 AM, Nyoman Ribeka<[hidden email]
>>>>>>> wrote:
>>>>>>> Hi all,
>>>>>>>
>>>>>>> It works fine on my computer. The idea was to prevent us from code
>>>>>>> reviewing
>>>>>>> code indentation in the code review.
>>>>>>>
>>>>>>> About the exception, not sure why the formatter will format them
>>>>>>> like that.
>>>>>>>
>>>>>>> Umashanti, we do have the code template and code formatter (but
>>>>>>> sadly nobody
>>>>>>> seems to be able to find it in our wiki).
>>>>>>
>>>>>> Sorry for not searching the wiki completely for this.
>>>>>>
>>>>>> I found the code styles in :
>>>>>> http://openmrs.org/wiki/Developer_How-To_Use_Eclipse_Guide#How_to_Install_OpenMRS_Code_Style
>>>>>>
>>>>>> Thank you  Riberka.
>>>>>>
>>>>>>
>>>>>> ~Umashanthi
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> On 05/14/2010 04:27 PM, Umashanthi Pavalanathan wrote:
>>>>>>>>
>>>>>>>> I think it's better if someone provide with a codestyle
>>>>>>>> configuration
>>>>>>>> for OpenMRS (probably a xml for Eclipse) so that every one can
>>>>>>>> use the
>>>>>>>> same style...
>>>>>>>>
>>>>>>>>
>>>>>>>> ~Umashanthi
>>>>>>>>
>>>>>>>> On Sat, May 15, 2010 at 1:32 AM, Sy Haas<[hidden email]>    wrote:
>>>>>>>>>
>>>>>>>>> Yes, I get this too and it is quite annoying. I modified mine to
>>>>>>>>> not
>>>>>>>>> 'correct indentation' and CTRL+SHIFT+F worked and saving didnt
>>>>>>>>> rearrange
>>>>>>>>> it.
>>>>>>>>> -Sy
>>>>>>>>>
>>>>>>>>> On Fri, May 14, 2010 at 15:59, Darius
>>>>>>>>> Jazayeri<[hidden email]>
>>>>>>>>>  wrote:
>>>>>>>>>>
>>>>>>>>>> Hi Ben, Win, etc,
>>>>>>>>>> What's up with the fact that eclipse now auto-formats my java
>>>>>>>>>> files when
>>>>>>>>>> I
>>>>>>>>>> save them. I wouldn't mind the feature except for the fact that
>>>>>>>>>> it
>>>>>>>>>> replaces
>>>>>>>>>> several common things I do with uglier alternatives, and it
>>>>>>>>>> does not
>>>>>>>>>> format
>>>>>>>>>> identically to what I get from control-shift-f.
>>>>>>>>>> In particular, I like to format my annotated controller methods
>>>>>>>>>> like
>>>>>>>>>> this:
>>>>>>>>>>>
>>>>>>>>>>> public void showHierarchy(ModelMap model,
>>>>>>>>>>>
>>>>>>>>>>>                           @RequestParam(required = false,
>>>>>>>>>>> value =
>>>>>>>>>>> 'locationId') Location location,
>>>>>>>>>>>
>>>>>>>>>>>                           other args,
>>>>>>>>>>>
>>>>>>>>>>>                           aligned here...) {
>>>>>>>>>>
>>>>>>>>>> This new 'feature' won't let me do that, but instead removes my
>>>>>>>>>> line
>>>>>>>>>> breaks based on column widths.
>>>>>>>>>> Also it was seeming to break the indentation of the throws
>>>>>>>>>> declaration
>>>>>>>>>> of
>>>>>>>>>> a function by moving it all the way to the left on the next
>>>>>>>>>> line, but
>>>>>>>>>> that
>>>>>>>>>> magically stopped happening while I was typing this email.
>>>>>>>>>> Anyway, did I miss an email that we're auto-formatting our code
>>>>>>>>>> now?
>>>>>>>>>> -Darius
>>>>>>>>>> ________________________________
>>>>>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>>>>>
>>>>>>>>> ________________________________
>>>>>>>>> Click here to unsubscribe from OpenMRS Developers' mailing list
>>>>>>>>
>>>>>>>> _________________________________________
>>>>>>>>
>>>>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>>>>>> mail to
>>>>>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in
>>>>>>>> the  body (not
>>>>>>>> the subject) of your e-mail.
>>>>>>>>
>>>>>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>>>>>
>>>>>>> --
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Nyoman Ribeka
>>>>>>>
>>>>>>> _________________________________________
>>>>>>>
>>>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-
>>>>>>> mail to
>>>>>>> [hidden email] with 'SIGNOFF openmrs-devel-l' in the
>>>>>>> body (not
>>>>>>> the
>>>>>
>>>>> _________________________________________
>>>>>
>>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail
>>>>> to [hidden email] with "SIGNOFF openmrs-devel-l" in
>>>>> the  body (not the subject) of your e-mail.
>>>>>
>>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>>
>>>> _________________________________________
>>>>
>>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>>>>
>>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>>
>>> _________________________________________
>>>
>>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>>>
>>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>>
>> _________________________________________
>>
>> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>>
>> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]
>
> _________________________________________
>
> To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.
>
> [mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:[hidden email]?body=SIGNOFF%20openmrs-devel-l]