You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Alex Huang <Al...@citrix.com> on 2013/07/03 00:11:17 UTC

Coding Convention Reminder

I like to remind everyone to review our coding conventions.  Our coding conventions have been going all over the place recently.  Please take a look.

https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions

I also like to propose that we extend the 120 column limit to 180 columns. 

I recently was reading the following code.  If it followed even our current coding conventions, this would have been 11 lines but it ends up to be 23 lines, more than doubled.  The whole file was like this.  Just thinking about all the extra scrolling I have to do makes my cts act up.  We are in the 21st century and using wide screen lcd monitors.  Let's not format our code to fit 80 column amber text screens please!

What's worse is I've found that some people are actively breaking existing source code to 80 columns, causing a bunch of unnecessary merge activities.  On Eclipse, you can actually set all types of formatting rules.  I can send out my epf (eclipse preferences file) if you don't want to deal with the trouble.  
                            DiskOfferingVO diskOffering = _diskOfferingDao
                                    .findById(vol.getDiskOfferingId());
                            if (diskOffering.getUseLocalStorage()) {
                                if (s_logger.isDebugEnabled()) {
                                    s_logger.debug("Local volume "
                                            + vol
                                            + " will be recreated on storage pool "
                                            + assignedPool
                                            + " assigned by deploymentPlanner");
                                }
                                VolumeTask task = new VolumeTask(VolumeTaskType.RECREATE, vol, null);
                                tasks.add(task);
                            } else {
                                if (s_logger.isDebugEnabled()) {
                                    s_logger.debug("Shared volume "
                                            + vol
                                            + " will be migrated on storage pool "
                                            + assignedPool
                                            + " assigned by deploymentPlanner");
                                }
                                VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
                                tasks.add(task);
                            }

Please be mindful of my cts.  Thanks for caring about my health!  :)

--Alex

Re: Coding Convention Reminder

Posted by Daan Hoogland <da...@gmail.com>.
On Wed, Jul 3, 2013 at 6:34 PM, Brian Federle <Br...@citrix.com>wrote:

> I've never managed to have auto-formatting work well in eclipse
> unfortunately. I usually use emacs js2-mode + IntelliJ,



I used to use vjet in eclipse, which wasn't very good but might have grown
since...?

RE: Coding Convention Reminder

Posted by Brian Federle <Br...@citrix.com>.
I agree...I've never managed to have auto-formatting work well in eclipse unfortunately. I usually use emacs js2-mode + IntelliJ, both of which have excellent JS auto-formatting.

-Brian
________________________________________
From: Chip Childers [chip.childers@sungard.com]
Sent: Wednesday, July 03, 2013 9:00 AM
To: dev@cloudstack.apache.org
Subject: Re: Coding Convention Reminder

On Wed, Jul 03, 2013 at 09:48:51AM +0100, Ian Duffy wrote:
> Any suggestions for formatting the Javascript files? The few I've
> looked at seem to be riddled with indentation errors and trailing
> whitespace. When I right click on them in eclipse and hit clean up I
> get the following error: "The resource is not on the include path of a
> javascript project"

Eclipse really doesn't have the smarts to understand complex js.  I'd
avoid doing the auto-formatting in those files.

Re: Coding Convention Reminder

Posted by Chip Childers <ch...@sungard.com>.
On Wed, Jul 03, 2013 at 09:48:51AM +0100, Ian Duffy wrote:
> Any suggestions for formatting the Javascript files? The few I've
> looked at seem to be riddled with indentation errors and trailing
> whitespace. When I right click on them in eclipse and hit clean up I
> get the following error: "The resource is not on the include path of a
> javascript project"

Eclipse really doesn't have the smarts to understand complex js.  I'd
avoid doing the auto-formatting in those files.

RE: Coding Convention Reminder

Posted by Alex Huang <Al...@citrix.com>.
I think the coding convention did not cover these.  It's a good time to update the wiki for python and javascript. 

--Alex

> -----Original Message-----
> From: Ian Duffy [mailto:ian@ianduffy.ie]
> Sent: Wednesday, July 3, 2013 1:49 AM
> To: dev@cloudstack.apache.org
> Subject: Re: Coding Convention Reminder
> 
> Any suggestions for formatting the Javascript files? The few I've looked at
> seem to be riddled with indentation errors and trailing whitespace. When I
> right click on them in eclipse and hit clean up I get the following error: "The
> resource is not on the include path of a javascript project"
> 
> Thanks!
> Ian
> 
> On 3 July 2013 07:36, Wido den Hollander <wi...@widodh.nl> wrote:
> > On 07/03/2013 12:11 AM, Alex Huang wrote:
> >>
> >> I like to remind everyone to review our coding conventions.  Our
> >> coding conventions have been going all over the place recently.
> >> Please take a look.
> >>
> >>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+convent
> >> ions
> >>
> >> I also like to propose that we extend the 120 column limit to 180 columns.
> >>
> >
> > +1 on that.
> >
> > It's not only line length, but I also still see a lot of trailing
> > spaces, tabs and empty lines with spaces.
> >
> > I'm not using Eclipse (hate it), so I'm using Kate on my Ubuntu
> > desktop which I find great to work with, but that's also completely
> configurable.
> >
> > Wido
> >
> >
> >> I recently was reading the following code.  If it followed even our
> >> current coding conventions, this would have been 11 lines but it ends
> >> up to be 23 lines, more than doubled.  The whole file was like this.
> >> Just thinking about all the extra scrolling I have to do makes my cts
> >> act up.  We are in the 21st century and using wide screen lcd
> >> monitors.  Let's not format our code to fit 80 column amber text screens
> please!
> >>
> >> What's worse is I've found that some people are actively breaking
> >> existing source code to 80 columns, causing a bunch of unnecessary
> merge activities.
> >> On Eclipse, you can actually set all types of formatting rules.  I
> >> can send out my epf (eclipse preferences file) if you don't want to
> >> deal with the trouble.
> >>                              DiskOfferingVO diskOffering =
> >> _diskOfferingDao
> >>                                      .findById(vol.getDiskOfferingId());
> >>                              if (diskOffering.getUseLocalStorage()) {
> >>                                  if (s_logger.isDebugEnabled()) {
> >>                                      s_logger.debug("Local volume "
> >>                                              + vol
> >>                                              + " will be recreated on
> >> storage pool "
> >>                                              + assignedPool
> >>                                              + " assigned by
> >> deploymentPlanner");
> >>                                  }
> >>                                  VolumeTask task = new
> >> VolumeTask(VolumeTaskType.RECREATE, vol, null);
> >>                                  tasks.add(task);
> >>                              } else {
> >>                                  if (s_logger.isDebugEnabled()) {
> >>                                      s_logger.debug("Shared volume "
> >>                                              + vol
> >>                                              + " will be migrated on
> >> storage pool "
> >>                                              + assignedPool
> >>                                              + " assigned by
> >> deploymentPlanner");
> >>                                  }
> >>                                  VolumeTask task = new
> >> VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
> >>                                  tasks.add(task);
> >>                              }
> >>
> >> Please be mindful of my cts.  Thanks for caring about my health!  :)
> >>
> >> --Alex
> >>
> >

Re: Coding Convention Reminder

Posted by Ian Duffy <ia...@ianduffy.ie>.
Any suggestions for formatting the Javascript files? The few I've
looked at seem to be riddled with indentation errors and trailing
whitespace. When I right click on them in eclipse and hit clean up I
get the following error: "The resource is not on the include path of a
javascript project"

Thanks!
Ian

On 3 July 2013 07:36, Wido den Hollander <wi...@widodh.nl> wrote:
> On 07/03/2013 12:11 AM, Alex Huang wrote:
>>
>> I like to remind everyone to review our coding conventions.  Our coding
>> conventions have been going all over the place recently.  Please take a
>> look.
>>
>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions
>>
>> I also like to propose that we extend the 120 column limit to 180 columns.
>>
>
> +1 on that.
>
> It's not only line length, but I also still see a lot of trailing spaces,
> tabs and empty lines with spaces.
>
> I'm not using Eclipse (hate it), so I'm using Kate on my Ubuntu desktop
> which I find great to work with, but that's also completely configurable.
>
> Wido
>
>
>> I recently was reading the following code.  If it followed even our
>> current coding conventions, this would have been 11 lines but it ends up to
>> be 23 lines, more than doubled.  The whole file was like this.  Just
>> thinking about all the extra scrolling I have to do makes my cts act up.  We
>> are in the 21st century and using wide screen lcd monitors.  Let's not
>> format our code to fit 80 column amber text screens please!
>>
>> What's worse is I've found that some people are actively breaking existing
>> source code to 80 columns, causing a bunch of unnecessary merge activities.
>> On Eclipse, you can actually set all types of formatting rules.  I can send
>> out my epf (eclipse preferences file) if you don't want to deal with the
>> trouble.
>>                              DiskOfferingVO diskOffering =
>> _diskOfferingDao
>>                                      .findById(vol.getDiskOfferingId());
>>                              if (diskOffering.getUseLocalStorage()) {
>>                                  if (s_logger.isDebugEnabled()) {
>>                                      s_logger.debug("Local volume "
>>                                              + vol
>>                                              + " will be recreated on
>> storage pool "
>>                                              + assignedPool
>>                                              + " assigned by
>> deploymentPlanner");
>>                                  }
>>                                  VolumeTask task = new
>> VolumeTask(VolumeTaskType.RECREATE, vol, null);
>>                                  tasks.add(task);
>>                              } else {
>>                                  if (s_logger.isDebugEnabled()) {
>>                                      s_logger.debug("Shared volume "
>>                                              + vol
>>                                              + " will be migrated on
>> storage pool "
>>                                              + assignedPool
>>                                              + " assigned by
>> deploymentPlanner");
>>                                  }
>>                                  VolumeTask task = new
>> VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
>>                                  tasks.add(task);
>>                              }
>>
>> Please be mindful of my cts.  Thanks for caring about my health!  :)
>>
>> --Alex
>>
>

Re: Coding Convention Reminder

Posted by Wido den Hollander <wi...@widodh.nl>.
On 07/03/2013 12:11 AM, Alex Huang wrote:
> I like to remind everyone to review our coding conventions.  Our coding conventions have been going all over the place recently.  Please take a look.
>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions
>
> I also like to propose that we extend the 120 column limit to 180 columns.
>

+1 on that.

It's not only line length, but I also still see a lot of trailing 
spaces, tabs and empty lines with spaces.

I'm not using Eclipse (hate it), so I'm using Kate on my Ubuntu desktop 
which I find great to work with, but that's also completely configurable.

Wido

> I recently was reading the following code.  If it followed even our current coding conventions, this would have been 11 lines but it ends up to be 23 lines, more than doubled.  The whole file was like this.  Just thinking about all the extra scrolling I have to do makes my cts act up.  We are in the 21st century and using wide screen lcd monitors.  Let's not format our code to fit 80 column amber text screens please!
>
> What's worse is I've found that some people are actively breaking existing source code to 80 columns, causing a bunch of unnecessary merge activities.  On Eclipse, you can actually set all types of formatting rules.  I can send out my epf (eclipse preferences file) if you don't want to deal with the trouble.
>                              DiskOfferingVO diskOffering = _diskOfferingDao
>                                      .findById(vol.getDiskOfferingId());
>                              if (diskOffering.getUseLocalStorage()) {
>                                  if (s_logger.isDebugEnabled()) {
>                                      s_logger.debug("Local volume "
>                                              + vol
>                                              + " will be recreated on storage pool "
>                                              + assignedPool
>                                              + " assigned by deploymentPlanner");
>                                  }
>                                  VolumeTask task = new VolumeTask(VolumeTaskType.RECREATE, vol, null);
>                                  tasks.add(task);
>                              } else {
>                                  if (s_logger.isDebugEnabled()) {
>                                      s_logger.debug("Shared volume "
>                                              + vol
>                                              + " will be migrated on storage pool "
>                                              + assignedPool
>                                              + " assigned by deploymentPlanner");
>                                  }
>                                  VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
>                                  tasks.add(task);
>                              }
>
> Please be mindful of my cts.  Thanks for caring about my health!  :)
>
> --Alex
>


RE: Coding Convention Reminder

Posted by Alex Huang <Al...@citrix.com>.
I checked it into tools/eclipse/eclipse.epf.

On Saving a file, it performs the following actions:
  - reorganizes imports to the following order: java, javax, org. com, org.apache.cloudstack. com.cloud.  This places all of the CloudStack imports at the bottom of the import list.
  - Removes all trailing white space
  - Removes unused imports
  - Reformats the EDITED portions of the file using the formatting rules.

It also enforces space for indent.  

--Alex

> -----Original Message-----
> From: Rajesh Battala [mailto:rajesh.battala@citrix.com]
> Sent: Tuesday, July 2, 2013 8:05 PM
> To: dev@cloudstack.apache.org
> Subject: RE: Coding Convention Reminder
> 
> +1. Please check-in the preferences file.
> 
> > -----Original Message-----
> > From: Vijayendra Bhamidipati
> > [mailto:vijayendra.bhamidipati@citrix.com]
> > Sent: Wednesday, July 3, 2013 5:58 AM
> > To: dev@cloudstack.apache.org
> > Subject: RE: Coding Convention Reminder
> >
> > +1 to checking in the epf file to source, will be good to have it as a
> > +reference
> > for those using other IDEs as well.
> >
> > Regards,
> > Vijay
> >
> > -----Original Message-----
> > From: Min Chen [mailto:min.chen@citrix.com]
> > Sent: Tuesday, July 02, 2013 5:21 PM
> > To: dev@cloudstack.apache.org
> > Subject: Re: Coding Convention Reminder
> >
> > +1. It is better to check in your eclipse.eps into git repo, so
> > +anybody
> > who checked out the CloudStack can access the preference file.
> >
> > -min
> >
> > On 7/2/13 5:17 PM, "Prachi Damle" <Pr...@citrix.com> wrote:
> >
> > >+ 1
> > >Please upload the code template for reference.
> > >
> > >-----Original Message-----
> > >From: Edison Su [mailto:Edison.su@citrix.com]
> > >Sent: Tuesday, July 02, 2013 5:08 PM
> > >To: dev@cloudstack.apache.org
> > >Subject: RE: Coding Convention Reminder
> > >
> > >We'd better export the code template from Eclipse, then everybody can
> > >import the template into their IDE, then possible, everybody will
> > >have the same configuration.
> > >
> > >> -----Original Message-----
> > >> From: Alex Huang [mailto:Alex.Huang@citrix.com]
> > >> Sent: Tuesday, July 02, 2013 3:11 PM
> > >> To: dev@cloudstack.apache.org
> > >> Subject: Coding Convention Reminder
> > >>
> > >> I like to remind everyone to review our coding conventions.  Our
> > >>coding conventions have been going all over the place recently.
> > >>Please take a look.
> > >>
> > >>
> >
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+convent
> > >> i
> > >> ons
> > >>
> > >> I also like to propose that we extend the 120 column limit to 180
> > >>columns.
> > >>
> > >> I recently was reading the following code.  If it followed even our
> > >> current coding conventions, this would have been 11 lines but it
> > >> ends up to be 23 lines, more than doubled.  The whole file was like this.
> > >> Just thinking about all the extra scrolling I have to do makes my
> > >> cts act up.  We are in the 21st century and using wide screen lcd
> > >> monitors.  Let's not format our code to fit
> > >> 80 column amber text screens please!
> > >>
> > >> What's worse is I've found that some people are actively breaking
> > >>existing source code to 80 columns, causing a bunch of unnecessary
> > >>merge activities.
> > >> On Eclipse, you can actually set all types of formatting rules.  I
> > >>can  send out my epf (eclipse preferences file) if you don't want to
> > >>deal with the trouble.
> > >>                             DiskOfferingVO diskOffering =
> > >>_diskOfferingDao
> > >>                                     .findById(vol.getDiskOfferingId());
> > >>                             if (diskOffering.getUseLocalStorage()) {
> > >>                                 if (s_logger.isDebugEnabled()) {
> > >>                                     s_logger.debug("Local volume "
> > >>                                             + vol
> > >>                                             + " will be recreated
> > >>on storage pool "
> > >>                                             + assignedPool
> > >>                                             + " assigned by
> > >>deploymentPlanner");
> > >>                                 }
> > >>                                 VolumeTask task = new
> > >>VolumeTask(VolumeTaskType.RECREATE, vol, null);
> > >>                                 tasks.add(task);
> > >>                             } else {
> > >>                                 if (s_logger.isDebugEnabled()) {
> > >>                                     s_logger.debug("Shared volume "
> > >>                                             + vol
> > >>                                             + " will be migrated on
> > >>storage pool "
> > >>                                             + assignedPool
> > >>                                             + " assigned by
> > >>deploymentPlanner");
> > >>                                 }
> > >>                                 VolumeTask task = new
> > >>VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
> > >>                                 tasks.add(task);
> > >>                             }
> > >>
> > >> Please be mindful of my cts.  Thanks for caring about my health!
> > >> :)
> > >>
> > >> --Alex


RE: Coding Convention Reminder

Posted by Rajesh Battala <ra...@citrix.com>.
+1. Please check-in the preferences file.

> -----Original Message-----
> From: Vijayendra Bhamidipati [mailto:vijayendra.bhamidipati@citrix.com]
> Sent: Wednesday, July 3, 2013 5:58 AM
> To: dev@cloudstack.apache.org
> Subject: RE: Coding Convention Reminder
> 
> +1 to checking in the epf file to source, will be good to have it as a reference
> for those using other IDEs as well.
> 
> Regards,
> Vijay
> 
> -----Original Message-----
> From: Min Chen [mailto:min.chen@citrix.com]
> Sent: Tuesday, July 02, 2013 5:21 PM
> To: dev@cloudstack.apache.org
> Subject: Re: Coding Convention Reminder
> 
> +1. It is better to check in your eclipse.eps into git repo, so anybody
> who checked out the CloudStack can access the preference file.
> 
> -min
> 
> On 7/2/13 5:17 PM, "Prachi Damle" <Pr...@citrix.com> wrote:
> 
> >+ 1
> >Please upload the code template for reference.
> >
> >-----Original Message-----
> >From: Edison Su [mailto:Edison.su@citrix.com]
> >Sent: Tuesday, July 02, 2013 5:08 PM
> >To: dev@cloudstack.apache.org
> >Subject: RE: Coding Convention Reminder
> >
> >We'd better export the code template from Eclipse, then everybody can
> >import the template into their IDE, then possible, everybody will have
> >the same configuration.
> >
> >> -----Original Message-----
> >> From: Alex Huang [mailto:Alex.Huang@citrix.com]
> >> Sent: Tuesday, July 02, 2013 3:11 PM
> >> To: dev@cloudstack.apache.org
> >> Subject: Coding Convention Reminder
> >>
> >> I like to remind everyone to review our coding conventions.  Our
> >>coding conventions have been going all over the place recently.
> >>Please take a look.
> >>
> >>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+convent
> >> i
> >> ons
> >>
> >> I also like to propose that we extend the 120 column limit to 180
> >>columns.
> >>
> >> I recently was reading the following code.  If it followed even our
> >> current coding conventions, this would have been 11 lines but it ends
> >> up to be 23 lines, more than doubled.  The whole file was like this.
> >> Just thinking about all the extra scrolling I have to do makes my cts
> >> act up.  We are in the 21st century and using wide screen lcd
> >> monitors.  Let's not format our code to fit
> >> 80 column amber text screens please!
> >>
> >> What's worse is I've found that some people are actively breaking
> >>existing source code to 80 columns, causing a bunch of unnecessary
> >>merge activities.
> >> On Eclipse, you can actually set all types of formatting rules.  I
> >>can  send out my epf (eclipse preferences file) if you don't want to
> >>deal with the trouble.
> >>                             DiskOfferingVO diskOffering =
> >>_diskOfferingDao
> >>                                     .findById(vol.getDiskOfferingId());
> >>                             if (diskOffering.getUseLocalStorage()) {
> >>                                 if (s_logger.isDebugEnabled()) {
> >>                                     s_logger.debug("Local volume "
> >>                                             + vol
> >>                                             + " will be recreated on
> >>storage pool "
> >>                                             + assignedPool
> >>                                             + " assigned by
> >>deploymentPlanner");
> >>                                 }
> >>                                 VolumeTask task = new
> >>VolumeTask(VolumeTaskType.RECREATE, vol, null);
> >>                                 tasks.add(task);
> >>                             } else {
> >>                                 if (s_logger.isDebugEnabled()) {
> >>                                     s_logger.debug("Shared volume "
> >>                                             + vol
> >>                                             + " will be migrated on
> >>storage pool "
> >>                                             + assignedPool
> >>                                             + " assigned by
> >>deploymentPlanner");
> >>                                 }
> >>                                 VolumeTask task = new
> >>VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
> >>                                 tasks.add(task);
> >>                             }
> >>
> >> Please be mindful of my cts.  Thanks for caring about my health!  :)
> >>
> >> --Alex


RE: Coding Convention Reminder

Posted by Vijayendra Bhamidipati <vi...@citrix.com>.
+1 to checking in the epf file to source, will be good to have it as a reference for those using other IDEs as well.

Regards,
Vijay

-----Original Message-----
From: Min Chen [mailto:min.chen@citrix.com] 
Sent: Tuesday, July 02, 2013 5:21 PM
To: dev@cloudstack.apache.org
Subject: Re: Coding Convention Reminder

+1. It is better to check in your eclipse.eps into git repo, so anybody
who checked out the CloudStack can access the preference file.

-min

On 7/2/13 5:17 PM, "Prachi Damle" <Pr...@citrix.com> wrote:

>+ 1
>Please upload the code template for reference.
>
>-----Original Message-----
>From: Edison Su [mailto:Edison.su@citrix.com]
>Sent: Tuesday, July 02, 2013 5:08 PM
>To: dev@cloudstack.apache.org
>Subject: RE: Coding Convention Reminder
>
>We'd better export the code template from Eclipse, then everybody can 
>import the template into their IDE, then possible, everybody will have 
>the same configuration.
>
>> -----Original Message-----
>> From: Alex Huang [mailto:Alex.Huang@citrix.com]
>> Sent: Tuesday, July 02, 2013 3:11 PM
>> To: dev@cloudstack.apache.org
>> Subject: Coding Convention Reminder
>> 
>> I like to remind everyone to review our coding conventions.  Our  
>>coding conventions have been going all over the place recently.  
>>Please take a look.
>> 
>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+convent
>> i
>> ons
>> 
>> I also like to propose that we extend the 120 column limit to 180 
>>columns.
>> 
>> I recently was reading the following code.  If it followed even our 
>> current coding conventions, this would have been 11 lines but it ends 
>> up to be 23 lines, more than doubled.  The whole file was like this.
>> Just thinking about all the extra scrolling I have to do makes my cts 
>> act up.  We are in the 21st century and using wide screen lcd 
>> monitors.  Let's not format our code to fit
>> 80 column amber text screens please!
>> 
>> What's worse is I've found that some people are actively breaking  
>>existing source code to 80 columns, causing a bunch of unnecessary 
>>merge activities.
>> On Eclipse, you can actually set all types of formatting rules.  I 
>>can  send out my epf (eclipse preferences file) if you don't want to 
>>deal with the trouble.
>>                             DiskOfferingVO diskOffering = 
>>_diskOfferingDao
>>                                     .findById(vol.getDiskOfferingId());
>>                             if (diskOffering.getUseLocalStorage()) {
>>                                 if (s_logger.isDebugEnabled()) {
>>                                     s_logger.debug("Local volume "
>>                                             + vol
>>                                             + " will be recreated on 
>>storage pool "
>>                                             + assignedPool
>>                                             + " assigned by 
>>deploymentPlanner");
>>                                 }
>>                                 VolumeTask task = new  
>>VolumeTask(VolumeTaskType.RECREATE, vol, null);
>>                                 tasks.add(task);
>>                             } else {
>>                                 if (s_logger.isDebugEnabled()) {
>>                                     s_logger.debug("Shared volume "
>>                                             + vol
>>                                             + " will be migrated on 
>>storage pool "
>>                                             + assignedPool
>>                                             + " assigned by 
>>deploymentPlanner");
>>                                 }
>>                                 VolumeTask task = new  
>>VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
>>                                 tasks.add(task);
>>                             }
>> 
>> Please be mindful of my cts.  Thanks for caring about my health!  :)
>> 
>> --Alex


Re: Coding Convention Reminder

Posted by Min Chen <mi...@citrix.com>.
+1. It is better to check in your eclipse.eps into git repo, so anybody
who checked out the CloudStack can access the preference file.

-min

On 7/2/13 5:17 PM, "Prachi Damle" <Pr...@citrix.com> wrote:

>+ 1
>Please upload the code template for reference.
>
>-----Original Message-----
>From: Edison Su [mailto:Edison.su@citrix.com]
>Sent: Tuesday, July 02, 2013 5:08 PM
>To: dev@cloudstack.apache.org
>Subject: RE: Coding Convention Reminder
>
>We'd better export the code template from Eclipse, then everybody can
>import the template into their IDE, then possible, everybody will have
>the same configuration.
>
>> -----Original Message-----
>> From: Alex Huang [mailto:Alex.Huang@citrix.com]
>> Sent: Tuesday, July 02, 2013 3:11 PM
>> To: dev@cloudstack.apache.org
>> Subject: Coding Convention Reminder
>> 
>> I like to remind everyone to review our coding conventions.  Our
>> coding conventions have been going all over the place recently.  Please
>>take a look.
>> 
>> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventi
>> ons
>> 
>> I also like to propose that we extend the 120 column limit to 180
>>columns.
>> 
>> I recently was reading the following code.  If it followed even our
>> current coding conventions, this would have been 11 lines but it ends
>> up to be 23 lines, more than doubled.  The whole file was like this.
>> Just thinking about all the extra scrolling I have to do makes my cts
>> act up.  We are in the 21st century and using wide screen lcd
>> monitors.  Let's not format our code to fit
>> 80 column amber text screens please!
>> 
>> What's worse is I've found that some people are actively breaking
>> existing source code to 80 columns, causing a bunch of unnecessary
>>merge activities.
>> On Eclipse, you can actually set all types of formatting rules.  I can
>> send out my epf (eclipse preferences file) if you don't want to deal
>>with the trouble.
>>                             DiskOfferingVO diskOffering =
>>_diskOfferingDao
>>                                     .findById(vol.getDiskOfferingId());
>>                             if (diskOffering.getUseLocalStorage()) {
>>                                 if (s_logger.isDebugEnabled()) {
>>                                     s_logger.debug("Local volume "
>>                                             + vol
>>                                             + " will be recreated on
>>storage pool "
>>                                             + assignedPool
>>                                             + " assigned by
>>deploymentPlanner");
>>                                 }
>>                                 VolumeTask task = new
>> VolumeTask(VolumeTaskType.RECREATE, vol, null);
>>                                 tasks.add(task);
>>                             } else {
>>                                 if (s_logger.isDebugEnabled()) {
>>                                     s_logger.debug("Shared volume "
>>                                             + vol
>>                                             + " will be migrated on
>>storage pool "
>>                                             + assignedPool
>>                                             + " assigned by
>>deploymentPlanner");
>>                                 }
>>                                 VolumeTask task = new
>> VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
>>                                 tasks.add(task);
>>                             }
>> 
>> Please be mindful of my cts.  Thanks for caring about my health!  :)
>> 
>> --Alex


RE: Coding Convention Reminder

Posted by Prachi Damle <Pr...@citrix.com>.
+ 1
Please upload the code template for reference.

-----Original Message-----
From: Edison Su [mailto:Edison.su@citrix.com] 
Sent: Tuesday, July 02, 2013 5:08 PM
To: dev@cloudstack.apache.org
Subject: RE: Coding Convention Reminder

We'd better export the code template from Eclipse, then everybody can import the template into their IDE, then possible, everybody will have the same configuration.

> -----Original Message-----
> From: Alex Huang [mailto:Alex.Huang@citrix.com]
> Sent: Tuesday, July 02, 2013 3:11 PM
> To: dev@cloudstack.apache.org
> Subject: Coding Convention Reminder
> 
> I like to remind everyone to review our coding conventions.  Our 
> coding conventions have been going all over the place recently.  Please take a look.
> 
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventi
> ons
> 
> I also like to propose that we extend the 120 column limit to 180 columns.
> 
> I recently was reading the following code.  If it followed even our 
> current coding conventions, this would have been 11 lines but it ends 
> up to be 23 lines, more than doubled.  The whole file was like this.  
> Just thinking about all the extra scrolling I have to do makes my cts 
> act up.  We are in the 21st century and using wide screen lcd 
> monitors.  Let's not format our code to fit
> 80 column amber text screens please!
> 
> What's worse is I've found that some people are actively breaking 
> existing source code to 80 columns, causing a bunch of unnecessary merge activities.
> On Eclipse, you can actually set all types of formatting rules.  I can 
> send out my epf (eclipse preferences file) if you don't want to deal with the trouble.
>                             DiskOfferingVO diskOffering = _diskOfferingDao
>                                     .findById(vol.getDiskOfferingId());
>                             if (diskOffering.getUseLocalStorage()) {
>                                 if (s_logger.isDebugEnabled()) {
>                                     s_logger.debug("Local volume "
>                                             + vol
>                                             + " will be recreated on storage pool "
>                                             + assignedPool
>                                             + " assigned by deploymentPlanner");
>                                 }
>                                 VolumeTask task = new 
> VolumeTask(VolumeTaskType.RECREATE, vol, null);
>                                 tasks.add(task);
>                             } else {
>                                 if (s_logger.isDebugEnabled()) {
>                                     s_logger.debug("Shared volume "
>                                             + vol
>                                             + " will be migrated on storage pool "
>                                             + assignedPool
>                                             + " assigned by deploymentPlanner");
>                                 }
>                                 VolumeTask task = new 
> VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
>                                 tasks.add(task);
>                             }
> 
> Please be mindful of my cts.  Thanks for caring about my health!  :)
> 
> --Alex

RE: Coding Convention Reminder

Posted by Edison Su <Ed...@citrix.com>.
We'd better export the code template from Eclipse, then everybody can import the template into their IDE, then possible, everybody will have the same configuration.

> -----Original Message-----
> From: Alex Huang [mailto:Alex.Huang@citrix.com]
> Sent: Tuesday, July 02, 2013 3:11 PM
> To: dev@cloudstack.apache.org
> Subject: Coding Convention Reminder
> 
> I like to remind everyone to review our coding conventions.  Our coding
> conventions have been going all over the place recently.  Please take a look.
> 
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventi
> ons
> 
> I also like to propose that we extend the 120 column limit to 180 columns.
> 
> I recently was reading the following code.  If it followed even our current
> coding conventions, this would have been 11 lines but it ends up to be 23
> lines, more than doubled.  The whole file was like this.  Just thinking about all
> the extra scrolling I have to do makes my cts act up.  We are in the 21st
> century and using wide screen lcd monitors.  Let's not format our code to fit
> 80 column amber text screens please!
> 
> What's worse is I've found that some people are actively breaking existing
> source code to 80 columns, causing a bunch of unnecessary merge activities.
> On Eclipse, you can actually set all types of formatting rules.  I can send out
> my epf (eclipse preferences file) if you don't want to deal with the trouble.
>                             DiskOfferingVO diskOffering = _diskOfferingDao
>                                     .findById(vol.getDiskOfferingId());
>                             if (diskOffering.getUseLocalStorage()) {
>                                 if (s_logger.isDebugEnabled()) {
>                                     s_logger.debug("Local volume "
>                                             + vol
>                                             + " will be recreated on storage pool "
>                                             + assignedPool
>                                             + " assigned by deploymentPlanner");
>                                 }
>                                 VolumeTask task = new
> VolumeTask(VolumeTaskType.RECREATE, vol, null);
>                                 tasks.add(task);
>                             } else {
>                                 if (s_logger.isDebugEnabled()) {
>                                     s_logger.debug("Shared volume "
>                                             + vol
>                                             + " will be migrated on storage pool "
>                                             + assignedPool
>                                             + " assigned by deploymentPlanner");
>                                 }
>                                 VolumeTask task = new
> VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
>                                 tasks.add(task);
>                             }
> 
> Please be mindful of my cts.  Thanks for caring about my health!  :)
> 
> --Alex