-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from sashirestela/53-improve-code-quality-and-…
…formatting Improve code quality and formatting
- Loading branch information
Showing
80 changed files
with
1,108 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Release to Maven Central | ||
run-name: Release run ${{ github.run_number }} | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
environment: production | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "11" | ||
distribution: "temurin" | ||
java-package: "jdk" | ||
check-latest: true | ||
server-id: "ossrh" | ||
server-username: OSSRH_USERNAME | ||
server-password: OSSRH_PASSWORD | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: GPG_PASSPHRASE | ||
cache: "maven" | ||
- name: Build & Deploy | ||
run: mvn -U -B clean deploy -P release | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Contributing | ||
Thank you very much for your interest in contributing to the improvement of this project. Please, follow the next guidelines. | ||
|
||
## General Guidelines | ||
1. Keep the code compatible with Java 11. | ||
1. Follow existing code styles present in the project. | ||
1. Avoid adding new dependencies as much as possible. | ||
1. Ensure to add Javadoc where necessary. | ||
1. Provide unit tests for your code. | ||
1. Large features should be discussed with maintainers before implementation. Use the [Discussion](https://github.com/sashirestela/cleverclient/discussions) section for this. | ||
|
||
## Code Formatting | ||
This project is configured with [Spotless](https://github.com/diffplug/spotless/tree/main/plugin-maven) to automatically check code formatting against a [custom code format](codestyle/spotless_java_eclipseformat.xml) specification of modern Java, as well as [import order](codestyle/spotless_java.importorder). | ||
|
||
Spotless comes with two Maven commands that you can run at any moment, preferably before committing your changes: | ||
|
||
- `mvn spotless:check`, to verify if code is formatted correctly. | ||
- `mvn spotless:apply`, to rewrite the source code in place. | ||
|
||
The remote build will check the code formatting, so the build will fail if the code isn't formatted correctly. | ||
|
||
|
||
## Configure IDE (Optional) | ||
You could set your favorite IDE to be aligned to the custom code format. See details below. | ||
|
||
<details> | ||
|
||
<summary><b>IntelliJ</b></summary> | ||
|
||
1. Import the custom code format: | ||
|
||
- Settings > Editor > Code Style > Java > Scheme > ⚙ > Import Scheme > Eclipse XML Profile | ||
|
||
2. Select the file on _codestyle/spotless_java_eclipseformat.xml_ | ||
|
||
3. In the _Imports_ tab for the previous scheme, change the values: | ||
- In _General_ section, mark the option _Use single class import_ | ||
- In the field _Class count to use import with '*'_ put the value 99 | ||
- In the field _Names count to use static import with '*'_ put the value 99 | ||
|
||
4. At the bottom part in the _Imports_ section, change the import statement order as: | ||
- **import** all other imports | ||
- **import** javax.* | ||
- **import** java.* | ||
- **import static** all other imports | ||
|
||
</details> | ||
|
||
<details> | ||
|
||
<summary><b>VSCode</b></summary> | ||
|
||
1. Install the extension _Language Support for Java by Red Hat_ | ||
|
||
2. Set the custom code format: | ||
|
||
- Settings > Workspace > Extensions > Language Support for Java(TM) by Red Hat > Formatting | ||
- Choose the box _Java/Format/Settings:Url_ and put the value _codestyle/spotless_java_eclipseformat.xml_ | ||
|
||
3. Set the import order: | ||
|
||
- Settings > Workspace > Extensions > Language Support for Java(TM) by Red Hat > Code Completion | ||
- Choose the box _Java/Completion:ImportOrder_ and click the link _Edit in settings.json_ | ||
- In the editor, make sure to add the following entries: | ||
|
||
```json | ||
"java.completion.importOrder": [ | ||
"", | ||
"javax", | ||
"java", | ||
"*" | ||
] | ||
``` | ||
|
||
</details> | ||
|
||
<details> | ||
|
||
<summary><b>Eclipse</b></summary> | ||
|
||
1. Import the custom code format: | ||
|
||
- Preferences > Java > Code Style > Formatter > Import... | ||
|
||
2. Select the file on _codestyle/spotless_java_eclipseformat.xml_ | ||
|
||
3. Import the custom import statement order: | ||
|
||
- Preferences > Java > Code Style > Organize Imports > Import... | ||
|
||
4. Select the file on _codestyle/spotless_java.importorder_ | ||
|
||
5. In the _Organize Imports_ section, make sure the values are set as: | ||
|
||
- Sorting order: | ||
- \* - all unmatched type imports | ||
- javax | ||
- java | ||
- \* - all unmatched static imports | ||
- Number of imports needed for .*: 99 | ||
- Number of static imports needed for .*: 99 | ||
|
||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#Organize Import Order | ||
#Mon Feb 26 16:38:48 PET 2024 | ||
0= | ||
1=javax | ||
2=java | ||
3=\# |
Oops, something went wrong.