Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format the source code #917

Merged
merged 3 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/jguttman94/pre-commit-gradle
rev: efaf1704425cc50df91d63920e8353d9d081a622
hooks:
- id: gradle-task
args: [-w, -o, spotlessApply]
verbose: true

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,17 @@ Fluency fluency = builder.build();
##### Other configurations

Some of other usages are same as ingestion to Fluentd. See `Ingestion to Fluentd > Usage` above.

## Development

### Pre-commit hook

This project uses [pre-commit](https://pre-commit.com/) to automate code format and so on as much as possible. If you're interested in the development of this project, please [install pre-commit](https://pre-commit.com/#installation) and the git hook script as follows.

```
$ ls -a .pre-commit-config.yaml
.pre-commit-config.yaml
$ pre-commit install
```

The code formatter is automatically executed when committing files. A commit will fail and be formatted by the formatter when any invalid code format is detected. Try to commit the change again.
11 changes: 11 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ plugins {
`maven-publish`
id("com.github.kt3k.coveralls") version "2.12.2"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.diffplug.spotless") version "6.13.0"
}

subprojects {
Expand All @@ -26,6 +27,7 @@ subprojects {
apply(plugin = "maven-publish")
apply(plugin = "jacoco")
apply(plugin = "com.github.kt3k.coveralls")
apply(plugin = "com.diffplug.spotless")

repositories {
mavenCentral()
Expand Down Expand Up @@ -187,5 +189,14 @@ subprojects {
tasks.coveralls {
dependsOn(jacocoRootReport)
}

spotless {
java {
target("src/*/java/**/*.java")
importOrder()
removeUnusedImports()
googleJavaFormat("1.7")
}
}
}

Loading