File: checkpatch.sh

package info (click to toggle)
openfortivpn 1.24.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 856 kB
  • sloc: perl: 6,035; ansic: 6,015; sh: 119; makefile: 76; python: 22
file content (25 lines) | stat: -rwxr-xr-x 656 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
#!/usr/bin/env bash
# Copyright (c) 2020 Dimitri Papadopoulos

# Path to checkpatch.pl
script_dir=$(dirname "${BASH_SOURCE[0]}")
checkpatch_path=$(realpath "${script_dir}/../ci/checkpatch/checkpatch.pl")

rc=0

for file in "$@"; do
  tmp=$(mktemp)

  "$checkpatch_path" --no-tree --terse \
    --ignore MACRO_ARG_UNUSED,LEADING_SPACE,SPDX_LICENSE_TAG,CODE_INDENT,NAKED_SSCANF,VOLATILE,NEW_TYPEDEFS,LONG_LINE,LONG_LINE_STRING,QUOTED_WHITESPACE_BEFORE_NEWLINE,STRCPY,STRLCPY,STRNCPY \
    -f "$file" | tee "$tmp"
  
  if [ -s "$tmp" ]; then
    echo "error: $file does not comply with Linux kernel coding style" >&2
    rc=1
  fi

  rm "$tmp"
done

exit $rc