diff --git a/community/contribute/eclipse-ide.adoc b/community/contribute/eclipse-ide.adoc index b69affee..5f023c86 100644 --- a/community/contribute/eclipse-ide.adoc +++ b/community/contribute/eclipse-ide.adoc @@ -57,40 +57,33 @@ Use "Build Path" -> "Use as Source Folder" on each of these. Finally, you will have to manually add the ANT and JBoss Logger dependencies. -== Code formatting +== Code style -From the Eclipse menu: "Window" -> "Preferences", select "Java" -> "Code Style" -> "Formatter". -Download https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/eclipse/hibernate-java-formatting.xml[hibernate-java-formatting.xml] -from GitHub -and import it into Eclipse to apply the style the Hibernate team uses consistently across the codebase. +Each Hibernate project includes a set of build plugins to format and verify the code style of the sources. +Please refer to the particular project contributing guide for more details. [NOTE] ==== -Please avoid re-formatting large sections of code, especially when providing a patch: -we would love to have the diffs highlight the changes which matter. - -If you feel the need to fix formatting on an existing source file, -make sure to isolate your formatting fixes in a separate commit -that contains exclusively formatting changes (avoid any functional change in that commit) -and make sure the commit message mentions this. +If the project build does not define a fully automated code formatter, +please avoid reformatting large sections of code, especially when providing a patch: +we would love to have the diffs highlight the changes that matter. ==== == Code templates -In the same "Window" -> "Preferences" menu, select "Java" -> "Code Style" -> "Code Templates" -and import the appropriate file downloaded from our GitHub repository: - -* For Hibernate ORM: https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/eclipse/hibernate-code-template-orm.xml[`hibernate-code-templates-orm.xml`]. -* For Hibernate Search: https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/eclipse/hibernate-code-template-search.xml[`hibernate-code-templates-search.xml`]. -* For Hibernate OGM: https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/eclipse/hibernate-code-template-ogm.xml[`hibernate-code-templates-ogm.xml`]. -* For Hibernate Validator: https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/eclipse/hibernate-code-template-validator.xml[`hibernate-code-templates-validator.xml`]. +All top-level Hibernate projects are Apache 2.0 licensed and use the following header format: -With these templates, newly created files will automatically have the proper copyright/license headers. -Feel free to add your nick or full name as author of new files, and optionally provide an email. -The copyright/license header is a requirement. +[source,java] +---- +/* +* SPDX-License-Identifier: Apache-2.0 +* Copyright Red Hat Inc. and Hibernate Authors +*/ +---- -You can also use the https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/eclipse/hibernate-auto-cleanup.xml[`hibernate-auto-cleanup.xml`], -to be imported into "Java" -> "Code Style" -> "Clean Up". +Note that each project has a license build plugin configured to check for the correct license header formatting. +At the same time, such a plugin provides options to add the missing headers. +Please refer to the particular project build for more details. == Running tests in Eclipse diff --git a/community/contribute/intellij-idea.adoc b/community/contribute/intellij-idea.adoc index 0e387a2d..845e5e07 100644 --- a/community/contribute/intellij-idea.adoc +++ b/community/contribute/intellij-idea.adoc @@ -43,65 +43,31 @@ See the Annotation processor section for more info. == Code style -Download the settings from our GitHub repository: +Each Hibernate project includes a set of build plugins to format and verify the code style of the sources. +Please refer to the particular project contributing guide for more details. -* For Hibernate ORM: https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/intellij-14/hibernate_orm.xml[`hibernate_orm.xml`]. -* For Hibernate Search, Validator, OGM: https://raw.githubusercontent.com/hibernate/hibernate-ide-codestyles/master/intellij-14/hibernate_noorm.xml[`intellij-14/hibernate_noorm.xmlhibernate-code-templates-search.xml`]. - -Here is http://musingsofaprogrammingaddict.blogspot.com/2010/03/import-code-style-settings-into.html[an article on how to set it up in IntelliJ IDEA]. - -The authoritative code style is defined by the CheckStyle checks file associated with the project; -be sure to check against those prior to pushing. +[NOTE] +==== +If the project build does not define a fully automated code formatter, +please avoid reformatting large sections of code, especially when providing a patch: +we would love to have the diffs highlight the changes that matter. +==== == Code templates -The best approach to automatically apply the proper copyright/license headers to newly created files -is to leverage the Copyright plugin (now a bundled plugin). - -Set up on profile per Hibernate project you want to deal with in the Copyright configuration ("Settings" -> "Copyright") -and then select the one to use for your IntelliJ IDEA project. - -Note you can define the profiles once and for all if you go through -"Other settings" -> "Settings for new projects" -> "Copyright": -they will be made available automatically in every new IntelliJ IDEA project. - -Here are the standard license headers for each project: - -* Hibernate ORM: - - /* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ - -* Hibernate Search: - - /* - * Hibernate Search, full-text search for your domain model - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or . - */ - -* Hibernate Validator: - - /* - * Hibernate Validator, declare and validate application constraints - * - * License: Apache License, Version 2.0 - * See the license.txt file in the root directory or . - */ +All top-level Hibernate projects are Apache 2.0 licensed and use the following header format: -* Hibernate OGM: +[source,java] +---- +/* +* SPDX-License-Identifier: Apache-2.0 +* Copyright Red Hat Inc. and Hibernate Authors +*/ +---- - /* - * Hibernate OGM, Domain model persistence for NoSQL datastores - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or . - */ +Note that each project has a license build plugin configured to check for the correct license header formatting. +At the same time, such a plugin provides options to add the missing headers. +Please refer to the particular project build for more details. == Debugging