File: pre-commit

package info (click to toggle)
lapackpp 2024.10.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,500 kB
  • sloc: cpp: 80,181; ansic: 27,660; python: 4,838; xml: 182; perl: 99; makefile: 53; sh: 23
file content (23 lines) | stat: -rwxr-xr-x 848 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
#!/bin/sh
#
# Copyright (c) 2017-2023, University of Tennessee. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# This program is free software: you can redistribute it and/or modify it under
# the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
#
# Does style checks before committing code.
# Unfortunately, at the moment astyle does not properly parse all the
# C++ 11, 14, 17 syntax, so it formats things weirdly. Instead, this
# hook uses a simple Perl script to check for a subset of errors to fix.

script="tools/slate-style-reject.pl"
return=0

files=$(git diff --cached --name-only --diff-filter=ACMR \
        | grep -E "\.(c|cc|cpp|cxx|h|hh|hpp|hxx|cu|cuh)$")
#echo "files ${files}"
$script $files
return=$?

# Comment out exit in .git/hooks/pre-commit to check files but allow the commit.
exit $return