File: pre-commit.sh

package info (click to toggle)
game-data-packager 85.1
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 33,332 kB
  • sloc: python: 15,320; sh: 713; ansic: 95; makefile: 60
file content (28 lines) | stat: -rwxr-xr-x 522 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Copyright 2023 Alexandre Detiste
# SPDX-License-Identifier: FSFAP

# minimal pre-commit hook to install into .git/hooks/pre-commit

set -e
set -u

CHANGES=$(git diff --name-only --cached --diff-filter=ACMR -- '***.py')

if [ -z "$CHANGES" ]
then
    exit 0
fi

pycodestyle $CHANGES
pyflakes3 $CHANGES

# https://github.com/fsfe/reuse-tool/issues/193
for change in $CHANGES
do
    if ! grep -q "SPDX-License-Identifier" "$change"
    then
        echo "missing SPDX info: in $change"
        exit 1
    fi
done