Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2 from 7SOATSquad30/build/add-static-analysis
Browse files Browse the repository at this point in the history
build: add static analysis
  • Loading branch information
MuriloKakazu authored May 1, 2024
2 parents 02d6d3d + 1980be5 commit ff52a51
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 32 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ jobs:
- name: Code linting
run: ./gradlew spotlessCheck

- name: Static analysis
run: |
./gradlew pmdMain
./gradlew pmdTest
- name: Build
run: ./gradlew clean build

Expand Down
68 changes: 37 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,54 +1,60 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.4'
id 'com.diffplug.spotless' version '6.25.0'
id 'java'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.4'
id 'com.diffplug.spotless' version '6.25.0'
id 'pmd'
}

group = 'br.com.fiap.grupo30'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '21'
sourceCompatibility = '21'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
compileOnly {
extendsFrom annotationProcessor
}
}

spotless {
format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '.gitattributes', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
googleJavaFormat('1.22.0').aosp().reflowLongStrings().skipJavadocFormatting()
formatAnnotations()
target 'src/main/**/*.java', 'src/test/**/*.java'
}
format 'misc', {
target '*.gradle', '.gitattributes', '.gitignore'

trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
java {
googleJavaFormat('1.22.0').aosp().reflowLongStrings().skipJavadocFormatting()
formatAnnotations()
target 'src/main/**/*.java', 'src/test/**/*.java'
}
}

pmd {
toolVersion = '7.1.0'
ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"]
consoleOutput = true
sourceSets = [sourceSets.main, sourceSets.test]
}

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package br.com.fiap.grupo30.fastfood;

import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class FastfoodApplicationTests {

@Test
void contextLoads() {}
void contextLoads() {
int x = 1;
int y = 1;
assertTrue(x == y, "assertion failed");
}
}

0 comments on commit ff52a51

Please sign in to comment.