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 13 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
25 changes: 25 additions & 0 deletions .github/workflows/spellcheck.yml
@@ -0,0 +1,25 @@
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@v3
with:
fetch-depth: 0
name: Check out the code
- name: Run NUKE spell check
run: ./build.sh --target SpellCheck
7 changes: 5 additions & 2 deletions .gitignore
Expand Up @@ -7,7 +7,7 @@
*.sln.docstates
*.sln.ide
.vs/

.vscode/

project.lock.json
*.nuget.props
Expand Down Expand Up @@ -187,4 +187,7 @@ docs/node_modules
Tests/FluentAssertions.Specs/FluentAssertions.Specs.xml

# BenchmarkDotNet
Tests/Benchmarks/BenchmarkDotNet.Artifacts/
Tests/Benchmarks/BenchmarkDotNet.Artifacts/

# Documentation spell check
node_modules/
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
33 changes: 33 additions & 0 deletions Build/Build.cs
Expand Up @@ -15,6 +15,7 @@
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using static Nuke.Common.Tools.ReportGenerator.ReportGeneratorTasks;
using static Nuke.Common.Tools.Xunit.XunitTasks;
using static Serilog.Log;

[UnsetVisualStudioEnvironmentVariables]
[DotNetVerbosityMapping]
Expand Down Expand Up @@ -47,11 +48,23 @@ class Build : NukeBuild
[PackageExecutable("nspec", "NSpecRunner.exe", Version = "3.1.0")]
Tool NSpec3;

#if OS_WINDOWS
[PackageExecutable("Node.js.redist", "node.exe", Version = "16.17.1", Framework = "win-x64")]
Tool Node;
#elif OS_MAC
[PackageExecutable("Node.js.redist", "node", Version = "16.17.1", Framework = "osx-x64")]
Tool Node;
#else
[PackageExecutable("Node.js.redist", "node", Version = "16.17.1", Framework = "linux-x64")]
Tool Node;
#endif

AbsolutePath ArtifactsDirectory => RootDirectory / "Artifacts";

AbsolutePath TestResultsDirectory => RootDirectory / "TestResults";

string SemVer;
string YarnCli => ToolPathResolver.GetPackageExecutable("Yarn.MSBuild", "yarn.js", "1.22.19");

Target Clean => _ => _
.Executes(() =>
Expand Down Expand Up @@ -246,5 +259,25 @@ class Build : NukeBuild
(v, path) => v.SetTargetPath(path)));
});

Target SpellCheck => _ => _
.Executes(() =>
{
static void LogErrorAsWarning(OutputType outputType, string message)
{
if (outputType == OutputType.Err)
{
Warning(message);
}
else
{
Information(message);
}
IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
}

Node($"{YarnCli} install --silent", workingDirectory: RootDirectory, customLogger: LogErrorAsWarning);
Node($"{YarnCli} run cspell", workingDirectory: RootDirectory, customLogger: LogErrorAsWarning);
});


IT-VBFK marked this conversation as resolved.
Show resolved Hide resolved
bool IsTag => BranchSpec != null && BranchSpec.Contains("refs/tags", StringComparison.InvariantCultureIgnoreCase);
}
11 changes: 11 additions & 0 deletions Build/_build.csproj
Expand Up @@ -7,11 +7,22 @@
<NukeRootDirectory>..\</NukeRootDirectory>
<NukeScriptDirectory>..\</NukeScriptDirectory>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Windows'))">
<DefineConstants>OS_WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('Linux'))">
<DefineConstants>OS_LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('OSX'))">
<DefineConstants>OS_MAC</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageDownload Include="GitVersion.Tool" Version="[5.11.1]" />
<PackageDownload Include="NSpec" Version="[3.1.0]" />
<PackageDownload Include="ReportGenerator" Version="[5.1.13]" />
<PackageDownload Include="xunit.runner.console" Version="[2.4.2]" />
<PackageDownload Include="Node.js.redist" Version="[16.17.1]" />
<PackageReference Include="Nuke.Common" Version="6.3.0" />
<PackageDownload Include="Yarn.MSBuild" Version="[1.22.19]" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Expand Up @@ -74,6 +74,7 @@ Please do:
* If the contribution adds a feature or fixes a bug, please update the [**release notes**](https://github.com/fluentassertions/fluentassertions/blob/develop/docs/_pages/releases.md), which is published on the [website](https://fluentassertions.com/releases).
* If the contribution changes the public API, the changes needs to be included by running [`AcceptApiChanges.ps1`](https://github.com/fluentassertions/fluentassertions/tree/develop/AcceptApiChanges.ps1)/[`AcceptApiChanges.sh`](https://github.com/fluentassertions/fluentassertions/tree/develop/AcceptApiChanges.sh) or using Rider's [Verify Support](https://plugins.jetbrains.com/plugin/17240-verify-support) plug-in.
* If the contribution affects the documentation, please update the [**documentation**](https://github.com/fluentassertions/fluentassertions/tree/develop/docs/_pages), under the appropriate file (i.e. [strings.md](https://github.com/fluentassertions/fluentassertions/blob/develop/docs/_pages/strings.md) for changes to string assertions), which is published on the [website](https://fluentassertions.com/introduction).
* Please also run `./build.sh --target spellcheck` or `.\build.ps1 --target spellcheck` before pushing and check the good outcome

Please do not:

Expand Down
78 changes: 78 additions & 0 deletions cSpell.json
@@ -0,0 +1,78 @@
{
"version": "0.2",
"language": "en",
"words": [
"browsable",
"Doomen",
"formattable",
"Guids",
"LINQ",
"parameterless",
"refactorings",
"struct"
],
"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
4 changes: 4 additions & 0 deletions docs/run.bat
@@ -1,2 +1,6 @@
del _site /s /q

rem Documentation spell check
..\build.cmd --target SpellCheck

bundle exec jekyll serve --incremental
9 changes: 9 additions & 0 deletions package.json
@@ -0,0 +1,9 @@
{
"version": "1.0.0",
"scripts": {
"cspell": "cspell --config ./cSpell.json ./docs/**/*.md --no-progress"
},
"dependencies": {
"cspell": "^6.18.1"
}
}