Skip to content

Commit

Permalink
Adding new formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Aayush-Agnihotri committed Nov 23, 2024
1 parent fffe9c5 commit 0221e16
Show file tree
Hide file tree
Showing 45 changed files with 3,181 additions and 3,218 deletions.
14 changes: 4 additions & 10 deletions .github/hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#!/bin/sh

stagedFiles=$(git diff --staged --name-only)

# Run linter and formatter
echo "Running spotless. Formatting and linting code..."
mvn spotless:apply

# Readding changed files
for file in $stagedFiles; do
if test -f "$file"; then
git add $file
fi
done
# Run tests
echo "Running tests..."
mvn test
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ Before setting up the project, ensure you have the following installed:

### 1. Clone the Repository

After cloning, `cd` into the repo and run:

`git config core.hooksPath .github/hooks` to enable the pre-commit hook
`chmod +x .github/hooks/pre-commit` to mark the hook as an executable

### 2. Create application.properties

Create a new `application.properties` file located in `src/main/resources/` by copying the `application.properties.template` file in the same directory. Run:
Expand Down
213 changes: 106 additions & 107 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,112 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.appdev</groupId>
<artifactId>all-in</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>all-in</name>
<description>All In Backend</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.5</version>
<relativePath></relativePath>
<!-- lookup parent from repository -->
</parent>
<groupId>com.appdev</groupId>
<artifactId>all-in</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>all-in</name>
<description>All In Backend</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>
<configuration>
<java>
<cleanthat />
<googleJavaFormat/>
<importOrder/>
<removeUnusedImports />
<formatAnnotations />
<trimTrailingWhitespace />
<endWithNewline />
</java>
<pom>

<sortPom />
</pom>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.43.0</version>
<configuration>
<java>
<cleanthat></cleanthat>
<googleJavaFormat></googleJavaFormat>
<importOrder></importOrder>
<removeUnusedImports></removeUnusedImports>
<formatAnnotations></formatAnnotations>
<trimTrailingWhitespace></trimTrailingWhitespace>
<endWithNewline></endWithNewline>
</java>
<pom>
<sortPom></sortPom>
</pom>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
11 changes: 5 additions & 6 deletions src/main/java/com/appdev/allin/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@

import com.appdev.allin.player.PlayerRepo;
import com.appdev.allin.playerData.PlayerDataRepo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

@Autowired PlayerRepo playerRepo;
@Autowired PlayerRepo playerRepo;

@Autowired PlayerDataRepo playerDataRepo;
@Autowired PlayerDataRepo playerDataRepo;

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Loading

0 comments on commit 0221e16

Please sign in to comment.