diff --git a/.github/workflows/gradle.yml b/.github/workflows/Build Validation.yml similarity index 98% rename from .github/workflows/gradle.yml rename to .github/workflows/Build Validation.yml index 39536f90..9f3c55d5 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/Build Validation.yml @@ -8,11 +8,12 @@ name: Java CI with Gradle, with basic WPILib integration # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the main branch. -on: +on: push: branches: [ "main" ] pull_request: branches: [ "main" ] + workflow_dispatch: jobs: # This workflow contains a single job called "build" diff --git a/.github/workflows/Formatter.yml b/.github/workflows/Formatter.yml new file mode 100644 index 00000000..84e139eb --- /dev/null +++ b/.github/workflows/Formatter.yml @@ -0,0 +1,52 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will format a Java project with Gradle +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle + +name: Spotless format check with Gradle +# Controls when the action will run. Triggers the workflow on push or pull request +# events +on: + workflow_dispatch: + pull_request: + push: + branches: [main] +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + spotless-check: + # The type of runner that the job will run on + runs-on: ubuntu-22.04 + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout repo (Pull Request) + #Checks if the event was trigged by a pull request, this step will be skipped if not. + if: ${{ github.event_name == 'pull_request' }} + uses: actions/checkout@v4 + with: + #Sets up branch system properly per https://github.com/marketplace/actions/add-commit#working-with-prs + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + - name: Checkout repo (Manually Run) + #Only runs if triggered manually + if: ${{github.event_name == 'workflow_dispatch' }} + uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 17 + - name: Check with spotless + id: spot-check + run: ./gradlew spotlessCheck + - name: Apply spotless + if: ${{failure() }} + run: ./gradlew spotlessApply + - name: Commit changes + if: ${{ failure() && steps.spot-check.conclusion == 'failure' }} + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + message: 'Formatted code using spotless.' diff --git a/src/main/java/frc/robot/TestHook.java b/src/main/java/frc/robot/TestHook.java index 9d3ad242..73699895 100644 --- a/src/main/java/frc/robot/TestHook.java +++ b/src/main/java/frc/robot/TestHook.java @@ -1,10 +1,20 @@ package frc.robot; -public class TestHook { +public class TestHook +{ + public void stop() + { + } - public void stop() {} - public void setRate(double rate) {} - public void forward() {} - public void reverse() {} + public void setRate(double rate) + { + } + public void forward() + { + } + + public void reverse() + { + } } diff --git a/src/main/java/frc/robot/subsystems/Testing.java b/src/main/java/frc/robot/subsystems/Testing.java index 9a20aa47..5ecb3d06 100644 --- a/src/main/java/frc/robot/subsystems/Testing.java +++ b/src/main/java/frc/robot/subsystems/Testing.java @@ -6,19 +6,19 @@ import frc.robot.subsystems.shooter.Flywheel; import frc.robot.subsystems.shooter.Hood; -public class Testing extends SubsystemBase +public class Testing extends SubsystemBase { - private final Intake _intake; - private final Feeder _feeder; - private final Flywheel _flywheel; - private final Hood _hood; + private final Intake _intake; + private final Feeder _feeder; + private final Flywheel _flywheel; + private final Hood _hood; - public Testing() + public Testing() { - _intake = new Intake(); - _feeder = new Feeder(); - _flywheel = new Flywheel(); - _hood = new Hood(); + _intake = new Intake(); + _feeder = new Feeder(); + _flywheel = new Flywheel(); + _hood = new Hood(); } @Override @@ -27,8 +27,8 @@ public void periodic() } - public void stopAll() + public void stopAll() { - _intake.stopRollers(); + _intake.stopRollers(); } } diff --git a/src/main/java/frc/robot/subsystems/intake/Intake.java b/src/main/java/frc/robot/subsystems/intake/Intake.java index 55874319..7712c34a 100644 --- a/src/main/java/frc/robot/subsystems/intake/Intake.java +++ b/src/main/java/frc/robot/subsystems/intake/Intake.java @@ -152,13 +152,13 @@ public void stop() } @Override - public void setRate(double rate) + public void setRate(double rate) { - _intakeMotorVoltage.times(rate); + _intakeMotorVoltage.times(rate); } - + @Override - public void forward() + public void forward() { setIntakeState(IntakeState.Forward); }