Hi Sajith, I guess we can use the same xml template for both eclipse and idea.I think both eclipse and idea as option to import xml based code formatting schema as well. I have tried the attached schema xml with both eclipse and idea.
I will check the one you tried(eclipse built-in one) with idea as well. Thanks, Gayan On Wed, Oct 1, 2014 at 5:15 PM, Sajith Kariyawasam <saj...@wso2.com> wrote: > I came up with the attached code format profile for Eclipse. This is based > on the Eclipse (built in) profile, and I modified lineSplit from 80 to 100 > and 4 Space indentation. Other default settings seems OK to me. > > Please share your thoughts > > Thanks, > Sajith > > On Wed, Oct 1, 2014 at 4:47 PM, Nirmal Fernando <nirmal070...@gmail.com> > wrote: > >> Guys, >> >> Did you all manage to create the formatter profiles? >> >> On Tue, Sep 23, 2014 at 11:59 AM, Nirmal Fernando <nirmal070...@gmail.com >> > wrote: >> >>> Thanks for the reminder Imesh. I've created a Jira for this >>> https://issues.apache.org/jira/browse/STRATOS-813 >>> >>> On Tue, Sep 23, 2014 at 10:31 AM, Imesh Gunaratne <im...@apache.org> >>> wrote: >>> >>>> It's nice to see everyone is focusing on $subject. I just went through >>>> the latest Sonar findings and seems like there are nearly 270 critical >>>> issues: >>>> >>>> >>>> https://analysis.apache.org/drilldown/issues/org.apache.stratos:stratos-parent?severity=CRITICAL >>>> >>>> We can go through the list and fix these issues, on the next build >>>> Sonar listing will get updated. >>>> >>>> On Mon, Sep 22, 2014 at 7:32 AM, Akila Ravihansa Perera < >>>> raviha...@wso2.com> wrote: >>>> >>>>> On Mon, Sep 22, 2014 at 4:39 PM, Isuru Perera <isu...@wso2.com> wrote: >>>>> > Hi everyone, >>>>> > >>>>> > I think we should agree on whether we should use tabs or spaces for >>>>> the >>>>> > indentation. >>>>> > >>>>> > I'm suggesting that we should use 4 spaces for the indentation and >>>>> > completely avoid tabs in our code. >>>>> >>>>> +1 >>>>> >>>>> Tabs can mess up the code when working with different developer >>>>> environments. >>>>> >>>>> >>>>> > >>>>> > I can help to come up with an Eclipse Formatter profile. We should >>>>> also >>>>> > format the entire code base in a single commit after we agree on our >>>>> coding >>>>> > standards. >>>>> >>>>> Great! I can work on a IntelliJ Idea Formatting profile. >>>>> >>>>> > >>>>> > WDYT? >>>>> > >>>>> > Thanks! >>>>> > >>>>> > Best Regards, >>>>> > >>>>> > >>>>> > On Tue, Sep 16, 2014 at 11:52 AM, Lakmal Warusawithana < >>>>> lak...@wso2.com> >>>>> > wrote: >>>>> >> >>>>> >> Hi, >>>>> >> >>>>> >> This is the guideline we used in WSO2, shall we have a look and see >>>>> >> whether we can use the same. Please share your thoughts. After we >>>>> finalised >>>>> >> will put this into wiki and make it as common guide line. >>>>> >> >>>>> >> Comments >>>>> >> >>>>> >> Doc comments >>>>> >> >>>>> >> All classes and all methods/functions MUST have doc comments >>>>> >> >>>>> >> Explain each parameter, return type and assumptions made >>>>> >> >>>>> >> Line comments >>>>> >> >>>>> >> In case you have complex logic, explain any genius logic, rationale >>>>> for >>>>> >> doing something >>>>> >> >>>>> >> >>>>> >> Logging >>>>> >> >>>>> >> Log then and there >>>>> >> >>>>> >> With ample local information and context >>>>> >> >>>>> >> Remember logs are for users. Make them meaningful, readable and >>>>> also make >>>>> >> sure you spell check (ispell) >>>>> >> >>>>> >> Use correct log level, e.g do not log errors as warnings or vice >>>>> versa >>>>> >> >>>>> >> Remember to log the error before throwing an exception >>>>> >> >>>>> >> >>>>> >> Logic >>>>> >> >>>>> >> Make your genius code readable >>>>> >> >>>>> >> Use meaningful variable names. Remember, compilers can handle long >>>>> >> variable names >>>>> >> >>>>> >> ________________________________ >>>>> >> >>>>> >> Variables declared in locality, as an when required >>>>> >> >>>>> >> The underscore character should be used only when declaring >>>>> constants, and >>>>> >> should not be used anywhere else in Java code >>>>> >> >>>>> >> Make sure the function/method names are self descriptive >>>>> >> >>>>> >> One should be able explain a function/method using a single sentence >>>>> >> without conjunctions (that is no and/or in description) >>>>> >> >>>>> >> Have proper separation of concerns >>>>> >> >>>>> >> Check if you do multiple things in a function >>>>> >> >>>>> >> Too many parameters are smelly, indicates that something is wrong >>>>> >> >>>>> >> Use variables to capture status and return at the end whenever >>>>> possible >>>>> >> >>>>> >> Avoid status returning from multiple places, that makes code less >>>>> readable >>>>> >> >>>>> >> Be consistent in managing state e.g. Initialize to FALSE and set to >>>>> TRUE >>>>> >> everywhere else >>>>> >> >>>>> >> Where does that if block end, or what block did you end right now? >>>>> Have a >>>>> >> comment at end of a block at } >>>>> >> >>>>> >> Use if statements rationally, ensure the behavior is homogeneous >>>>> >> >>>>> >> In case of returning a collection, must return an empty collection >>>>> and not >>>>> >> null (or NULL) >>>>> >> >>>>> >> Do not use interfaces to declare constants. Use a final class with >>>>> public >>>>> >> static final attributes and a private constructor. >>>>> >> >>>>> >> Always use braces to surround code blocks ({}) even if it is a >>>>> single >>>>> >> line. >>>>> >> >>>>> >> Break code into multiple lines if it exceeds 100 columns >>>>> >> >>>>> >> Align method parameters, exception etc. in order to improve >>>>> readability. >>>>> >> Use the settings in your IDE to do this. >>>>> >> >>>>> >> Be sure to define, who should catch an exception when throwing one >>>>> >> >>>>> >> Be sure to catch those exceptions that you can handle >>>>> >> >>>>> >> Do not use string literals in the code, instead declare constants >>>>> and use >>>>> >> them, constant names should be self descriptive >>>>> >> >>>>> >> Use constants already defined whenever possible, check to see if >>>>> someone >>>>> >> already declared one, specially in base libs, like Axis2 >>>>> >> >>>>> >> >>>>> >> Java Specific >>>>> >> >>>>> >> Coding conventions - >>>>> >> http://www.oracle.com/technetwork/java/codeconv-138413.html >>>>> >> >>>>> >> Only exception is line length, we use 100 >>>>> >> >>>>> >> Run FindBugs on your code - http://findbugs.sourceforge.net/ >>>>> >> >>>>> >> Use CONSTANT_VALUE.equals(variable_name) to avoid null pointer >>>>> exceptions >>>>> >> >>>>> >> IMPORTANT >>>>> >> >>>>> >> You should run FindBugs on your new code or modified code, and >>>>> commit only >>>>> >> after fixing any bugs reported by FindBugs. It is recommended to >>>>> use the >>>>> >> IntellijIDEA (FindBugs-IDEA) or Eclipse FindBugs plugin to do this. >>>>> >> >>>>> >> >>>>> >> >>>>> >> -- >>>>> >> Lakmal Warusawithana >>>>> >> Vice President, Apache Stratos >>>>> >> Director - Cloud Architecture; WSO2 Inc. >>>>> >> Mobile : +94714289692 >>>>> >> Blog : http://lakmalsview.blogspot.com/ >>>>> >> >>>>> > >>>>> > >>>>> > >>>>> > -- >>>>> > Isuru Perera >>>>> > Senior Software Engineer | WSO2, Inc. | http://wso2.com/ >>>>> > Lean . Enterprise . Middleware >>>>> > >>>>> > about.me/chrishantha >>>>> >>>>> >>>>> >>>>> -- >>>>> Akila Ravihansa Perera >>>>> Software Engineer, WSO2 >>>>> >>>>> Blog: http://ravihansa3000.blogspot.com >>>>> >>>> >>>> >>>> >>>> -- >>>> Imesh Gunaratne >>>> >>>> Technical Lead, WSO2 >>>> Committer & PMC Member, Apache Stratos >>>> >>> >>> >>> >>> -- >>> Best Regards, >>> Nirmal >>> >>> Nirmal Fernando. >>> PPMC Member & Committer of Apache Stratos, >>> Senior Software Engineer, WSO2 Inc. >>> >>> Blog: http://nirmalfdo.blogspot.com/ >>> >> >> >> >> -- >> Best Regards, >> Nirmal >> >> Nirmal Fernando. >> PPMC Member & Committer of Apache Stratos, >> Senior Software Engineer, WSO2 Inc. >> >> Blog: http://nirmalfdo.blogspot.com/ >> > > > > -- > *Sajith Kariyawasam* > > > *Committer and PMC member, Apache Stratos,WSO2 Inc., http://wso2.com > <http://wso2.com>AMIE (SL)Mobile: +94772269575* > -- Best Regards, Gayan Gunarathne Technical Lead WSO2 Inc. (http://wso2.com) email : gay...@wso2.com | mobile : +94 766819985
<?xml version="1.0" encoding="UTF-8"?> <code_scheme name="Default (1)"> <option name="JAVA_INDENT_OPTIONS"> <value> <option name="INDENT_SIZE" value="4" /> <option name="CONTINUATION_INDENT_SIZE" value="8" /> <option name="TAB_SIZE" value="4" /> <option name="USE_TAB_CHARACTER" value="false" /> <option name="SMART_TABS" value="true" /> <option name="LABEL_INDENT_SIZE" value="0" /> <option name="LABEL_INDENT_ABSOLUTE" value="false" /> </value> </option> <option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" /> <option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" /> <option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" /> <option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" /> <option name="ALIGN_MULTILINE_THROWS_LIST" value="true" /> <option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" /> <option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" /> <option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" /> <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="50" /> <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="50" /> <option name="RIGHT_MARGIN" value="100" /> <option name="METHOD_PARAMETERS_WRAP" value="1" /> <option name="EXTENDS_LIST_WRAP" value="1" /> <option name="THROWS_LIST_WRAP" value="1" /> <option name="EXTENDS_KEYWORD_WRAP" value="1" /> <option name="THROWS_KEYWORD_WRAP" value="1" /> <option name="IF_BRACE_FORCE" value="3" /> <option name="DOWHILE_BRACE_FORCE" value="3" /> <option name="WHILE_BRACE_FORCE" value="3" /> <option name="FOR_BRACE_FORCE" value="3" /> <option name="HTML_ALIGN_TEXT" value="true" /> <ADDITIONAL_INDENT_OPTIONS fileType="java"> <option name="INDENT_SIZE" value="4" /> <option name="CONTINUATION_INDENT_SIZE" value="8" /> <option name="TAB_SIZE" value="4" /> <option name="USE_TAB_CHARACTER" value="false" /> <option name="SMART_TABS" value="true" /> <option name="LABEL_INDENT_SIZE" value="0" /> <option name="LABEL_INDENT_ABSOLUTE" value="false" /> </ADDITIONAL_INDENT_OPTIONS> <ADDITIONAL_INDENT_OPTIONS fileType="js"> <option name="INDENT_SIZE" value="4" /> <option name="CONTINUATION_INDENT_SIZE" value="8" /> <option name="TAB_SIZE" value="4" /> <option name="USE_TAB_CHARACTER" value="false" /> <option name="SMART_TABS" value="false" /> <option name="LABEL_INDENT_SIZE" value="0" /> <option name="LABEL_INDENT_ABSOLUTE" value="false" /> </ADDITIONAL_INDENT_OPTIONS> <ADDITIONAL_INDENT_OPTIONS fileType="jsp"> <option name="INDENT_SIZE" value="4" /> <option name="CONTINUATION_INDENT_SIZE" value="8" /> <option name="TAB_SIZE" value="4" /> <option name="USE_TAB_CHARACTER" value="false" /> <option name="SMART_TABS" value="false" /> <option name="LABEL_INDENT_SIZE" value="0" /> <option name="LABEL_INDENT_ABSOLUTE" value="false" /> </ADDITIONAL_INDENT_OPTIONS> <ADDITIONAL_INDENT_OPTIONS fileType="xml"> <option name="INDENT_SIZE" value="4" /> <option name="CONTINUATION_INDENT_SIZE" value="8" /> <option name="TAB_SIZE" value="4" /> <option name="USE_TAB_CHARACTER" value="false" /> <option name="SMART_TABS" value="false" /> <option name="LABEL_INDENT_SIZE" value="0" /> <option name="LABEL_INDENT_ABSOLUTE" value="false" /> </ADDITIONAL_INDENT_OPTIONS> </code_scheme>
<?xml version="1.0" encoding="UTF-8"?> <profiles version="2"> <profile kind="CleanUpProfile" name="Apache-Startos" version="2"> <setting id="cleanup.format_source_code" value="false"/> <setting id="cleanup.add_missing_annotations" value="true"/> <setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/> <setting id="cleanup.remove_unused_private_types" value="true"/> <setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/> <setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/> <setting id="cleanup.add_generated_serial_version_id" value="false"/> <setting id="cleanup.make_variable_declarations_final" value="false"/> <setting id="cleanup.add_missing_methods" value="true"/> <setting id="cleanup.always_use_this_for_non_static_field_access" value="false"/> <setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/> <setting id="cleanup.correct_indentation" value="true"/> <setting id="cleanup.never_use_parentheses_in_expressions" value="true"/> <setting id="cleanup.add_serial_version_id" value="false"/> <setting id="cleanup.remove_unused_private_methods" value="true"/> <setting id="cleanup.use_this_for_non_static_field_access" value="false"/> <setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/> <setting id="cleanup.remove_unused_private_members" value="false"/> <setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/> <setting id="cleanup.remove_trailing_whitespaces_all" value="true"/> <setting id="cleanup.make_type_abstract_if_missing_method" value="false"/> <setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/> <setting id="cleanup.remove_unnecessary_nls_tags" value="true"/> <setting id="cleanup.format_source_code_changes_only" value="false"/> <setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/> <setting id="cleanup.add_missing_nls_tags" value="false"/> <setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="true"/> <setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/> <setting id="cleanup.remove_unnecessary_casts" value="true"/> <setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/> <setting id="cleanup.use_parentheses_in_expressions" value="true"/> <setting id="cleanup.remove_unused_private_fields" value="true"/> <setting id="cleanup.make_parameters_final" value="false"/> <setting id="cleanup.remove_trailing_whitespaces" value="true"/> <setting id="cleanup.remove_unused_imports" value="false"/> <setting id="cleanup.organize_imports" value="false"/> <setting id="cleanup.sort_members" value="false"/> <setting id="cleanup.remove_private_constructors" value="true"/> <setting id="cleanup.convert_to_enhanced_for_loop" value="true"/> <setting id="cleanup.always_use_blocks" value="true"/> <setting id="cleanup.never_use_blocks" value="false"/> <setting id="cleanup.always_use_parentheses_in_expressions" value="false"/> <setting id="cleanup.use_this_for_non_static_method_access" value="false"/> <setting id="cleanup.remove_unused_local_variables" value="false"/> <setting id="cleanup.make_private_fields_final" value="true"/> <setting id="cleanup.add_missing_deprecated_annotations" value="true"/> <setting id="cleanup.add_default_serial_version_id" value="true"/> <setting id="cleanup.sort_members_all" value="false"/> <setting id="cleanup.use_blocks" value="true"/> <setting id="cleanup.add_missing_override_annotations" value="true"/> <setting id="cleanup.make_local_variable_final" value="true"/> </profile> </profiles>