Lefthook einrichten #3

Closed
opened 2026-09-25 11:58:17 +00:00 by hobbypunk · 0 comments
Owner

Für unser arbeits rails projekt hab ich folgende lefthook.yml

output:
  - failure        # Print failed steps
  - execution_out  # Print actual output from failing commands

pre-commit:
  parallel: true
  commands:
    bundle check:
      run: bundle check
    active record doctor:
      glob: "{db/migrate/*.rb,app/models/*.rb}"
      run: bundle exec rails active_record_doctor
    database consistency:
      glob: "{db/migrate/*.rb,app/models/*.rb}"
      run: bundle exec database_consistency
    lint ruby:
      glob: "{Gemfile,*.rb,*.rake}"
      run: bundle exec rubocop -xa --force-exclusion {staged_files} && bundle exec rubocop --force-exclusion {staged_files}
      stage_fixed: true
    lint haml:
      glob: "*.haml"
      run: bundle exec haml-lint {staged_files}
    lint js:
      glob: "*.js"
      run: bun lint {staged_files}
    lint css:
      glob: "*.pcss"
      run: bun lint:css {staged_files}
    i18n health:
      glob: "{app,config/locales}/**/*.{haml,rb,yml}"
      run: bundle exec i18n-tasks normalize && bundle exec i18n-tasks health
      stage_fixed: true
pre-push:
  parallel: true
  scripts:
    branch_validation.sh:
      runner: bash
post-checkout: &post-actions
  parallel: true
  commands:
    git pull:
      skip:
        - rebase
        - merge
      run: git pull
    bundle install:
      run: mise install ruby && bundle install
    bun install:
      run: mise install bun && bun install
post-merge: *post-actions
post-rewrite: *post-actions
prepare-commit-msg:
  parallel: false
  skip:
    - merge
    - rebase
  commands:
    opencode co-author:
      priority: 100
      run: |
        echo "" >> "{1}"
        echo "Co-Authored-By: opencode (Mistral GLM) <opencode-agent[bot]@users.noreply.github.com>" >> "{1}"
        rm -f .opencode-changes.md
      skip:
        - run: "! test -f .opencode-changes.md"

kannst du bitte schauen, was wir davon für unser Projekt übernehmen können/wollen, bzw was sinnvoll ist?
ich weiß z.b. das wir kein haml haben, also ist das quatsch. aber wir haben i18n und aktuell glaube kein i18n-tasks drin, sprich das könnten wir nachrüsten.

wenn du noch ideens für andere sinnvolle hooks hast, kannst dus gerne vorschlagen

Für unser arbeits rails projekt hab ich folgende lefthook.yml ``` output: - failure # Print failed steps - execution_out # Print actual output from failing commands pre-commit: parallel: true commands: bundle check: run: bundle check active record doctor: glob: "{db/migrate/*.rb,app/models/*.rb}" run: bundle exec rails active_record_doctor database consistency: glob: "{db/migrate/*.rb,app/models/*.rb}" run: bundle exec database_consistency lint ruby: glob: "{Gemfile,*.rb,*.rake}" run: bundle exec rubocop -xa --force-exclusion {staged_files} && bundle exec rubocop --force-exclusion {staged_files} stage_fixed: true lint haml: glob: "*.haml" run: bundle exec haml-lint {staged_files} lint js: glob: "*.js" run: bun lint {staged_files} lint css: glob: "*.pcss" run: bun lint:css {staged_files} i18n health: glob: "{app,config/locales}/**/*.{haml,rb,yml}" run: bundle exec i18n-tasks normalize && bundle exec i18n-tasks health stage_fixed: true pre-push: parallel: true scripts: branch_validation.sh: runner: bash post-checkout: &post-actions parallel: true commands: git pull: skip: - rebase - merge run: git pull bundle install: run: mise install ruby && bundle install bun install: run: mise install bun && bun install post-merge: *post-actions post-rewrite: *post-actions prepare-commit-msg: parallel: false skip: - merge - rebase commands: opencode co-author: priority: 100 run: | echo "" >> "{1}" echo "Co-Authored-By: opencode (Mistral GLM) <opencode-agent[bot]@users.noreply.github.com>" >> "{1}" rm -f .opencode-changes.md skip: - run: "! test -f .opencode-changes.md" ``` kannst du bitte schauen, was wir davon für unser Projekt übernehmen können/wollen, bzw was sinnvoll ist? ich weiß z.b. das wir kein haml haben, also ist das quatsch. aber wir haben i18n und aktuell glaube kein i18n-tasks drin, sprich das könnten wir nachrüsten. wenn du noch ideens für andere sinnvolle hooks hast, kannst dus gerne vorschlagen
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hobbypunk/rails-base_app#3
No description provided.