Skip to content

Commit 70fb2ba

Browse files
committed
## September 2018
* First step to change the License of this project to UNLICENSE: Moves Checkstyle, PMD, Codenarc, ESLint and Stylelint configuration to its own project. * Adds Mockito (How do i forget this before!). * Rearranges alphabetically the script tasks in [`package.json`](front/package.json) in order to increase Readability. * Moves Gradle's plugins configurations before tasks' configuration, in order to increase Readability, since plugins mainly have general common tasks configurations. * Removes redundant global task: `assess`, `check`, `coverage`, `doc`, `run` and `test`, since Gradle will run it any way. * Removes `e2e:run` task to avoid conflict or confusion with `back:run`. * Removes all code tasks names configuration Constants, `CODE$ASSESS_MAIN_TASK_NAME` -> `assessMain`, `CODE$ASSESS_UNIT_TEST_TASK_NAME` -> `assessUnitTest`, `CODE$ASSESS_INTEGRATION_TEST_TASK_NAME` -> `assessIntegrationTest`, `CODE$ASSESS_TEST_TASK_NAME` -> `assessTest`, `CODE$ASSESS_TASK_NAME` -> `assess`, `CODE$UNIT_TEST_TASK_NAME` -> `unitTest`, `CODE$INTEGRATION_TEST_TASK_NAME` -> `integrationTest`, `CODE$COVERAGE_TASK_NAME` -> `coverage`, `CODE$DOCUMENTATION_TASK_NAME` -> `doc`, `GLOBAL$TEST_TASK_NAME` -> `test`, `GLOBAL$CHECK_TASK_NAME` -> `check`, `GLOBAL$RUN_TASK_NAME` -> `run`, to favor "Convention over Configuration", that makes the gradle code More Maintainable (it was hard to follow). * Removes `javax.xml.accessExternalDTD` property from `back` project. * Fixes issues with JUnit5 Test tasks configuration: was missing `useJUnitPlatform()` in order to been able run. * Fixes issues with `back:assess` task: was not running `checkstyleTest` task. * Fixes issues with `front:integrationTest` task: was not checking output dir. * Fixes issues with code coverage average value [`coverage.gradle`](back/local_gradle/coverage.gradle). * Upgrades Gradle to version 4.10.2. * Upgrades Checkstyle to version 8.11. * Upgrades PMD to version 6.7.0: * Upgrades Spring Boot to version 2.0.5. * Upgrades gulp-uglify to version 3.0.1. * Updates tasks' diagrams for main and `back` project. * Updates some README files. * Rearranges chronologically this file's information, starting from most recent change.
1 parent 6f71f05 commit 70fb2ba

31 files changed

+363
-822
lines changed

CHANGELOG.md

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
# Base code Change Log
22

3-
## August 2018
3+
## September 2018
44

5-
* Sets Java source compatibility to 1.10.
6-
* Upgrades Gradle to version 4.9.
7-
* Upgrades Spring Boot to version 2.0.4.
8-
* Upgrades NodeJS to version 9.11.2.
5+
* First step to change the License of this project to UNLICENSE: Moves Checkstyle, PMD, Codenarc, ESLint and Stylelint configuration to its own project.
6+
* Adds Mockito (How do i forget this before!).
7+
* Rearranges alphabetically the script tasks in [`package.json`](front/package.json) in order to increase Readability.
8+
* Moves Gradle's plugins configurations before tasks' configuration, in order to increase Readability, since plugins mainly have general common tasks configurations.
9+
* Removes redundant global task: `assess`, `check`, `coverage`, `doc`, `run` and `test`, since Gradle will run it any way.
10+
* Removes `e2e:run` task to avoid conflict or confusion with `back:run`.
11+
* Removes all code tasks names configuration Constants, `CODE$ASSESS_MAIN_TASK_NAME` -> `assessMain`, `CODE$ASSESS_UNIT_TEST_TASK_NAME` -> `assessUnitTest`, `CODE$ASSESS_INTEGRATION_TEST_TASK_NAME` -> `assessIntegrationTest`, `CODE$ASSESS_TEST_TASK_NAME` -> `assessTest`, `CODE$ASSESS_TASK_NAME` -> `assess`, `CODE$UNIT_TEST_TASK_NAME` -> `unitTest`, `CODE$INTEGRATION_TEST_TASK_NAME` -> `integrationTest`, `CODE$COVERAGE_TASK_NAME` -> `coverage`, `CODE$DOCUMENTATION_TASK_NAME` -> `doc`, `GLOBAL$TEST_TASK_NAME` -> `test`, `GLOBAL$CHECK_TASK_NAME` -> `check`, `GLOBAL$RUN_TASK_NAME` -> `run`, to favor "Convention over Configuration", that makes the gradle code More Maintainable (it was hard to follow).
12+
* Removes `javax.xml.accessExternalDTD` property from `back` project.
13+
* Fixes issues with JUnit5 Test tasks configuration: was missing `useJUnitPlatform()` in order to been able run.
14+
* Fixes issues with `back:assess` task: was not running `checkstyleTest` task.
15+
* Fixes issues with `front:integrationTest` task: was not checking output dir.
16+
* Fixes issues with code coverage average value [`coverage.gradle`](back/local_gradle/coverage.gradle).
17+
* Upgrades Gradle to version 4.10.2.
918
* Upgrades Checkstyle to version 8.11.
10-
* Upgrades PMD to version 6.6.0:
11-
* Migrates rulesets to category.
12-
* Adds some new excludes.
13-
* Upgrades CodeNarc to version 1.2.
14-
* Improves JUnit5 code and configuration:
15-
* Changes org.junit.Assert to org.junit.jupiter.api.Assertions.
16-
* Changes org.junit.Test to org.junit.jupiter.api.Test.
17-
* Changes SpringRunner to SpringExtension.
18-
* Rearranges content of configuration files alphabetically for CodeNarc, Checkstyle, PMD and eslint, in order to make it more Maintainable.
19-
* Extracts NodeJS's eslint common configuration, [`.eslintrc-node.json`](front/config/.eslintrc-node.json)
20-
* Updates some rules in Checkstyle, [`coding-checks.xml`](back/config/coding-checks.xml):
21-
* CustomImportOrder.
22-
* MethodCount.
23-
* Suppresses some rules for Checkstyle for test files, [`checks-suppressions.xml`](back/config/checks-suppressions.xml):
24-
* MethodCount.
25-
* Suppresses some rules for CodeNarc rules:
26-
* VariableTypeRequired.
27-
* Improves [`hotrun.gradle`](back/local_gradle/hotrun.gradle) to increase Maintainability:
28-
* Adds Types.
29-
* Adds imports.
30-
* Improves [`logger.gradle`](local_gradle/logger.gradle) to increase Maintainability:
31-
* Adds Types.
32-
* Adds imports.
33-
* Fixes that when obtaining files for incremental build it was not getting any on subprojects.
34-
* [`files.gradle`](local_gradle/files.gradle): obtainFiles renamed to obtainFilesFromProject.
19+
* Upgrades PMD to version 6.7.0:
20+
* Upgrades Spring Boot to version 2.0.5.
21+
* Upgrades gulp-uglify to version 3.0.1.
22+
* Updates tasks' diagrams for main and `back` project.
3523
* Updates some README files.
24+
* Rearranges chronologically this file's information, starting from most recent change.
3625

3726
## August 2018 A
3827

@@ -74,3 +63,37 @@
7463
* Fixes misspelled method's name: from `createNewConnetion` to `createNewConnection`.
7564
* Fixes the returning type for createNewConnection: from `GradleConnector` to `ProjectConnection`.
7665
* Updates some README files.
66+
67+
## August 2018
68+
69+
* Sets Java source compatibility to 1.10.
70+
* Upgrades Gradle to version 4.9.
71+
* Upgrades Spring Boot to version 2.0.4.
72+
* Upgrades NodeJS to version 9.11.2.
73+
* Upgrades Checkstyle to version 8.11.
74+
* Upgrades PMD to version 6.6.0:
75+
* Migrates rulesets to category.
76+
* Adds some new excludes.
77+
* Upgrades CodeNarc to version 1.2.
78+
* Improves JUnit5 code and configuration:
79+
* Changes org.junit.Assert to org.junit.jupiter.api.Assertions.
80+
* Changes org.junit.Test to org.junit.jupiter.api.Test.
81+
* Changes SpringRunner to SpringExtension.
82+
* Rearranges content of configuration files alphabetically for CodeNarc, Checkstyle, PMD and eslint, in order to make it more Maintainable.
83+
* Extracts NodeJS's eslint common configuration, [`.eslintrc-node.json`](front/config/.eslintrc-node.json)
84+
* Updates some rules in Checkstyle, [`coding-checks.xml`](back/config/coding-checks.xml):
85+
* CustomImportOrder.
86+
* MethodCount.
87+
* Suppresses some rules for Checkstyle for test files, [`checks-suppressions.xml`](back/config/checks-suppressions.xml):
88+
* MethodCount.
89+
* Suppresses some rules for CodeNarc rules:
90+
* VariableTypeRequired.
91+
* Improves [`hotrun.gradle`](back/local_gradle/hotrun.gradle) to increase Maintainability:
92+
* Adds Types.
93+
* Adds imports.
94+
* Improves [`logger.gradle`](local_gradle/logger.gradle) to increase Maintainability:
95+
* Adds Types.
96+
* Adds imports.
97+
* Fixes that when obtaining files for incremental build it was not getting any on subprojects.
98+
* [`files.gradle`](local_gradle/files.gradle): obtainFiles renamed to obtainFilesFromProject.
99+
* Updates some README files.

README.md

Lines changed: 47 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Base code for a Web project - Java + JS
22

3-
This project is build with the purpose of given a base code from where you can start to develop with a little of extra work.
4-
This project is licensed under the terms of the MIT license.
3+
[![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](/LICENSE.txt)
4+
5+
**This project is build with the purpose of given a base code from where you can start to develop with a little of extra work.**
6+
7+
This project is licensed under the terms of the [MIT license](/LICENSE.txt).
58

69
## Goals
710

@@ -12,10 +15,10 @@ This project is licensed under the terms of the MIT license.
1215

1316
Some things are Opinionated based on best practices and professional experience[4].
1417

15-
> [1] Using [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html).
16-
> [2] Using [Gradle Node](https://github.com/srs/gradle-node-plugin).
17-
> [3] Another approach will be to have a server from frontend and another server for backend, but this will among other things require more resource from system and some developers can not afford that.
18-
> [4] Some topics have _References_ so you can dig more on details. And code has been "widely" commented to assist you to understand some fragments.
18+
> [1] Using [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html).
19+
> [2] Using [Gradle Node](https://github.com/srs/gradle-node-plugin).
20+
> [3] Another approach will be to have a server from frontend and another server for backend, but this will among other things require more resource from system and some projects can not afford that.
21+
> [4] Some topics in the README files have _References_ so you can dig more on details. And code has been "widely" commented to assist you to understand some fragments.
1922
2023
## Features
2124

@@ -55,11 +58,11 @@ Some things are Opinionated based on best practices and professional experience[
5558

5659
## Prerequisites
5760

58-
* [Java](http://www.oracle.com/technetwork/java/javase/downloads).
61+
* [Java](https://www.java.com/en/download/help/download_options.xml) (for running Gradle), which basically comes with every operating system, so this should not be a problem.
5962
* [Chrome](https://www.google.com/chrome/browser/desktop/) and [Firefox](https://www.mozilla.org/en-US/firefox/) for End to End Test [1].
60-
* [Git](https://git-scm.com/downloads) (only if you are going to clone the project).
63+
* [Git](https://git-scm.com/downloads) (only if the project is going to be cloned).
6164

62-
> [1] If you don't have one of these you could change the code in order to use only what you have.
65+
> [1] If only one of these is required or present, then configuration could be changed in order to use only what is required in [e2e project](front/e2e/README.md#Test-Driven-Development).
6366
6467
## Getting it
6568

@@ -73,18 +76,18 @@ git clone https://github.com/gmullerb/basecode
7376
7477
## Set up
7578

76-
+ **No need**, only download and run.
79+
+ **No need**, only download and run (It's Gradle! Yes!).
7780

7881
## Running it
7982

80-
* To check it: `gradlew` (this will run default tasks)
83+
* `gradlew`, will run default tasks:
8184
* [`:assessGradle`](#Gradle-Code).
82-
* [`:back:check`](back/README.md#Gradle-Tasks-structure)
83-
* [`:front:check`](front/README.md#Gradle-Tasks-structure)
85+
* [`:assessCommon`](#Code-Style-Checking).
86+
* [`:check`](#Gradle-Tasks-structure).
8487

85-
* To execute it: `gradlew bootRun`
88+
* `gradlew run`: will run the project.
8689

87-
* To get all the tasks for the project: `gradlew tasks --all`
90+
* `gradlew tasks --all`: will get all the tasks for the project.
8891

8992
## Project structure
9093

@@ -121,9 +124,9 @@ Structure:
121124
* `local_gradle`: Local gradle modules folder[3].
122125
* `readme`: Readme attachments folder.
123126

124-
> [1] Remember to change the root project name in `settings.gradle`, even in single project builds: `rootProject.name = 'name'` to avoid Continuous Integration servers issues.
125-
> [2] Both, backend and frontend projects, try to have the same folder structure.
126-
> [3] "Heavy" gradle logic is extracted here.
127+
> [1] Remember to change the root project name in `settings.gradle`, even in single project builds: `rootProject.name = 'name'` to avoid Continuous Integration servers issues.
128+
> [2] Both, backend and frontend projects, try to have the same folder structure.
129+
> [3] "Heavy" gradle logic is extracted here.
127130
128131
### Conventions
129132

@@ -132,13 +135,13 @@ Structure:
132135
* Configuration folders will be named: `config`.
133136
* Configuration files will be named ending with: `cfg.*`, `.yml`.
134137
* Folder's name may use `_`, but not `-`.
135-
* Files's name may use `-`, but not `_`.
138+
* Files' name may use `-`, but not `_`.
136139
* Throughout any documentation, `..` will represent an ellipsis to avoid possible confusion with `...` programming language operator.
137140

138141
### Recommendations
139142

140-
* In `/gradle/wrapper` the `gradle-wrapper.properties` file sets `gradle-#.#-all.zip` (this file allows access to gradle source), If this is no required you may change for `gradle-#.#-bin.zip` on `gradle-wrapper.properties` for a smaller JAR file for the wrapper.
141-
* Don't use the _base_ or _absolute_ name on your pathnames.
143+
* In `/gradle/wrapper` the `gradle-wrapper.properties` file sets `gradle-#.#-all.zip` (this file allows access to gradle source), If this is no required, then change for `gradle-#.#-bin.zip` on `gradle-wrapper.properties` for a smaller JAR file for the wrapper.
144+
* Don't use the _base_ or _absolute_ name on project's paths names.
142145

143146
## Gradle Tasks structure
144147

@@ -175,27 +178,10 @@ task name (..) {
175178

176179
This way is easily to achieve any task in both projects.
177180

178-
There is the possibility to change the name of these tasks, for that, go to the main `gradle.properties` and change any of the names defined there[2]:
179-
180-
```groovy
181-
CODE$ASSESS_MAIN_TASK_NAME=assessMain
182-
CODE$ASSESS_UNIT_TEST_TASK_NAME=assessUnitTest
183-
CODE$ASSESS_INTEGRATION_TEST_TASK_NAME=assessIntegrationTest
184-
CODE$ASSESS_TEST_TASK_NAME=assessTest
185-
CODE$ASSESS_TASK_NAME=assess
186-
CODE$UNIT_TEST_TASK_NAME=unitTest
187-
CODE$INTEGRATION_TEST_TASK_NAME=integrationTest
188-
CODE$COVERAGE_TASK_NAME=coverage
189-
CODE$DOCUMENTATION_TASK_NAME=doc
190-
191-
GLOBAL$TEST_TASK_NAME=test
192-
GLOBAL$CHECK_TASK_NAME=check
193-
```
194-
195181
`build.gradle` defines a default task with the purpose of doing all required checks that any developer of the project should run at least to ensure some degree of code wellness on any change before submitting the code: `assessGradle` + `:front:assessLocal` + `check`
196182

197-
> [1] Some are just alias, since real task name is too long or some plugin creates a task with different name (but same functionality), e.g.: `jacocoTestCoverageVerification`
198-
> [2] All tasks will generate console information and a report if possible.
183+
> All tasks will generate console information and a report if possible.
184+
> [1] Some are just alias, since real task name is too long or some plugin creates a task with different name (but same functionality), e.g.: `jacocoTestCoverageVerification`.
199185
200186
## Configuration
201187

@@ -236,12 +222,12 @@ Properties are defined in gradle.properties files. Properties are defined with p
236222
* Remote: [jcenter](https://bintray.com/bintray/jcenter).
237223
* Local: Maven local.
238224

239-
By default, the project use Remote repositories, but you may use local repository, for this execute: `gradlew .. -PlocalRepo`
225+
By default, the project use Remote repositories, but it could be changed to use local repository, for this execute: `gradlew .. -PlocalRepo`
240226

241227
### Running Environments
242228

243-
GLOBAL$DEFAULT_ENVIRONMENT is defined in the [`gradle.properties`](gradle.properties) file and sets the default environment (or profile), `dev`[1].
244-
You can change it using command line `gradlew bootRun -Penv=TARGET_ENVIRONMENT`.
229+
GLOBAL$DEFAULT_ENVIRONMENT is defined in the [`gradle.properties`](gradle.properties) file and sets the default environment (or profile) to `dev`[1].
230+
It could be changed using command line: `gradlew bootRun -Penv=TARGET_ENVIRONMENT`.
245231

246232
> [1] Value should always be in lowercase.
247233
@@ -263,8 +249,9 @@ Gradle is Superb! but when is about logging it has a good internal (not shared)
263249

264250
### Recommendations
265251

266-
* Change versions: versions are set to the latest with * or +, so you can get the latest version the first time you start your project, although is recommended to set it to fixed values later.
252+
* Change versions: Most versions are set to the latest using `*` or `+`, so it can get the latest version the first time the project is started, although is recommended to set it to fixed values later.
267253
* Test dependencies can remain dynamic since this will not affect production build, and allow to have latest improvements and fixes.
254+
* This project was develop under Linux so, Windows user may (or may not) need to adjust some configuration values.
268255

269256
## Code Style
270257

@@ -274,32 +261,24 @@ Code style will allow to follow the best practices and standard coding across te
274261

275262
The idea is to catch errors before code is submitted by developers.
276263

277-
All projects have code style checking and have a subset of rules defined that tries to be consistent between all projects's code in order to allow "almost" the same look of the code to both developers, backend and frontend. To highlights:
264+
All projects have code style checking and have subsets of rules defined. Subsets try to be similar for all the code (Backend's, Frontend's and Build's code), in order to allow "almost" the same look and rules of the code:
278265

279-
* CamelCase naming convention.
280-
* Egyptian brackets.
281-
* Tab character checking with 2 spaces.
282-
* Method length limit (48 lines).
283-
* Method parameters number limit (4 parameters).
284-
* Requires semicolon at the end of the line.
285-
* Requires a new line break at the end of the file[1].
286-
* Some spacing rules are the same.
266+
* Rules are defined in [base-style-config project](https://github.com/gmullerb/base-style-config).
287267

288268
In the root project is defined a Checkstyle task that do some common checks for all files of the multi-project, `assessCommon`:
289269

270+
* Rules are defined in [base-style-config project](https://github.com/gmullerb/base-style-config).
290271
* The only files that are not processed are `.gitignore` files (due to some internal excluding of the Checkstyle ant task).
291-
* and It will ignore almost all patterns set in the `.gitignore` files, but patterns with ̣`!` and `[` + `]` will be bypassed (then avoid using these if possible)
292-
293-
> [1] In order to be friendly with Code Versioning tools.
272+
* and It will ignore almost all patterns set in the `.gitignore` files, but patterns with ̣`!` and `[` + `]` will be bypassed (then avoid using these if possible).
294273

295274
#### Gradle Code
296275

297-
Gradle and Groovy files are checked with [CodeNarc](http://codenarc.sourceforge.net) using `assessGradle` task . To highlights:
276+
Gradle files (basically Groovy files) are checked with [CodeNarc](http://codenarc.sourceforge.net) using `assessGradle` task . To highlights:
298277

299-
* Rules are defined in the [`gradle-rules.groovy`](config/gradle-rules.groovy).
278+
* Rules are defined in [base-style-config project](https://github.com/gmullerb/base-style-config).
300279
* Report will be in `build/reports/codenarc`.
301280
* `assessGradle` task is executed by default on the project.
302-
* Version is defined with GLOBAL$CODENARC_VERSION on [`gradle.properties`](gradle.properties)
281+
* Version is defined with `GLOBAL$CODENARC_VERSION` on [`gradle.properties`](gradle.properties)
303282

304283
## Test Driven Development
305284

@@ -314,28 +293,28 @@ Gradle and Groovy files are checked with [CodeNarc](http://codenarc.sourceforge.
314293
315294
## Hot run
316295

317-
You can use the `hotRun` task [1] to run the project and at the same time edit [2] Backend Java Code and Frontend JS code and the code will be reflected "immediately"[3]. This run will generate information that will be shown to console and into files.
296+
Use the `hotRun` task [1] to run the project and at the same time edit [2] Backend Java Code and Frontend JS code and the code will be reflected "immediately"[3]. This run will generate information that will be shown to console and into files.
318297

319298
For changing configuration go to ['hotrun.gradle'](back/local_gradle/hotrun.gradle):
320299

321300
* Tasks `concurrentClasses` and `concurrentBootRun`:
322-
* showOutput: Show the output for each run in console (true or false, default: false).
323-
* showError: Show error information for each run in console (true or false, default: false).
324-
* outputFilePath: If set, saves the output for each run in the specified file.
325-
* errorFilePath: If set, saves error information for each run in the specified file.
301+
* `showOutput`: Show the output for each run in console (`true` or `false`, default: `false`).
302+
* `showError`: Show error information for each run in console (`true` or `false`, default: `false`).
303+
* `outputFilePath`: If set, saves the output for each run in the specified file.
304+
* `errorFilePath`: If set, saves error information for each run in the specified file.
326305
* Task `concurrentClasses`[4]:
327-
* extraParams[0]: Milliseconds between checking Code changes.
328-
* extraParams[1]: Show run number and time (true or false, default: true).
306+
* `extraParams[0]`: Milliseconds between checking Code changes.
307+
* `extraParams[1]`: Show run number and time (`true` or `false`, default: `true`).
329308

330309
> [1] Based in [Gradle Daemons](https://docs.gradle.org/current/userguide/custom_tasks.html#worker_api).
331310
> [2] If do it other way, it will possibly need 2 opened consoles for doing this.
332311
> [3] Every 10s Code is check this can be change.
333-
> [4] When setting one, you should set both.
312+
> [4] Both parameters must be set, even when requiring only one.
334313
335314
## Documentation
336315

337316
* Both projects, back and front, can generate documentation for their code.
338-
* [`CHANGELOG.md`](CHANGELOG.md)[1] add information of notable changes for each version here, chronologically ordered.
317+
* [`CHANGELOG.md`](CHANGELOG.md): add information of notable changes for each version here, chronologically ordered [1].
339318

340319
> [1] [Keep a Changelog](http://keepachangelog.com)
341320

0 commit comments

Comments
 (0)