forked from exercism/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-code-snippets.ps1
46 lines (40 loc) · 1.7 KB
/
check-code-snippets.ps1
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<#
.SYNOPSIS
Validate F# code snippets in concept exercise documentation.
.DESCRIPTION
Run a CLI utility that will:
- recursively search a list of directories for Markdown documentation
- extract any F# code snippets
- evaluate them to verify correct syntax (no type checking is performed)
.PARAMETER SourceDirectories
A list of directories containing Markdown documentation (defaults to ["concepts","exercises"]).
.PARAMETER Exclude
A list of directories to ignore (optional).
.EXAMPLE
PS C:\> ./check-code-snippets.ps1
Verifies all *.md files under the `concepts` and `exercises` directories
.EXAMPLE
PS C:\> ./check-code-snippets.ps1 -Dirs "concepts/recursion exercises/concept/pizza-pricing"
Verifies the *.md files under `concepts/recursion` and `exercises/concept/pizza-pricing`
.EXAMPLE
PS C:\> ./check-code-snippets.ps1 -Exclude "concepts/arrays exercises/concept/bird-watcher"
Ignores the *.md files in `concepts/arrays` and `exercises/concept/bird-watcher` while verifying all the others
.EXAMPLE
PS C:\> ./check-code-snippets.ps1 exercises -Not "exercises/practice/acronym"
Verifies the *.md files under the `exercises` directory, except those in `exercises/practice/acronym`
#>
[CmdletBinding()]
param (
[Parameter(Position = 0, Mandatory = $false)]
[alias("Dirs")]
[string[]]$SourceDirectories=@("concepts", "exercises"),
[Parameter(Position = 1, Mandatory = $false)]
[alias("Not")]
[string[]]$Exclude=@()
)
# Import shared functionality
. ./shared.ps1
$toolDir = Resolve-Path "tools/CodeFenceChecker"
Write-Output "Searching documentation for code snippets"
Run-Command "dotnet run -c Release --project $toolDir"
exit $LastExitCode