Chore(Fortune): add pre-commit to check special events #55
36
.pre-commit-config.yaml
Normal file
36
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
# See https://pre-commit.com for more information
|
||||
|
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: check-cyclical-event
|
||||
name: check-cyclical-event
|
||||
entry: python3 scripts/check-events.py fortune_generator/json/cyclical_special.json cyclical
|
||||
language: python
|
||||
files: fortune_generator/json/cyclical_special.json
|
||||
types: [json]
|
||||
pass_filenames: false
|
||||
|
||||
- id: check-custom-event
|
||||
name: check-custom-event
|
||||
entry: python3 scripts/check-events.py fortune_generator/json/custom_special.json custom
|
||||
language: python
|
||||
files: fortune_generator/json/custom_special.json
|
||||
types: [json]
|
||||
pass_filenames: false
|
||||
|
||||
- id: check-static-event
|
||||
name: check-static-event
|
||||
entry: python3 scripts/check-events.py fortune_generator/json/static_special.json static
|
||||
language: python
|
||||
files: fortune_generator/json/static_special.json
|
||||
types: [json]
|
||||
pass_filenames: false
|
||||
Reference in New Issue
Block a user
Use the latest version v5.0.0
I noticed you're using a shell script wrapper to run the Python scripts. Since
check-events.pyis a Python program, I'd recommend calling it directly rather than through a shell script wrapper.This approach would be more Windows-friendly, as shell scripts can be problematic on Windows environments. Making this change will ensure developers across all platforms can use the pre-commit hooks without issue.
I switched to using a Python script because passing parameters directly is difficult.
Isn't this working?
entry: python3 scripts/check-events.py fortune_generator/json/custom_special.json customOh.
It works.
But I think this way can check three files and list all errors.
Instead of checking after each modification.
What do you mean by "checking after each modification"?
Modify, commit, and then pre-commit check.
Why do you need to check after each modification?
It doesn't work.
This can work.
However, it's not possible to check all three files at the same time.
Set
language: systeminstead oflanguage: pythonbecause we're utilizing shell functionality rather than running a standalone Python script.We have concluded that we should not use bash.
Yes.
I already setted
Yes
What is the problem of it not working?
Changing to language: system allows it to work properly.