Skip to content

Commit

Permalink
Adding CheckStyle checks
Browse files Browse the repository at this point in the history
  • Loading branch information
isontheline committed May 24, 2024
1 parent 21cc899 commit ec87b8c
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: npm version from-git --no-git-tag-version --prefix docs

- name: Test dRAGon
run: gradle npmInstall npmLint test
run: gradle criticalLintGradle checkstyleMain npmInstall npmLint 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

0 comments on commit ec87b8c

Please sign in to comment.