Home » Archived » B3 » b3 coding rules updated
b3 coding rules updated [message #527787] |
Fri, 16 April 2010 13:36 |
Filip Hrbek Messages: 233 Registered: July 2009 |
Senior Member |
|
|
Hi,
I have updated coding rules (style, cleanup, formatting).
Anyone who is developing b3 bundles should do following:
1) Download new workspace template from http://wiki.eclipse.org/images/2/26/B3_workspace_template_ar chive.zip
2) Create a new workspace from this template
3) Populate b3 source code (note - non-aggregator bundles are temporarily excluded from releng since they are currently unresolvable, rmap needs to be updated)
5) Update all projects from SVN (they will get all necessary project specific settings)
I think that this step is quite important to avoid possible merge conflicts in future.
Good news:
Since Eclipse 3.6M6 there's a new feature in code formatter that I like very much! Developers have been waiting for it since 2002 and finally it's there!
The formatter enables declaration of formatting off/on tags. I set up "@fmtOff" and "@fmtOn" tags in the b3 workspace template. How does it work?
Here's an example:
------
/**
* This code is fully formatted
*/
public void doSomethingUseful(String message) {
// @fmtOff
// This section is not formatted because I like 4 elements
// in each row
private String[] numbers = new String[] {
"One", "Two", "Three", "Four",
"Five", "Six", "Seven", "Eight"
};
// @fmtOn
// TODO This is for debugging only, remove it
// @fmtOff
// This section is not formatted because I don't want to happen
// what you can see in the next example
/*
for(int i=numbers.length-1; i >= 0; i-- {
System.out.println(numbers[i]);
}
*/
// @fmtOn
// This section is formatted which is not good - it is difficult to
// restore the testing code
/*
* for(int i=numbers.length-1; i >= 0; i-- {
* System.out.println(numbers[i]);
* }
*/
}
------
Notes:
If you don't want to keep using your current workspace, it should be enough to extract " .metadata/.plugins/org.eclipse.core.runtime/.settings/org.ec lipse.jdt.ui.prefs " from the template and replace the respective file in your workspace with it (please backup your original file first for case something is wrong with the new one).
Question (for the most active committer, i.e. Henrik):
Can I commit cleaned up sources for everything in b3 that is non-aggregator? I've set up all bundles but I have committed only aggregator related bundles so far.
Everything compiles OK but I don't know how to test the functionality.
Filip
|
|
|
Re: b3 coding rules updated [message #527880 is a reply to message #527787] |
Fri, 16 April 2010 17:52 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
Non aggregator code should follow same rules and be cleaned up. I think
there are still isues with code generation and formatting.
It is imortant to test that generation foes nit cause non formatted and
organized code to be checked in.
To run the tests, there is a testproject and a junit launch config that
runs all b3 tests. There should be 2 failures at present (known issues).
(ask Michal if it is unclear)
- Henrik
Filip Hrbek <filip.hrbek@cloudsmith.com> wrote:
> Hi,
>
> I have updated coding rules (style, cleanup, formatting).
>
> Anyone who is developing b3 bundles should do following:
>
> 1) Download new workspace template from
> http://wiki.eclipse.org/images/2/26/B3_workspace_template_ar chive.zip
> 2) Create a new workspace from this template
> 3) Populate b3 source code (note - non-aggregator bundles are
> temporarily excluded from releng since they are currently
> unresolvable, rmap needs to be updated)
> 5) Update all projects from SVN (they will get all necessary project
> specific settings)
>
> I think that this step is quite important to avoid possible merge
> conflicts in future.
>
> Good news:
> Since Eclipse 3.6M6 there's a new feature in code formatter that I
> like very much! Developers have been waiting for it since 2002 and
> finally it's there!
> The formatter enables declaration of formatting off/on tags. I set up
> "@fmtOff" and "@fmtOn" tags in the b3 workspace template. How does it
> work?
> Here's an example:
>
> ------
>
> /**
> * This code is fully formatted
> */
> public void doSomethingUseful(String message) {
>
> // @fmtOff
> // This section is not formatted because I like 4 elements
> // in each row
> private String[] numbers = new String[] {
> "One", "Two", "Three", "Four",
> "Five", "Six", "Seven", "Eight"
> };
> // @fmtOn
>
> // TODO This is for debugging only, remove it
> // @fmtOff
> // This section is not formatted because I don't want to happen
> // what you can see in the next example
> /*
> for(int i=numbers.length-1; i >= 0; i-- {
> System.out.println(numbers[i]);
> }
> */
> // @fmtOn
>
> // This section is formatted which is not good - it is difficult
> to
> // restore the testing code
> /*
> * for(int i=numbers.length-1; i >= 0; i-- {
> * System.out.println(numbers[i]);
> * }
> */
>
> }
>
> ------
>
>
> Notes:
> If you don't want to keep using your current workspace, it should be
> enough to extract
> " .metadata/.plugins/org.eclipse.core.runtime/.settings/org.ec lipse.jdt.ui.prefs "
> from the template and replace the respective file in your workspace
> with it (please backup your original file first for case something is
> wrong with the new one).
>
> Question (for the most active committer, i.e. Henrik):
>
> Can I commit cleaned up sources for everything in b3 that is
> non-aggregator? I've set up all bundles but I have committed only
> aggregator related bundles so far.
> Everything compiles OK but I don't know how to test the functionality.
>
> Filip
>
--
- henrik
|
|
|
Re: b3 coding rules updated [message #528453 is a reply to message #527880] |
Tue, 20 April 2010 15:01 |
Filip Hrbek Messages: 233 Registered: July 2009 |
Senior Member |
|
|
I ran the beelang tests and got 2 failures (which is correct).
Then I checked in all the formatting changes.
If there are problems with auto formating after code generation, I recommend running Source -> Cleanup on each project before it is checked in.
I also made yet another change to the workspace template. I enabled longer comments to avoid a bug in auto formating of comments (I'll check if there's already a bugzilla issue for this, if not, I will write one).
Filip
Henrik Lindberg wrote:
> Non aggregator code should follow same rules and be cleaned up. I think
> there are still isues with code generation and formatting.
> It is imortant to test that generation foes nit cause non formatted and
> organized code to be checked in.
>
> To run the tests, there is a testproject and a junit launch config that
> runs all b3 tests. There should be 2 failures at present (known issues).
> (ask Michal if it is unclear)
>
> - Henrik
> Filip Hrbek<filip.hrbek@cloudsmith.com> wrote:
>> Hi,
>>
>> I have updated coding rules (style, cleanup, formatting).
>>
>> Anyone who is developing b3 bundles should do following:
>>
>> 1) Download new workspace template from
>> http://wiki.eclipse.org/images/2/26/B3_workspace_template_ar chive.zip
>> 2) Create a new workspace from this template
>> 3) Populate b3 source code (note - non-aggregator bundles are
>> temporarily excluded from releng since they are currently
>> unresolvable, rmap needs to be updated)
>> 5) Update all projects from SVN (they will get all necessary project
>> specific settings)
>>
>> I think that this step is quite important to avoid possible merge
>> conflicts in future.
>>
>> Good news:
>> Since Eclipse 3.6M6 there's a new feature in code formatter that I
>> like very much! Developers have been waiting for it since 2002 and
>> finally it's there!
>> The formatter enables declaration of formatting off/on tags. I set up
>> "@fmtOff" and "@fmtOn" tags in the b3 workspace template. How does it
>> work?
>> Here's an example:
>>
>> ------
>>
>> /**
>> * This code is fully formatted
>> */
>> public void doSomethingUseful(String message) {
>>
>> // @fmtOff
>> // This section is not formatted because I like 4 elements
>> // in each row
>> private String[] numbers = new String[] {
>> "One", "Two", "Three", "Four",
>> "Five", "Six", "Seven", "Eight"
>> };
>> // @fmtOn
>>
>> // TODO This is for debugging only, remove it
>> // @fmtOff
>> // This section is not formatted because I don't want to happen
>> // what you can see in the next example
>> /*
>> for(int i=numbers.length-1; i>= 0; i-- {
>> System.out.println(numbers[i]);
>> }
>> */
>> // @fmtOn
>>
>> // This section is formatted which is not good - it is difficult
>> to
>> // restore the testing code
>> /*
>> * for(int i=numbers.length-1; i>= 0; i-- {
>> * System.out.println(numbers[i]);
>> * }
>> */
>>
>> }
>>
>> ------
>>
>>
>> Notes:
>> If you don't want to keep using your current workspace, it should be
>> enough to extract
>> " .metadata/.plugins/org.eclipse.core.runtime/.settings/org.ec lipse.jdt.ui.prefs "
>> from the template and replace the respective file in your workspace
>> with it (please backup your original file first for case something is
>> wrong with the new one).
>>
>> Question (for the most active committer, i.e. Henrik):
>>
>> Can I commit cleaned up sources for everything in b3 that is
>> non-aggregator? I've set up all bundles but I have committed only
>> aggregator related bundles so far.
>> Everything compiles OK but I don't know how to test the functionality.
>>
>> Filip
>>
>
>
|
|
|
Re: b3 coding rules updated [message #603737 is a reply to message #527787] |
Fri, 16 April 2010 17:52 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
Non aggregator code should follow same rules and be cleaned up. I think
there are still isues with code generation and formatting.
It is imortant to test that generation foes nit cause non formatted and
organized code to be checked in.
To run the tests, there is a testproject and a junit launch config that
runs all b3 tests. There should be 2 failures at present (known issues).
(ask Michal if it is unclear)
- Henrik
Filip Hrbek <filip.hrbek@cloudsmith.com> wrote:
> Hi,
>
> I have updated coding rules (style, cleanup, formatting).
>
> Anyone who is developing b3 bundles should do following:
>
> 1) Download new workspace template from
> http://wiki.eclipse.org/images/2/26/B3_workspace_template_ar chive.zip
> 2) Create a new workspace from this template
> 3) Populate b3 source code (note - non-aggregator bundles are
> temporarily excluded from releng since they are currently
> unresolvable, rmap needs to be updated)
> 5) Update all projects from SVN (they will get all necessary project
> specific settings)
>
> I think that this step is quite important to avoid possible merge
> conflicts in future.
>
> Good news:
> Since Eclipse 3.6M6 there's a new feature in code formatter that I
> like very much! Developers have been waiting for it since 2002 and
> finally it's there!
> The formatter enables declaration of formatting off/on tags. I set up
> "@fmtOff" and "@fmtOn" tags in the b3 workspace template. How does it
> work?
> Here's an example:
>
> ------
>
> /**
> * This code is fully formatted
> */
> public void doSomethingUseful(String message) {
>
> // @fmtOff
> // This section is not formatted because I like 4 elements
> // in each row
> private String[] numbers = new String[] {
> "One", "Two", "Three", "Four",
> "Five", "Six", "Seven", "Eight"
> };
> // @fmtOn
>
> // TODO This is for debugging only, remove it
> // @fmtOff
> // This section is not formatted because I don't want to happen
> // what you can see in the next example
> /*
> for(int i=numbers.length-1; i >= 0; i-- {
> System.out.println(numbers[i]);
> }
> */
> // @fmtOn
>
> // This section is formatted which is not good - it is difficult
> to
> // restore the testing code
> /*
> * for(int i=numbers.length-1; i >= 0; i-- {
> * System.out.println(numbers[i]);
> * }
> */
>
> }
>
> ------
>
>
> Notes:
> If you don't want to keep using your current workspace, it should be
> enough to extract
> " .metadata/.plugins/org.eclipse.core.runtime/.settings/org.ec lipse.jdt.ui.prefs "
> from the template and replace the respective file in your workspace
> with it (please backup your original file first for case something is
> wrong with the new one).
>
> Question (for the most active committer, i.e. Henrik):
>
> Can I commit cleaned up sources for everything in b3 that is
> non-aggregator? I've set up all bundles but I have committed only
> aggregator related bundles so far.
> Everything compiles OK but I don't know how to test the functionality.
>
> Filip
>
--
- henrik
|
|
|
Re: b3 coding rules updated [message #603755 is a reply to message #527880] |
Tue, 20 April 2010 15:01 |
Filip Hrbek Messages: 233 Registered: July 2009 |
Senior Member |
|
|
I ran the beelang tests and got 2 failures (which is correct).
Then I checked in all the formatting changes.
If there are problems with auto formating after code generation, I recommend running Source -> Cleanup on each project before it is checked in.
I also made yet another change to the workspace template. I enabled longer comments to avoid a bug in auto formating of comments (I'll check if there's already a bugzilla issue for this, if not, I will write one).
Filip
Henrik Lindberg wrote:
> Non aggregator code should follow same rules and be cleaned up. I think
> there are still isues with code generation and formatting.
> It is imortant to test that generation foes nit cause non formatted and
> organized code to be checked in.
>
> To run the tests, there is a testproject and a junit launch config that
> runs all b3 tests. There should be 2 failures at present (known issues).
> (ask Michal if it is unclear)
>
> - Henrik
> Filip Hrbek<filip.hrbek@cloudsmith.com> wrote:
>> Hi,
>>
>> I have updated coding rules (style, cleanup, formatting).
>>
>> Anyone who is developing b3 bundles should do following:
>>
>> 1) Download new workspace template from
>> http://wiki.eclipse.org/images/2/26/B3_workspace_template_ar chive.zip
>> 2) Create a new workspace from this template
>> 3) Populate b3 source code (note - non-aggregator bundles are
>> temporarily excluded from releng since they are currently
>> unresolvable, rmap needs to be updated)
>> 5) Update all projects from SVN (they will get all necessary project
>> specific settings)
>>
>> I think that this step is quite important to avoid possible merge
>> conflicts in future.
>>
>> Good news:
>> Since Eclipse 3.6M6 there's a new feature in code formatter that I
>> like very much! Developers have been waiting for it since 2002 and
>> finally it's there!
>> The formatter enables declaration of formatting off/on tags. I set up
>> "@fmtOff" and "@fmtOn" tags in the b3 workspace template. How does it
>> work?
>> Here's an example:
>>
>> ------
>>
>> /**
>> * This code is fully formatted
>> */
>> public void doSomethingUseful(String message) {
>>
>> // @fmtOff
>> // This section is not formatted because I like 4 elements
>> // in each row
>> private String[] numbers = new String[] {
>> "One", "Two", "Three", "Four",
>> "Five", "Six", "Seven", "Eight"
>> };
>> // @fmtOn
>>
>> // TODO This is for debugging only, remove it
>> // @fmtOff
>> // This section is not formatted because I don't want to happen
>> // what you can see in the next example
>> /*
>> for(int i=numbers.length-1; i>= 0; i-- {
>> System.out.println(numbers[i]);
>> }
>> */
>> // @fmtOn
>>
>> // This section is formatted which is not good - it is difficult
>> to
>> // restore the testing code
>> /*
>> * for(int i=numbers.length-1; i>= 0; i-- {
>> * System.out.println(numbers[i]);
>> * }
>> */
>>
>> }
>>
>> ------
>>
>>
>> Notes:
>> If you don't want to keep using your current workspace, it should be
>> enough to extract
>> " .metadata/.plugins/org.eclipse.core.runtime/.settings/org.ec lipse.jdt.ui.prefs "
>> from the template and replace the respective file in your workspace
>> with it (please backup your original file first for case something is
>> wrong with the new one).
>>
>> Question (for the most active committer, i.e. Henrik):
>>
>> Can I commit cleaned up sources for everything in b3 that is
>> non-aggregator? I've set up all bundles but I have committed only
>> aggregator related bundles so far.
>> Everything compiles OK but I don't know how to test the functionality.
>>
>> Filip
>>
>
>
|
|
|
Goto Forum:
Current Time: Sat Nov 09 02:41:58 GMT 2024
Powered by FUDForum. Page generated in 0.03398 seconds
|