New Project Checklist

Steps to follow when setting up a new project in this course.

Java

New Project

  1. Clone empty GitHub repository into java folder:
git clone <url> java
  1. Install SDKMAN
curl -s "https://get.sdkman.io" | bash
  1. Close and Reopen Terminal
  2. Install Gradle
sdk install gradle 7.6
  1. Change directory to java folder:
cd java
  1. Initialize Gradle Project
gradle init

Recommended 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")
    }
}
  1. Configure JavaDoc in build.gradle
// .. rest of file here

// Add tests to Javadoc
javadoc {
  classpath += project.sourceSets.test.compileClasspath
  source += project.sourceSets.test.allJava
}
  1. 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'
}
  1. Store Google Checkstyle XML at config/checkstyle/checkstyle.xml
    1. Optionally update Indentation section to match Codio values:
    <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>
  1. Add additional libraries to build.gradle as needed (Hamcrest, JUnit Parameters, etc.)

Existing Project or Example Project

  1. Clone existing project into java folder:
git clone <url> java
  1. Install SDKMAN
curl -s "https://get.sdkman.io" | bash
  1. Close and Reopen Terminal
  2. Install Gradle
sdk install gradle 7.6
  1. Change directory to java folder:
cd java
  1. Compile and Test Existing Project
gradle run
gradle check

Python

New Project

  1. Clone empty GitHub repository into python folder:
git clone <url> python
  1. Change directory to python folder:
cd python
  1. Check Python Version:
python3 --version
  1. Create requirements.txt file
coverage
flake8<5.0.0
flake8-docstrings
flake8-html
lxml
mypy
pdoc3
pep8-naming
pyhamcrest
pytest
pytest-html
tox
  1. Install Python Libraries
pip3 install -r requirements.txt
  1. Create tox.ini file
[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 .
  1. Create .gitignore file
__pycache__/
.tox
reports/
.coverage
  1. Create src and test directories
mkdir src
mkdir test
  1. Add empty conftest.py to src directory
  2. Add empty __init__.py to src and test directory to make them packages
  3. Create additional packages as needed
  4. Add __main__.py to src and include code to call main method

Existing Project

  1. Clone existing project into python folder:
git clone <url> python
  1. Change directory to python folder:
cd python
  1. Check Python Version:
python3 --version
  1. Confirm Python Version matches the envlist entry in tox.ini
    1. Python 3.6.x - py36
    2. Python 3.9.x - py39
    3. Python 3.10.x - py310
  2. Update Packages in requirements.txt
    1. Lock flake8 to version before 5.0: flake8<5.0.0
  3. Install Python Libraries
pip3 install -r requirements.txt
  1. Run Existing Project
python3 -m src

or (For flask projects)

python3 -m flask run
  1. Run tox using Recreate Option To Test Existing Project
tox -r

GitHub Commit and Release

  1. Git Commit and Push
git add .
git commit -m "Message"
git push
  1. On GitHub Site, create Release