-
Notifications
You must be signed in to change notification settings - Fork 872
Option to treat 'Invalid file link' as error instead of warning #7433
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
Comments
Do you build your docs from the command line or use the NuGet package for DocFX? If you use the command-line, just add If you use the NuGet package, here's a skelleton csproj file you can use as a template. I keep my DocFX stuff in a directory called docs. The docfx.json file is directly beside my csproj file. Note the last section, "DocFX settings".
|
@jamiehankins I use DocFX from the command line. Thanks for the From what I've found on the web (here and here) the option should be used with
So it's not just a flag, right? |
Hi Maxim,
I'm not actually associated with the DocFX project. I'm just a guy that uses it like you do. I've fixed a couple of bugs and made pull requests, one of which was accepted and one of which is pending.
I would suggest editing the user manual and creating a pull request. The warningsAsErrors option was added in 2018 here: #3230.
Thanks,
Jamie
|
Is there a way to set the |
As a temporary solution I've managed incorporate the option to our build definition. We are using a custom approach that at the end spawns the actual command. Handling return spawn("docfx", ["build", `--warningsAsErrors`, `${path.normalize(getPath(docfxJsonPath))}`], { stdio: 'inherit' }).on('exit', (err) => { ... } }); Equivalent to:
|
It occurs to me, that the msbuild target needs to Check for exit code to fail the build when task calling docfx --warningsAsErros true exists with a non-zero exist code. but it doesn't today: docfx/src/nuspec/docfx.console/build/docfx.console.targets Lines 49 to 55 in d111647
|
The Exec task of MSBuild already checks the exit code, unless the target sets IgnoreExitCode="true". https://github.com/dotnet/msbuild/blob/971bf70db73ebd5d5e1dde5eb27b8265be9f3169/src/Utilities/ToolTask.cs#L1527-L1529 |
Latest version of docfx supports So it can set custom rules for specific warning code.
|
Is there a list somewhere of the supported rules? |
Operating System:
Windows
DocFX Version Used:
2.58
Sometimes I forget to precede a link to an API entity with
xref:
which leads to warnings like these:And the message from docfx says all is fine (almost):
I build my docs within CI, so I want a build failed when
Invalid file link
error occured, because from my point of view it's absolutely an error, not a just warning. I must fix it before publishing the docs.So my question: is it possible to tell docfx to treat such situations as errors and thus fail the build (I suppose docfx should return non-zero exit code)?
Thanks,
Max
The text was updated successfully, but these errors were encountered: