-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Static Code Analysis | ||
|
||
This project uses static code analysis in order to ensure that the codebase meets certain standards | ||
that can be verified through automation. Two of these libraries used throughout this project are | ||
Detekt and Ktlint. | ||
|
||
## Detekt | ||
|
||
[Detekt](https://github.com/detekt/detekt) is a static analysis tool that checks for code smells. | ||
Examples include magic numbers, complicated conditionals, long methods, long parameter lists, and so | ||
much more. It is highly configurable, and if you choose to turn off any checks or customize | ||
thresholds you can do so in the [config file](/config/detekt/detekt.yml). | ||
|
||
To run a detekt validation, use the following Gradle command: | ||
|
||
``` | ||
./gradlew detekt | ||
``` | ||
|
||
## Ktlint | ||
|
||
[Ktlint](https://github.com/pinterest/ktlint) is a static analysis tool from Pinterest that prevents | ||
bike shedding when it comes to code formatting. It also comes with a Gradle task to automatically | ||
format your entire codebase, if it can. The benefit of a tool like this is to ensure everyone on the | ||
team will have code formatted the same way, and there's no debating around white spaces, | ||
indentation, imports, etc. | ||
|
||
We use the [JLLeitschuh](https://github.com/jlleitschuh/ktlint-gradle) Ktlint Gradle plugin in this | ||
project. You can find the setup in [this Gradle file](/buildscripts/ktlint.gradle). | ||
|
||
The following Gradle commands can be helpful: | ||
|
||
``` | ||
// Format the Codebase | ||
./gradlew ktlintFormat | ||
// Check if everything is formatted correctly | ||
./gradlew ktlintCheck | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Versions Plugin | ||
|
||
This project uses the [Gradle Versions Plugin](https://github.com/ben-manes/gradle-versions-plugin) | ||
from Ben Manes. Ths is an extremely helpful plugin that will check all of the dependencies in the | ||
project, and see if they have any new versions. Currently, it is configured to only check for stable | ||
versions, but you can customize that inside [this Gradle file](/buildscripts/versions.gradle). | ||
|
||
To run this check of dependency updates, use the following Gradle command: | ||
|
||
``` | ||
./gradlew dependencyUpdates | ||
``` | ||
|
||
This will print the updates to the console, as well as in a text file. |