on 10-27-2018 11:18 AM
Hi,
We wanted to set up the SAP hybris Java Code conventions for our project. Before SAP Hybris recommended the configuration below : https://wiki.hybris.com/display/generalArchive/hybris+Ee+Reference file : https://svn.hybris.de/misc/codeconventions/trunk/eesettings/hybrisJavaCodeconventions.xml
But the page is now archive. Does it mean that is not valuable anymore? For information all my previous Hybris project used hybrisJavaCodeconventions.xml.
Do you recommend another convention one today or we can continue to use the same ?
Is-it possible to have the same page hybris Ee Reference in the wiki/help for new project ?
There is no doubt that the recommendations mentioned in https://wiki.hybris.com/display/generalArchive/hybris+Ee+Reference are still valid. I can not comment anything about https://svn.hybris.de/misc/codeconventions/trunk/eesettings/hybrisJavaCodeconventions.xml as it is not accessible to me.
IMHO, the best thing to follow is the code quality recommendations from hybrisALF documented at https://wiki.hybris.com/display/hybrisALF/Code+Quality and if you are going to setup sonar, you can download https://wiki.hybris.com/download/attachments/329566632/java-hybris-profile-public.xml?version=2&modi...
Please take a note of the following paragraph mentioned at https://wiki.hybris.com/display/hybrisALF/Measuring+Code+Quality+with+Sonar
With the release of SAP Hybris Commerce 6.6 and going forward, there is now a SonarQube Quality Profile embedded in the platform download. The next step refers to its location. Even if you are not running SAP Hybris Commerce 6.6+, it is recommended that you at least download it to get access to this file.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your answer.
Got it for code quality. I have already seen all these pages
My question was more about the java convention format with the file hybrisJavaCodeconventions.xml
Do we should continue to use this convention ? For example : curly brackets under method signature or at the same line?
public void methodeName(final String parameterName) {
It's up to your project's decision whether the developers should put {
in the same line after )
of the method signature or in the next line after )
of the method signature, but most important thing is to be consistent. However, for such a thing, I have always gone with hybris way of coding style i.e. pick any of the .java files from the hybris supplied source code and make it a rule in the ruleset to be used by the whole project.
OK,
Thank you for your answer.
Same as me, I have always gone with Hybris way of coding style and I was thinking to keep it for this new project but on the other hand I don't want to impose something to developers that is not anymore valid.
I meet a Hybris consultant tomorrow, I will see what is his advice.
Thank you for all!
Very good! I like this answer...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi - please follow the section, Naming Conventions at https://www.oracle.com/technetwork/articles/java/code-convention-138726.html for JSP Names and Tag Names
It is recommended to name the CSS and JS files in all lower case. Please check section, Use Lower Case File Names at https://www.w3schools.com/js/js_conventions.asp for more details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
tks! I had already reviewed these links; but you do not say anything about file names; if not of its structure. My question is: just as in Java we use the camel notation in class names, we must use it in the names of the .jsp and .tag and .js files, etc.
For example: petcoStocktAlertAction.jsp or petcostockalertaction.jsp
another case: categoryDefault.tag or categoryDEFAULT.tag
That's where my doubts go!
As per the convention,
The name of your .jsp file should be petcoStocktAlertAction.jsp
The name of your .tag file should be categoryDefault.tag
The name of a .js file should be in all lower case e.g. imagegallery.js
By the way, it looks like you missed to go through the sections in the links that I have mentioned 🙂 because similar examples are also mentioned in those sections.
Naming conventions for jsp and tag file implementations
The names of the files jsp, tag and others like javascript and css must respect the camel notation in its file name?
Help!
Amy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You seemed to be concerned about "hybrisJavaCodeconventions.xml" or source code formatting. The hybris Ee Reference you mentioned is already archived. So, I think you can take it as reference only. Take note that "hybrisJavaCodeconventions.xml" was designed / prepared at a time when Hybris still wasn't owned by SAP.
The latest guide is under Development Tools > IDE in the ALF. "Same Source Formatting Configuration" simply says:
In order to ensure a certain homogeneity of the source files and to facilitate the merging of source files, all project developers must strictly use the same formatting for all sources files. For teams using multiple IDEs it's important to keep the code style consistent as possible.
In order to make sure the source formatting is consistent it is recommended to configure save actions.
Further below, it tells you where you can customize these settings, and how you can export these settings so you can share it with the Team.
From my understanding, the code formatting simply depends on the project or company, since each project may have their own styles. If you already have an existing style, you can reuse it. However, I think that other Coding Standards should still be followed / observed; these standards have nothing to do with code formatting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.