New Project Checklist
Steps to follow when setting up a new project in this course.
Java
New Project
- Clone empty GitHub repository into
javafolder:
git clone <url> javacurl -s "https://get.sdkman.io" | bash- Close and Reopen Terminal
- Install Gradle
sdk install gradle 7.6- Change directory to
javafolder:
cd java- Initialize Gradle Project
gradle initRecommended options:
1. Type of project - 2: application
1. Implementation language - 3: Java
1. Split functionality across multiple subprojects - 1: no - only one application project
1. Build script DSL - 1: Groovy
1. Generate build using new APIs and behavior - no
1. Test Framework - 4: JUnit Jupiter
1. Project name - <name>
1. Source package - <name>
7. Add JaCoCo Plugin to build.gradle
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
// JaCoCo plugin for code coverage
id 'jacoco'
}
// ... rest of file here
// Configure Jacoco plugin
test {
finalizedBy jacocoTestReport // report is always generated after tests run
}
jacocoTestReport {
dependsOn test // tests are required to run before generating the report
reports {
xml.enabled false
csv.enabled false
html.destination file("${buildDir}/reports/jacoco")
}
}- Configure JavaDoc in
build.gradle
// .. rest of file here
// Add tests to Javadoc
javadoc {
classpath += project.sourceSets.test.compileClasspath
source += project.sourceSets.test.allJava
}- Add Checkstyle to
build.gradle
plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id 'application'
// JaCoCo plugin for code coverage
id 'jacoco'
// Checkstyle plugin for linting
id 'checkstyle'
}
// ... rest of file here
// Force Checkstyle to be more current version
checkstyle {
toolVersion '10.6.0'
}- Store Google Checkstyle XML at
config/checkstyle/checkstyle.xml- Optionally update
Indentationsection to match Codio values:
- Optionally update
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="4"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="8"/>
<property name="lineWrappingIndentation" value="8"/>
<property name="arrayInitIndent" value="4"/>
</module>- Add additional libraries to
build.gradleas needed (Hamcrest, JUnit Parameters, etc.)
Existing Project or Example Project
- Clone existing project into
javafolder:
git clone <url> javacurl -s "https://get.sdkman.io" | bash- Close and Reopen Terminal
- Install Gradle
sdk install gradle 7.6- Change directory to
javafolder:
cd java- Compile and Test Existing Project
gradle run
gradle checkPython
New Project
- Clone empty GitHub repository into
pythonfolder:
git clone <url> python- Change directory to
pythonfolder:
cd python- Check Python Version:
python3 --version- Create
requirements.txtfile
coverage
flake8<5.0.0
flake8-docstrings
flake8-html
lxml
mypy
pdoc3
pep8-naming
pyhamcrest
pytest
pytest-html
tox- Install Python Libraries
pip3 install -r requirements.txt- Create
tox.inifile
[tox]
envlist = py39
skipsdist = True
[testenv]
deps = -rrequirements.txt
ignore_errors = true
commands = python3 -m mypy -p src --html-report reports/mypy
python3 -m coverage run --source src -m pytest --html=reports/pytest/index.html
python3 -m coverage html -d reports/coverage
python3 -m flake8 --docstring-convention google --format=html --htmldir=reports/flake
python3 -m pdoc --html --force --output-dir reports/doc .- Create
.gitignorefile
__pycache__/
.tox
reports/
.coverage- Create
srcandtestdirectories
mkdir src
mkdir test- Add empty
conftest.pytosrcdirectory - Add empty
__init__.pytosrcandtestdirectory to make them packages - Create additional packages as needed
- Add
__main__.pytosrcand include code to call main method
Existing Project
- Clone existing project into
pythonfolder:
git clone <url> python- Change directory to
pythonfolder:
cd python- Check Python Version:
python3 --version- Confirm Python Version matches the
envlistentry intox.ini- Python 3.6.x -
py36 - Python 3.9.x -
py39 - Python 3.10.x -
py310
- Python 3.6.x -
- Update Packages in
requirements.txt- Lock
flake8to version before 5.0:flake8<5.0.0
- Lock
- Install Python Libraries
pip3 install -r requirements.txt- Run Existing Project
python3 -m srcor (For flask projects)
python3 -m flask run- Run
toxusing Recreate Option To Test Existing Project
tox -rGitHub Commit and Release
- Git Commit and Push
git add .
git commit -m "Message"
git push- On GitHub Site, create Release