Skip to content

Commit

Permalink
Merge pull request #2 from OakvilleDynamics/feature/spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettsummerfi3ld committed Feb 13, 2023
2 parents 4138729 + 4fa218e commit 38bd8f8
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 11 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/syntax-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow checks the syntax of the code using spotless.
name: Syntax Check

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
spotless:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# 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
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
# Grant execute permission for gradlew
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run spotless
run: ./gradlew spotlessCheck
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

## Build Status

| Action | Status |
| ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Build | [![Build](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/build.yml/badge.svg)](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/build.yml) |
| Qodana | [![Qodana](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/qodana.yml/badge.svg)](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/qodana.yml) |
| CodeQL | [![CodeQL Scanning](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/codeql.yml/badge.svg)](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/codeql.yml) |
| Action | Status |
| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Build | [![Build](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/build.yml/badge.svg)](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/build.yml) |
| Qodana | [![Qodana](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/qodana.yml/badge.svg)](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/qodana.yml) |
| CodeQL | [![CodeQL Scanning](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/codeql.yml/badge.svg)](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/codeql.yml) |
| Spotless | [![Syntax Check](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/syntax-check.yml/badge.svg)](https://github.com/OakvilleDynamics/frc-robot-template/actions/workflows/syntax-check.yml) |

## How to use

Expand All @@ -16,4 +17,4 @@

## Requirements

* WPILib 2023.2.1
* WPILib 2023.3.2
44 changes: 44 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id "java"
id "edu.wpi.first.GradleRIO" version "2023.2.1"
id 'com.diffplug.spotless' version '6.12.0'
}

sourceCompatibility = JavaVersion.VERSION_11
Expand Down Expand Up @@ -97,3 +98,46 @@ wpi.java.configureTestTasks(test)
tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}

spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**'
}
toggleOffOn()
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
groovyGradle {
target fileTree('.') {
include '**/*.gradle'
exclude '**/build/**', '**/build-*/**'
}
greclipse()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
format 'xml', {
target fileTree('.') {
include '**/*.xml'
exclude '**/build/**', '**/build-*/**'
}
eclipseWtp('xml')
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
format 'misc', {
target fileTree('.') {
include '**/*.md', '**/.gitignore'
exclude '**/build/**', '**/build-*/**'
}
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
}
6 changes: 3 additions & 3 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

package frc.robot;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import frc.robot.Constants.OperatorConstants;
import frc.robot.commands.Autos;
import frc.robot.commands.ExampleCommand;
import frc.robot.subsystems.ExampleSubsystem;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.Trigger;

/**
* This class is where the bulk of the robot should be declared. Since Command-based is a
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/commands/Autos.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

package frc.robot.commands;

import frc.robot.subsystems.ExampleSubsystem;
import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.Commands;
import frc.robot.subsystems.ExampleSubsystem;

public final class Autos {
/** Example static factory for an autonomous command. */
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/commands/ExampleCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package frc.robot.commands;

import frc.robot.subsystems.ExampleSubsystem;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.ExampleSubsystem;

/** An example command that uses an example subsystem. */
public class ExampleCommand extends CommandBase {
Expand Down

0 comments on commit 38bd8f8

Please sign in to comment.