Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
  • Loading branch information
PGgit08 committed Nov 16, 2024
1 parent 4527221 commit 8a1eacf
Show file tree
Hide file tree
Showing 7 changed files with 333 additions and 249 deletions.
50 changes: 49 additions & 1 deletion 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 "2025.1.1-beta-1"
id 'com.diffplug.spotless' version '6.20.0'
}

java {
Expand Down Expand Up @@ -85,7 +86,11 @@ wpi.sim.addDriverstation()
// in order to make them all available at runtime. Also adding the manifest so WPILib
// knows where to look for our Robot Class.
jar {
from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
from sourceSets.main.allSource
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
Expand All @@ -100,3 +105,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()
}
}
4 changes: 1 addition & 3 deletions src/main/java/frc/lib/InputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

// (from team 1155)

/**
* A functional interface to aid in modifying double suppliers, such as from a joystick.
*/
/** A functional interface to aid in modifying double suppliers, such as from a joystick. */
@FunctionalInterface
public interface InputStream extends DoubleSupplier {

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package frc.robot;

import com.ctre.phoenix6.SignalLogger;

import dev.doglog.DogLog;
import dev.doglog.DogLogOptions;
import edu.wpi.first.epilogue.Epilogue;
Expand Down Expand Up @@ -38,7 +37,7 @@ public Robot() {

// set up loggers
DogLog.setOptions(new DogLogOptions().withNtPublish(true));

Epilogue.bind(this);

SignalLogger.start();
Expand Down
48 changes: 25 additions & 23 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,37 @@
*/
@Logged(strategy = Strategy.OPT_IN)
public class RobotContainer {
// controllers
private final CommandXboxController _driverController = new CommandXboxController(Ports.driverController);
// controllers
private final CommandXboxController _driverController =
new CommandXboxController(Ports.driverController);

// subsystems
@Logged(name = "Swerve")
private CommandSwerveDrivetrain _swerve = TunerConstants.createDrivetrain();

/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
_swerve.setDefaultCommand(_swerve.drive(
InputStream.of(_driverController::getLeftY)
.negate()
.scale(SwerveConstants.maxTranslationSpeed.in(MetersPerSecond)),
InputStream.of(_driverController::getLeftX)
.negate()
.scale(SwerveConstants.maxTranslationSpeed.in(MetersPerSecond)),
InputStream.of(_driverController::getRightX)
.negate()
.scale(SwerveConstants.maxAngularSpeed.in(RadiansPerSecond))));

configureDriverController();
}

private void configureDriverController() {}
/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
_swerve.setDefaultCommand(
_swerve.drive(
InputStream.of(_driverController::getLeftY)
.negate()
.scale(SwerveConstants.maxTranslationSpeed.in(MetersPerSecond)),
InputStream.of(_driverController::getLeftX)
.negate()
.scale(SwerveConstants.maxTranslationSpeed.in(MetersPerSecond)),
InputStream.of(_driverController::getRightX)
.negate()
.scale(SwerveConstants.maxAngularSpeed.in(RadiansPerSecond))));

configureDriverController();
}

private void configureDriverController() {}

/**
* @return The command to run in autonomous.
*/
public Command getAutonomousCommand() {
return Autos.none();
}
}
public Command getAutonomousCommand() {
return Autos.none();
}
}
6 changes: 2 additions & 4 deletions src/main/java/frc/robot/commands/Autos.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package frc.robot.commands;

import static edu.wpi.first.wpilibj2.command.Commands.*;
import static edu.wpi.first.wpilibj2.command.Commands.*;

import edu.wpi.first.wpilibj2.command.Command;

Expand All @@ -13,9 +13,7 @@ private Autos() {
throw new UnsupportedOperationException("This is a utility class!");
}

/**
* An auto that doesn't do anything for 15 sec.
*/
/** An auto that doesn't do anything for 15 sec. */
public static Command none() {
return idle();
}
Expand Down
Loading

0 comments on commit 8a1eacf

Please sign in to comment.