pre-commit: add keep-sorted hook
This sorts lines alphabetically between `keep-sorted start` and `keep-sorted end` markers. See: https://github.com/google/keep-sorted Closes #730 Change-Id: Ib36f3da81fcf5e2f588ffb998860456405607eea
This commit is contained in:
+11
-7
@@ -59,12 +59,14 @@ void registerLegacyCommands()
|
||||
static bool haveProxyEnvironmentVariables()
|
||||
{
|
||||
static const std::vector<std::string> proxyVariables = {
|
||||
"http_proxy",
|
||||
"https_proxy",
|
||||
"ftp_proxy",
|
||||
"HTTP_PROXY",
|
||||
// keep-sorted start
|
||||
"FTP_PROXY",
|
||||
"HTTPS_PROXY",
|
||||
"FTP_PROXY"
|
||||
"HTTP_PROXY",
|
||||
"ftp_proxy",
|
||||
"http_proxy",
|
||||
"https_proxy"
|
||||
// keep-sorted end
|
||||
};
|
||||
for (auto & proxyVariable: proxyVariables) {
|
||||
if (getEnv(proxyVariable).has_value()) {
|
||||
@@ -168,6 +170,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
|
||||
}
|
||||
|
||||
std::map<std::string, std::vector<std::string>> aliases = {
|
||||
// keep-sorted start
|
||||
{"add-to-store", {"store", "add-path"}},
|
||||
{"cat-nar", {"nar", "cat"}},
|
||||
{"cat-store", {"store", "cat"}},
|
||||
@@ -182,13 +185,14 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
|
||||
{"make-content-addressable", {"store", "make-content-addressed"}},
|
||||
{"optimise-store", {"store", "optimise"}},
|
||||
{"ping-store", {"store", "ping"}},
|
||||
{"sign-paths", {"store", "sign"}},
|
||||
{"show-derivation", {"derivation", "show"}},
|
||||
{"show-config", {"config", "show"}},
|
||||
{"show-derivation", {"derivation", "show"}},
|
||||
{"sign-paths", {"store", "sign"}},
|
||||
{"to-base16", {"hash", "to-base16"}},
|
||||
{"to-base32", {"hash", "to-base32"}},
|
||||
{"to-base64", {"hash", "to-base64"}},
|
||||
{"verify", {"store", "verify"}},
|
||||
// keep-sorted end
|
||||
};
|
||||
|
||||
bool aliasUsed = false;
|
||||
|
||||
@@ -96,6 +96,11 @@ pre-commit-run {
|
||||
];
|
||||
entry = lib.getExe pkgs.check-headers;
|
||||
};
|
||||
keep-sorted = {
|
||||
enable = true;
|
||||
package = pkgs.keep-sorted;
|
||||
entry = lib.getExe pkgs.keep-sorted;
|
||||
};
|
||||
# TODO: Once the test suite is nicer, clean up and start
|
||||
# enforcing trailing whitespace on tests that don't explicitly
|
||||
# check for it.
|
||||
|
||||
Reference in New Issue
Block a user