Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cSpell to NUKE build pipeline #2086

Merged
merged 19 commits into from Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/spellcheck.yml
@@ -0,0 +1,27 @@
name: Documentation Checks
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches:
- develop
paths:
# This ensures the check will only be run when something changes in the docs content
- "docs/**/*" # or whatever the path to the markdown / docs files happens to be
pull_request:
branches:
- develop
paths:
- "docs/**/*"
jobs:
spellcheck:
name: "Docs: Spellcheck"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
name: Check out the code
- uses: actions/setup-node@v1
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
name: Setup node
with:
node-version: "16"
- name: Run NUKE spell check
run: ./build.sh Spellcheck
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -7,7 +7,7 @@
*.sln.docstates
*.sln.ide
.vs/

.vscode/

project.lock.json
*.nuget.props
Expand Down
2 changes: 2 additions & 0 deletions .nuke/build.schema.json
Expand Up @@ -84,6 +84,7 @@
"Pack",
"Push",
"Restore",
"Spellcheck",
"TestFrameworks",
"UnitTests"
]
Expand All @@ -107,6 +108,7 @@
"Pack",
"Push",
"Restore",
"Spellcheck",
"TestFrameworks",
"UnitTests"
]
Expand Down
21 changes: 21 additions & 0 deletions Build/Build.cs
Expand Up @@ -8,11 +8,13 @@
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.Npm;
using Nuke.Common.Tools.ReportGenerator;
using Nuke.Common.Tools.Xunit;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.Npm.NpmTasks;
using static Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks;
using static Nuke.Common.Tools.Xunit.XunitTasks;

Expand Down Expand Up @@ -47,6 +49,9 @@ class Build : NukeBuild
[PackageExecutable("nspec", "NSpecRunner.exe", Version = "3.1.0")]
Tool NSpec3;

[PathExecutable("bash")]
Tool Bash;

AbsolutePath ArtifactsDirectory => RootDirectory / "Artifacts";

AbsolutePath TestResultsDirectory => RootDirectory / "TestResults";
Expand Down Expand Up @@ -246,5 +251,21 @@ class Build : NukeBuild
(v, path) => v.SetTargetPath(path)));
});

Target Spellcheck => _ => _
.OnlyWhenDynamic(() => !IsLocalBuild)
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
.Executes(() =>
{
InstallCSpell();

var cSpellFile = RootDirectory / "cSpell.json";
var docsDirectory = RootDirectory / "docs";
Bash($"-c \"cspell --config {cSpellFile} '{docsDirectory}/**/*.md' --no-progress\"");
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
});

private void InstallCSpell()
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
{
Npm("install -g cspell");
}

bool IsTag => BranchSpec != null && BranchSpec.Contains("refs/tags", StringComparison.InvariantCultureIgnoreCase);
}
81 changes: 81 additions & 0 deletions cSpell.json
@@ -0,0 +1,81 @@
{
"version": "0.2",
"language": "en",
"words": [
"browsable",
"Doomen",
"formattable",
"Guids",
"LINQ",
"parameterless",
"refactorings",
"struct"
],
"ignoreWords": [
"Gallio"
],
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
"patterns": [
{
"name": "Markdown links",
"pattern": "\\((.*)\\)",
"description": ""
},
{
"name": "Markdown code blocks",
"pattern": "/^(\\s*`{3,}).*[\\s\\S]*?^\\1/gmx",
"description": "Taken from the cSpell example at https://cspell.org/configuration/patterns/#verbose-regular-expressions"
},
{
"name": "Inline code blocks",
"pattern": "\\`([^\\`\\r\\n]+?)\\`",
"description": "https://stackoverflow.com/questions/41274241/how-to-capture-inline-markdown-code-but-not-a-markdown-code-fence-with-regex"
},
{
"name": "Link contents",
"pattern": "\\<a(.*)\\>",
"description": ""
},
{
"name": "Snippet references",
"pattern": "-- snippet:(.*)",
"description": ""
},
{
"name": "Snippet references 2",
"pattern": "\\<\\[sample:(.*)",
"description": "another kind of snippet reference"
},
{
"name": "Multi-line code blocks",
"pattern": "/^\\s*```[\\s\\S]*?^\\s*```/gm"
},
{
"name": "HTML Tags",
"pattern": "<[^>]*>",
"description": "Reference: https://stackoverflow.com/questions/11229831/regular-expression-to-remove-html-tags-from-a-string"
},
{
"name": "Frontmatter",
"pattern": "/^([-]{3}|[+]{3}|[.]{3})$[\\s\\S]+^([-]{3}|[+]{3}|[.]{3})$/gm"
},
{
"name": "Liquid Includes",
"pattern": "\\{%(.*) %\\}"
}
],
"ignoreRegExpList": [
"Markdown links",
"Markdown code blocks",
"Inline code blocks",
"Link contents",
"Snippet references",
"Snippet references 2",
"Multi-line code blocks",
"HTML Tags",
"Frontmatter",
"Liquid Includes"
],
"ignorePaths": [
"docs/_pages/releases.md"
]
}
2 changes: 1 addition & 1 deletion docs/README.md
Expand Up @@ -8,7 +8,7 @@ The Fluent Assertions [landing page](https://fluentassertions.com) is using Jeky

* Ruby 3.1.
* An easy way to install is to use `choco install ruby`.
* Or use the **Ruby+Devkit installer** from [RubyInstaller for Windows](https://rubyinstaller.org/downloads/archives/).
* Or use the **`Ruby+Devkit` installer** from [RubyInstaller for Windows](https://rubyinstaller.org/downloads/archives/).
* Note that you may have to reopen your command shell to get the `ruby --version` command to work,
* The `bundler`
* Run `gem install bundler` to install it. If you receive SSL-related errors while running gem install, try running `refreshenv` first.
Expand Down