mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
nixos-render-docs: make error message on broken redirects less verbose (#410219)
This commit is contained in:
commit
0f666ef3f4
1 changed files with 15 additions and 35 deletions
|
@ -28,8 +28,7 @@ Identifiers must not be identical to any historical location's anchor of the sam
|
||||||
The following identifiers violate this rule:
|
The following identifiers violate this rule:
|
||||||
- {"\n - ".join(self.conflicting_anchors)}
|
- {"\n - ".join(self.conflicting_anchors)}
|
||||||
|
|
||||||
This can break links or redirects. If you added new content, choose a different identifier.
|
This can break links or redirects. If you added new content, choose a different identifier.""")
|
||||||
""")
|
|
||||||
if self.divergent_redirects:
|
if self.divergent_redirects:
|
||||||
error_messages.append(f"""
|
error_messages.append(f"""
|
||||||
All historical content locations must correspond to exactly one identifier.
|
All historical content locations must correspond to exactly one identifier.
|
||||||
|
@ -37,8 +36,7 @@ All historical content locations must correspond to exactly one identifier.
|
||||||
- {"\n - ".join(self.divergent_redirects)}
|
- {"\n - ".join(self.divergent_redirects)}
|
||||||
|
|
||||||
It leads to inconsistent behavior depending on which redirect is applied.
|
It leads to inconsistent behavior depending on which redirect is applied.
|
||||||
Please update doc/redirects.json or nixos/doc/manual/redirects.json!
|
Please update doc/redirects.json or nixos/doc/manual/redirects.json!""")
|
||||||
""")
|
|
||||||
if self.identifiers_missing_current_outpath:
|
if self.identifiers_missing_current_outpath:
|
||||||
error_messages.append(f"""
|
error_messages.append(f"""
|
||||||
The first element of an identifier's redirects list must denote its current location.
|
The first element of an identifier's redirects list must denote its current location.
|
||||||
|
@ -46,52 +44,34 @@ The first element of an identifier's redirects list must denote its current loca
|
||||||
- {"\n - ".join(self.identifiers_missing_current_outpath)}
|
- {"\n - ".join(self.identifiers_missing_current_outpath)}
|
||||||
|
|
||||||
If you moved content, add its new location as the first element of the redirects mapping.
|
If you moved content, add its new location as the first element of the redirects mapping.
|
||||||
Please update doc/redirects.json or nixos/doc/manual/redirects.json!
|
Please update doc/redirects.json or nixos/doc/manual/redirects.json!""")
|
||||||
""")
|
|
||||||
if self.identifiers_without_redirects:
|
if self.identifiers_without_redirects:
|
||||||
error_messages.append(f"""
|
error_messages.append(f"""
|
||||||
Identifiers present in the source must have a mapping in the redirects file.
|
Identifiers present in the source must have a mapping in the redirects file.
|
||||||
- {"\n - ".join(self.identifiers_without_redirects)}
|
- {"\n - ".join(self.identifiers_without_redirects)}""")
|
||||||
|
|
||||||
This can happen when an identifier was added or renamed.
|
|
||||||
|
|
||||||
Added new content?
|
|
||||||
redirects add-content ❬identifier❭ ❬path❭
|
|
||||||
|
|
||||||
Moved existing content to a different output path?
|
|
||||||
redirects move-content ❬identifier❭ ❬path❭
|
|
||||||
|
|
||||||
Renamed existing identifiers?
|
|
||||||
redirects rename-identifier ❬old-identifier❭ ❬new-identifier❭
|
|
||||||
|
|
||||||
Removed content? Redirect to alternatives or relevant release notes.
|
|
||||||
redirects remove-and-redirect ❬identifier❭ ❬target-identifier❭
|
|
||||||
|
|
||||||
Note that you need to run `nix-shell doc` or `nix-shell nixos/doc/manual` to be able to run this command.
|
|
||||||
""")
|
|
||||||
if self.orphan_identifiers:
|
if self.orphan_identifiers:
|
||||||
error_messages.append(f"""
|
error_messages.append(f"""
|
||||||
Keys of the redirects mapping must correspond to some identifier in the source.
|
Keys of the redirects mapping must correspond to some identifier in the source.
|
||||||
- {"\n - ".join(self.orphan_identifiers)}
|
- {"\n - ".join(self.orphan_identifiers)}""")
|
||||||
|
if self.identifiers_without_redirects or self.orphan_identifiers or self.identifiers_missing_current_outpath:
|
||||||
This can happen when an identifier was removed or renamed.
|
error_messages.append(f"""
|
||||||
|
This can happen when an identifier was added, renamed, or removed.
|
||||||
|
|
||||||
Added new content?
|
Added new content?
|
||||||
redirects add-content ❬identifier❭ ❬path❭
|
$ redirects add-content ❬identifier❭ ❬path❭
|
||||||
|
|
||||||
Moved existing content to a different output path?
|
Moved existing content to a different output path?
|
||||||
redirects move-content ❬identifier❭ ❬path❭
|
$ redirects move-content ❬identifier❭ ❬path❭
|
||||||
|
|
||||||
Renamed existing identifiers?
|
Renamed existing identifiers?
|
||||||
redirects rename-identifier ❬old-identifier❭ ❬new-identifier❭
|
$ redirects rename-identifier ❬old-identifier❭ ❬new-identifier❭
|
||||||
|
|
||||||
Removed content? (good for redirecting deprecations to new content or release notes)
|
Removed content? Redirect to alternatives or relevant release notes.
|
||||||
redirects remove-and-redirect ❬identifier❭ ❬target-identifier❭
|
$ redirects remove-and-redirect ❬identifier❭ ❬target-identifier❭
|
||||||
|
|
||||||
Note that you need to run `nix-shell doc` or `nix-shell nixos/doc/manual` to be able to run this command.
|
NOTE: Run `nix-shell doc` or `nix-shell nixos/doc/manual` to make this command available.
|
||||||
""")
|
""")
|
||||||
|
error_messages.append("NOTE: If your build passes locally and you see this message in CI, you probably need a rebase.")
|
||||||
error_messages.append("NOTE: If your Manual build passes locally and you see this message in CI, you probably need a rebase.")
|
|
||||||
return "\n".join(error_messages)
|
return "\n".join(error_messages)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue