Skip to content

Commit

Permalink
pre-commit docs #2 #14032
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Nov 10, 2023
1 parent a28deb7 commit 3796241
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: 'tests/.*'
exclude: '(tests|tools/contributed|tools/sumolib/scenario)/.*'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
Expand Down
23 changes: 22 additions & 1 deletion docs/web/docs/Developer/GitStuff.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: GitStuff

## Resolve LF status error

Occasionally, when adding files with different line endings to the
Occasionally, when adding binary files or files with different line endings to the
repository, a working copy may enter a state with changes that can not
be reverted (by stash or checkout).

Expand All @@ -26,3 +26,24 @@ git reset --hard
## Plot number of issues over time

https://sumo.dlr.de/ghis/


## Git commit hooks

We are using [pre-commit](https://pre-commit.com). To enable it for your checkout it should suffice to do
the following calls in your git repo:

```
pip install pre-commit
pre-commit install
```

It will enable checks for trailing whitespace, LF at the end of every file as well as parsable yaml files
and a maximum file size of 500kb. Every commit which does not pass the tests will fail.
Checks are not performed for the tests directory. Whitespace errors will
be repaired automatically, so that you can issue another commit right afterwards. More checks will probably be added later.
If you want to run the checks manually without committing,
you can just run `pre-commit`. If you want to check all files (not only the ones which will be part of the commit)
run `pre-commit run --all`.

The configuration can be found in `.pre-commit-config.yaml`.

0 comments on commit 3796241

Please sign in to comment.