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

[DRAFT] Spotless code format #161

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
echo BACKTRACE_SUBMISSION_URL=\"${{ secrets.BACKTRACE_SUBMISSION_URL }}\" >> ./local.properties
echo BACKTRACE_CORONER_URL=\"${{ secrets.BACKTRACE_CORONER_URL }}\" >> ./local.properties
echo BACKTRACE_CORONER_TOKEN=\"${{ secrets.BACKTRACE_CORONER_TOKEN }}\" >> ./local.properties

- name: Check Code Style
run: ./gradlew spotlessCheck
- name: Build and check
run: ./gradlew assembleDebug assembleDebugAndroidTest build check

Expand Down
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: local
hooks:
- id: test-hook
name: test-hook
entry: echo 'test'
language: system
stages: [pre-commit]
pass_filenames: false

# TODO: before merge - remove above and uncomment below
# - id: spotless-apply
# name: Spotless Apply
# entry: ./gradlew spotlessApply
# language: system
# stages: [pre-commit]
# pass_filenames: false
# - id: spotless-check
# name: Spotless Check
# entry: ./gradlew spotlessCheck
# language: system
# stages: [pre-commit]
# pass_filenames: false
38 changes: 21 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@ Thank you for considering contributing to Backtrace Android SDK library. Here ar

### Getting Started

1. **Clone the Repository**
- Clone the repository to your local machine using:
```bash
git clone https://github.com/backtrace-labs/backtrace-android.git
```

2. **Create a Branch**
- It's good practice to create a new branch for each feature or bugfix, if you have jira ticket put ticket number as branch prefix:
```bash
git checkout -b jira-ticket/your-feature-name
```
1. **Clone the repository**
```bash
git clone https://github.com/backtrace-labs/backtrace-android.git
```

2. **Install pre-commit**
```bash
pip install pre-commit
pre-commit install
```

3. **Create a branch** - it's good practice to create a new branch for each feature or bugfix, if you have jira ticket put ticket number as branch prefix:
```bash
git checkout -b jira-ticket/your-feature-name
```

3. **Update submodules**
```bash
git submodule update --recursive --remote
git submodule update --init --recursive
```

4. **Update submodules**
```bash
git submodule update --recursive --remote
git submodule update --init --recursive
```
### Coding Guidelines

1. **Code Formatting**
Expand Down
19 changes: 19 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ buildscript {
}
}

plugins {
id 'com.diffplug.spotless' version '6.25.0' apply false
}

subprojects {
apply plugin: 'com.diffplug.spotless'
spotless {
java {
googleJavaFormat('1.25.2') // Specify the version of Google Java Format
indentWithTabs(1)
indentWithSpaces(2)
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**', '**/.cxx/**'
}
}
}
}

allprojects {
repositories {
google()
Expand Down
Loading