I've configured Emacs to open files named `*.cfg` in shell-script-mode. These are config files, of course, rather than shell scripts, but 90% of the time it does what I want (mainly, good guesses about faces for comments and variable assignment). I use [flycheck-mode](https://flycheck.readthedocs.org/), and I like it enough to have `global-flycheck-mode` enabled. The problem is that, in the case of `*.cfg` files, flychceck-mode suggests lots of errors that aren't relevant.

Is there a way to disable flycheck-mode automagically based on either file name or the path to the file? The closest I've seen is [flycheck-before-syntax-check-hook](https://flycheck.readthedocs.org/en/latest/guide/usage.html#el.variable.flycheck-before-syntax-check-hook)...I could imagine sticking in a check for path or filename, but it runs before each syntax check (rather than disabling checks entirely).