Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from Catrobat/pre-commit
Browse files Browse the repository at this point in the history
Dev: Pre commit Hooks
  • Loading branch information
moberer authored Mar 13, 2024
2 parents 6bba419 + 986fd7c commit cda65d7
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 5 deletions.
40 changes: 40 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
repos:
- repo: local
hooks:
- id: gdformat
name: gdformat
description: format gdscript files
entry: gdformat
language: system
types: [gdscript]
pass_filenames: true
- id: gdlint
name: gdlint
description: lint gdscript files
entry: gdlint
language: system
types: [gdscript]
pass_filenames: true
- id: fmt
name: fmt
description: Format files with cargo fmt.
entry: sh -c "cd rust; cargo fmt"
language: system
types: [rust]
args: ["--"]
- id: cargo-check
name: cargo check
description: Check the package for errors.
entry: sh -c "cd rust; cargo check"
language: system
types: [rust]
pass_filenames: false
- id: clippy
name: clippy
description: Lint rust sources
entry: sh -c "cd rust; cargo clippy"
language: system
args: ["--", "-D", "warnings"]
types: [rust]
pass_filenames: false

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
- just
- gdtoolkit
IMPORTANT: Needs to be in the path!
- pre-commit

## Set up the Repository

```
just setup
```

This will generate a local development keypair for Android test builds.
This command will
- check whether all development dependencies are present and in $PATH
- generate development signing keys for Android
- install pre-commit hooks (automatic formatting and linting before a commit)
- install the necessary rust components


### Manual Steps
Expand Down
2 changes: 1 addition & 1 deletion godot/addons/format_on_save/format_on_save.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class_name FormatOnSave extends EditorPlugin

const SUCCESS: int = 0
const AUTO_RELOAD_SETTING: String = "text_editor/behavior/files/auto_reload_scripts_on_external_change"
const AUTO_RELOAD_SETTING = "text_editor/behavior/files/auto_reload_scripts_on_external_change"
var original_auto_reload_setting: bool


Expand Down
4 changes: 2 additions & 2 deletions godot/src/AddStatement.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ extends Button

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
func _process(_delta):
pass
2 changes: 1 addition & 1 deletion godot/src/TestAPI.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ func _ready():


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
func _process(_delta):
print(API.damage(2))
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ setup-verify-dependencies:
rustup --version
godot --version
gdformat --version
pre-commit --version

setup-debug-keystore:
@ {{message}} "Generating debug keypair for Android..."
test -f {{android_keystore}} \
|| keytool -keyalg RSA -genkeypair -alias androiddebugkey -keypass android -keystore {{android_keystore}} -storepass android -dname "CN=Android Debug,O=Android,C=US" -validity 9999 -deststoretype pkcs12

setup-precommit:
@ {{message}} "Setting up pre-commit hooks"
pre-commit init

setup-rust:
rustup toolchain install stable
rustup default stable
Expand Down

0 comments on commit cda65d7

Please sign in to comment.