More precise filename detection for shell scripts

Make the regular expression much more precise:

* match literal dots instead of any char (match rc.conf but not rcXconf)
* match special filenames exactly (match PKGBUILD but not myPKGBUILD.something)

Run build-all to update internal/config/runtime.go

closes #2163
This commit is contained in:
pyfisch 2021-07-21 21:44:32 +02:00 committed by Pyfisch
parent 84a490f14c
commit 6e1fe5b301
2 changed files with 27 additions and 5 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,29 @@
filetype: shell
# Detection based on filename is rather complicated as there are many
# different file extensions and special filenames in use.
# This expressions aims to capture them all while not matching
# filenames that coincidentally contain the same substring.
#
# File extensions:
# * .sh
# * .bash
# * .ash
# * .ebuild (Gentoo ebuild format)
#
# Special filenames:
# * .bashrc, .bash_aliases, .bash_functions
# * profile, .profile (/etc/profile or ~/.profile)
# * Pkgfile
# * pkgmk.conf
# * rc.conf
# * PKGBUILD (Arch Linux build scripts)
# * APKBUILD
#
# Fix command (fc) files:
# * bash-fc. (followed by a random string)
detect:
filename: "(\\.sh$|\\.bash|\\.ash|bashrc|bash_aliases|bash_functions|profile|bash-fc\\.|Pkgfile|pkgmk.conf|rc.conf|PKGBUILD|.ebuild\\$|APKBUILD)"
filename: '(\.(sh|bash|ash|ebuild)$|^(\.bash(rc|_aliases|_functions)|\.?profile|Pkgfile|pkgmk\.conf|rc\.conf|PKGBUILD|APKBUILD)$|^bash-fc\.)'
header: "^#!.*/(env +)?(ba)?(a)?(mk)?sh( |$)"
rules: