Skip to content

Commit

Permalink
Add cSpell to NUKE build pipeline (#2086)
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-VBFK committed Jan 6, 2023
1 parent 5f42f5d commit ad5febc
Show file tree
Hide file tree
Showing 15 changed files with 1,231 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -5,4 +5,5 @@
* [ ] The changes are covered by unit tests which follow the Arrange-Act-Assert syntax and the naming conventions such as is used [in these tests](../tree/develop/Tests/FluentAssertions.Equivalency.Specs/MemberMatchingSpecs.cs#L51-L430).
* [ ] If the PR adds a feature or fixes a bug, please update [the release notes](../tree/develop/docs/_pages/releases.md) with a functional description that explains what the change means to consumers of this library, which are published on the [website](https://fluentassertions.com/releases).
* [ ] If the PR changes the public API the changes needs to be included by running [AcceptApiChanges.ps1](../tree/develop/AcceptApiChanges.ps1) or [AcceptApiChanges.sh](../tree/develop/AcceptApiChanges.sh).
* [ ] If the PR affects [the documentation](../tree/develop/docs/_pages), please include your changes in this pull request so the documentation will appear on the [website](https://www.fluentassertions.com/introduction).
* [ ] If the PR affects [the documentation](../tree/develop/docs/_pages), please include your changes in this pull request so the documentation will appear on the [website](https://www.fluentassertions.com/introduction).
* [ ] Please also run `./build.sh --target spellcheck` or `.\build.ps1 --target spellcheck` before pushing and check the good outcome
25 changes: 25 additions & 0 deletions .github/workflows/spellcheck.yml
@@ -0,0 +1,25 @@
name: Documentation Checks

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
18 changes: 18 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,21 @@ 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")]
#elif OS_MAC
[PackageExecutable("Node.js.redist", "node", Version = "16.17.1", Framework = "osx-x64")]
#else
[PackageExecutable("Node.js.redist", "node", Version = "16.17.1", Framework = "linux-x64")]
#endif
Tool Node;

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 +257,12 @@ class Build : NukeBuild
(v, path) => v.SetTargetPath(path)));
});

Target SpellCheck => _ => _
.Executes(() =>
{
Node($"{YarnCli} install --silent", workingDirectory: RootDirectory);
Node($"{YarnCli} --silent run cspell --no-summary", workingDirectory: RootDirectory,
customLogger: (_, msg) => Error(msg));
});
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
75 changes: 75 additions & 0 deletions cSpell.json
@@ -0,0 +1,75 @@
{
"version": "1.0",
"language": "en",
"words": [
"browsable",
"comparands",
"Doomen",
"formattable",
"Guids",
"LINQ",
"MVVM",
"parameterless",
"refactorings",
"struct"
],
"patterns": [
{
"name": "Markdown links",
"pattern": "\\((.*)\\)",
"description": ""
},
{
"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
2 changes: 1 addition & 1 deletion docs/_pages/collections.md
Expand Up @@ -104,7 +104,7 @@ The pattern can be a combination of literal and wildcard characters, but it does

The following wildcard specifiers are permitted in the pattern:

| Wilcard specifier | Matches |
| Wildcard specifier | Matches |
| ----------------- | ----------------------------------------- |
| * (asterisk) | Zero or more characters in that position. |
| ? (question mark) | Exactly one character in that position. |
Expand Down
2 changes: 1 addition & 1 deletion docs/_pages/extensibility.md
Expand Up @@ -104,7 +104,7 @@ void Format(object value, FormattedObjectGraph formattedGraph, FormattingContext

Next to the actual value that needs rendering, this method accepts a couple of parameters worth mentioning.

* `formattedGraph` is the object that collects the textual representation of the entire graph. It supports adding fragments of text, full lines and deals with automatic identation using its `WithIndentation` method. It also protects the performance of the rendering by throwing a `MaxLinesExceededException` when the textual representation has exceeded the configured maximum.
* `formattedGraph` is the object that collects the textual representation of the entire graph. It supports adding fragments of text, full lines and deals with automatic indentation using its `WithIndentation` method. It also protects the performance of the rendering by throwing a `MaxLinesExceededException` when the textual representation has exceeded the configured maximum.
* `context.UseLineBreaks` denotes that the value should be prefixed by a newline. It is used by some assertion code to force displaying the various elements of the failure message on a separate line.
* `formatChild` is used when rendering a complex object that would involve multiple, potentially recursive, nested calls through `Formatter`.

Expand Down
2 changes: 1 addition & 1 deletion docs/_pages/strings.md
Expand Up @@ -81,7 +81,7 @@ The pattern can be a combination of literal and wildcard characters, but it does

The following wildcard specifiers are permitted in the pattern:

| Wilcard specifier | Matches |
| Wildcard specifier | Matches |
| ----------------- | ----------------------------------------- |
| * (asterisk) | Zero or more characters in that position. |
| ? (question mark) | Exactly one character in that position. |
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 ./**/*.md --no-progress"
},
"dependencies": {
"cspell": "^6.18.1"
}
}

0 comments on commit ad5febc

Please sign in to comment.