Skip to content

Commit bee4303

Browse files
committed
Add an empty Custom.hs to simplify site-specific patching
1 parent ef764b6 commit bee4303

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
to specify search paths for sourced files.
1111
- json1 format like --format=json but treats tabs as single characters
1212
- Recognize FLAGS variables created by the shflags library.
13+
- Site-specific changes can now be made in Custom.hs for ease of patching
1314
- SC2154: Also warn about unassigned uppercase variables (optional)
1415
- SC2252: Warn about `[ $a != x ] || [ $a != y ]`, similar to SC2055
1516
- SC2251: Inform about ineffectual ! in front of commands

ShellCheck.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ library
7474
ShellCheck.AnalyzerLib
7575
ShellCheck.Checker
7676
ShellCheck.Checks.Commands
77+
ShellCheck.Checks.Custom
7778
ShellCheck.Checks.ShellSupport
7879
ShellCheck.Data
7980
ShellCheck.Fixer

src/ShellCheck/Analyzer.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import ShellCheck.Interface
2525
import Data.List
2626
import Data.Monoid
2727
import qualified ShellCheck.Checks.Commands
28+
import qualified ShellCheck.Checks.Custom
2829
import qualified ShellCheck.Checks.ShellSupport
2930

3031

@@ -41,6 +42,7 @@ analyzeScript spec = newAnalysisResult {
4142

4243
checkers params = mconcat $ map ($ params) [
4344
ShellCheck.Checks.Commands.checker,
45+
ShellCheck.Checks.Custom.checker,
4446
ShellCheck.Checks.ShellSupport.checker
4547
]
4648

src/ShellCheck/Checks/Custom.hs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{-
2+
This empty file is provided for ease of patching in site specific checks.
3+
However, there are no guarantees regarding compatibility between versions.
4+
-}
5+
6+
{-# LANGUAGE TemplateHaskell #-}
7+
module ShellCheck.Checks.Custom (checker, ShellCheck.Checks.Custom.runTests) where
8+
9+
import ShellCheck.AnalyzerLib
10+
import Test.QuickCheck
11+
12+
checker :: Parameters -> Checker
13+
checker params = Checker {
14+
perScript = const $ return (),
15+
perToken = const $ return ()
16+
}
17+
18+
prop_CustomTestsWork = True
19+
20+
return []
21+
runTests = $quickCheckAll

test/shellcheck.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import qualified ShellCheck.Analytics
66
import qualified ShellCheck.AnalyzerLib
77
import qualified ShellCheck.Checker
88
import qualified ShellCheck.Checks.Commands
9+
import qualified ShellCheck.Checks.Custom
910
import qualified ShellCheck.Checks.ShellSupport
1011
import qualified ShellCheck.Fixer
1112
import qualified ShellCheck.Formatter.Diff
@@ -18,6 +19,7 @@ main = do
1819
,ShellCheck.AnalyzerLib.runTests
1920
,ShellCheck.Checker.runTests
2021
,ShellCheck.Checks.Commands.runTests
22+
,ShellCheck.Checks.Custom.runTests
2123
,ShellCheck.Checks.ShellSupport.runTests
2224
,ShellCheck.Fixer.runTests
2325
,ShellCheck.Formatter.Diff.runTests

0 commit comments

Comments
 (0)