Skip to content

Commit

Permalink
Gradle lint (#20)
Browse files Browse the repository at this point in the history
* Adding CheckStyle checks

* Fixing pipeline issues
  • Loading branch information
isontheline authored May 25, 2024
1 parent 21cc899 commit 93b00fc
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "17",
"jdkDistro": "ms",
"installGradle": "true",
"gradleVersion": "latest"
"gradleVersion": "8.7"
},
"ghcr.io/devcontainers/features/node:1": {}
},
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ jobs:
with:
node-version: 20
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.7

- name: Display Tools Versions
run: |
gradle -v
echo "Node $(node -v)"
echo "NPM $(npm -v)"
- name: Create Release
if: github.ref == 'refs/heads/main'
Expand All @@ -26,7 +34,7 @@ jobs:
run: npm version from-git --no-git-tag-version --prefix docs

- name: Test dRAGon
run: gradle npmInstall npmLint test
run: gradle npmInstall npmLint checkstyleMain checkstyleTest test

- name: Build Documentation
run: npm install --prefix docs && npm run build --prefix docs
Expand Down
11 changes: 10 additions & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
plugins {
id 'java'
id 'java-library'
id 'checkstyle'
id 'application'
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.4'
id "org.springdoc.openapi-gradle-plugin" version "1.8.0"
id 'org.springdoc.openapi-gradle-plugin' version '1.8.0'
}

group = 'ai'
Expand Down Expand Up @@ -54,6 +56,13 @@ openApi {
}
}

checkstyle {
toolVersion '10.16.0'
config = rootProject.resources.text.fromFile('backend/checkstyle.xml')
ignoreFailures = false
maxWarnings = 0
}

bootJar {
manifest {
attributes(
Expand Down
28 changes: 28 additions & 0 deletions backend/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="charset" value="UTF-8"/>
<module name="TreeWalker">
<module name="CommentsIndentation"/>
<module name="PackageDeclaration"/>
<module name="AvoidStarImport"/>
<module name="ConstantName"/>
<module name="EmptyBlock"/>
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="arrayInitIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
</module>
</module>
<module name="NewlineAtEndOfFile"/>
<module name="LineLength">
<property name="max" value="160"/>
</module>
<module name="FileTabCharacter">
<property name="eachLine" value="false"/>
</module>
</module>
6 changes: 3 additions & 3 deletions backend/src/main/java/ai/dragon/DragonApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@SpringBootApplication
public class DragonApplication {
public static void main(String[] args) {
SpringApplication.run(DragonApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(DragonApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ private void createDatabaseDirectory() {
logger.debug("Database directory already exists : " + databaseDirectory);
}
}
}
}
4 changes: 3 additions & 1 deletion backend/src/main/java/ai/dragon/entity/ProviderEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public class ProviderEntity implements IAbstractEntity {
@Schema(description = "Type of the Provider")
private ProviderType type;

@Schema(description = "Headers to be sent to the Provider (if applicable) in the form of key-value pairs. Could be used for authentication with API keys, tokens, etc.")
@Schema(description = """
Headers to be sent to the Provider (if applicable) in the form of key-value pairs.
Could be used for authentication with API keys, tokens, etc.""")
private Map<String, String> httpHeaders;

public ProviderEntity() {
Expand Down
8 changes: 3 additions & 5 deletions backend/src/test/java/ai/dragon/DragonApplicationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

@SpringBootTest
class DragonApplicationTests {

@Test
void contextLoads() {
}

@Test
void contextLoads() {
}
}

0 comments on commit 93b00fc

Please sign in to comment.