Commits on Source (6)
...@@ -4,9 +4,9 @@ version = 3 ...@@ -4,9 +4,9 @@ version = 3
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.7.19" version = "0.7.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
...@@ -22,15 +22,15 @@ dependencies = [ ...@@ -22,15 +22,15 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.66" version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
[[package]] [[package]]
name = "assert_cmd" name = "assert_cmd"
version = "2.0.6" version = "2.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba45b8163c49ab5f972e59a8a5a03b6d2972619d486e19ec9fe744f7c2753d3c" checksum = "9834fcc22e0874394a010230586367d4a3e9f11b560f469262678547e1d2575e"
dependencies = [ dependencies = [
"bstr", "bstr",
"doc-comment", "doc-comment",
...@@ -40,17 +40,6 @@ dependencies = [ ...@@ -40,17 +40,6 @@ dependencies = [
"wait-timeout", "wait-timeout",
] ]
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
...@@ -77,9 +66,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" ...@@ -77,9 +66,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bstr" name = "bstr"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fca0852af221f458706eb0725c03e4ed6c46af9ac98e6a689d5e634215d594dd" checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b"
dependencies = [ dependencies = [
"memchr", "memchr",
"once_cell", "once_cell",
...@@ -107,9 +96,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" ...@@ -107,9 +96,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.77" version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
...@@ -140,14 +129,14 @@ dependencies = [ ...@@ -140,14 +129,14 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.0.26" version = "4.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2148adefda54e14492fb9bddcc600b4344c5d1a3123bd666dcb939c6f0e0e57e" checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39"
dependencies = [ dependencies = [
"atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"is-terminal",
"once_cell", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
...@@ -205,9 +194,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" ...@@ -205,9 +194,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]] [[package]]
name = "cxx" name = "cxx"
version = "1.0.82" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579"
dependencies = [ dependencies = [
"cc", "cc",
"cxxbridge-flags", "cxxbridge-flags",
...@@ -217,9 +206,9 @@ dependencies = [ ...@@ -217,9 +206,9 @@ dependencies = [
[[package]] [[package]]
name = "cxx-build" name = "cxx-build"
version = "1.0.82" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70"
dependencies = [ dependencies = [
"cc", "cc",
"codespan-reporting", "codespan-reporting",
...@@ -232,15 +221,15 @@ dependencies = [ ...@@ -232,15 +221,15 @@ dependencies = [
[[package]] [[package]]
name = "cxxbridge-flags" name = "cxxbridge-flags"
version = "1.0.82" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c"
[[package]] [[package]]
name = "cxxbridge-macro" name = "cxxbridge-macro"
version = "1.0.82" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
...@@ -249,9 +238,9 @@ dependencies = [ ...@@ -249,9 +238,9 @@ dependencies = [
[[package]] [[package]]
name = "data-encoding" name = "data-encoding"
version = "2.3.2" version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb"
[[package]] [[package]]
name = "difflib" name = "difflib"
...@@ -282,17 +271,38 @@ dependencies = [ ...@@ -282,17 +271,38 @@ dependencies = [
[[package]] [[package]]
name = "env_logger" name = "env_logger"
version = "0.9.3" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
dependencies = [ dependencies = [
"atty",
"humantime", "humantime",
"is-terminal",
"log", "log",
"regex", "regex",
"termcolor", "termcolor",
] ]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi 0.3.9",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "1.8.0" version = "1.8.0"
...@@ -472,9 +482,9 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" ...@@ -472,9 +482,9 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [ dependencies = [
"libc", "libc",
] ]
...@@ -487,7 +497,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" ...@@ -487,7 +497,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
dependencies = [ dependencies = [
"bytes 1.1.0", "bytes 1.1.0",
"fnv", "fnv",
"itoa 1.0.4", "itoa 1.0.5",
] ]
[[package]] [[package]]
...@@ -653,6 +663,16 @@ dependencies = [ ...@@ -653,6 +663,16 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
[[package]]
name = "io-lifetimes"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys",
]
[[package]] [[package]]
name = "iovec" name = "iovec"
version = "0.1.4" version = "0.1.4"
...@@ -664,9 +684,21 @@ dependencies = [ ...@@ -664,9 +684,21 @@ dependencies = [
[[package]] [[package]]
name = "ipnet" name = "ipnet"
version = "2.5.1" version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146"
[[package]]
name = "is-terminal"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]] [[package]]
name = "itertools" name = "itertools"
...@@ -685,9 +717,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" ...@@ -685,9 +717,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.4" version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
...@@ -736,19 +768,25 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" ...@@ -736,19 +768,25 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.137" version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]] [[package]]
name = "link-cplusplus" name = "link-cplusplus"
version = "1.0.7" version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5"
dependencies = [ dependencies = [
"cc", "cc",
] ]
[[package]]
name = "linux-raw-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.17" version = "0.4.17"
...@@ -884,15 +922,15 @@ checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" ...@@ -884,15 +922,15 @@ checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.16.0" version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.10.42" version = "0.10.45"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cfg-if 1.0.0", "cfg-if 1.0.0",
...@@ -922,9 +960,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" ...@@ -922,9 +960,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.77" version = "0.9.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cc", "cc",
...@@ -1002,9 +1040,9 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" ...@@ -1002,9 +1040,9 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
[[package]] [[package]]
name = "predicates" name = "predicates"
version = "2.1.3" version = "2.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed6bd09a7f7e68f3f0bf710fb7ab9c4615a488b58b5f653382a687701e458c92" checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd"
dependencies = [ dependencies = [
"difflib", "difflib",
"itertools", "itertools",
...@@ -1053,18 +1091,18 @@ dependencies = [ ...@@ -1053,18 +1091,18 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.47" version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.21" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
...@@ -1089,9 +1127,9 @@ dependencies = [ ...@@ -1089,9 +1127,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.7.0" version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
...@@ -1171,7 +1209,7 @@ dependencies = [ ...@@ -1171,7 +1209,7 @@ dependencies = [
[[package]] [[package]]
name = "ruled-labels" name = "ruled-labels"
version = "0.3.2" version = "0.4.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",
...@@ -1187,27 +1225,40 @@ dependencies = [ ...@@ -1187,27 +1225,40 @@ dependencies = [
"termion", "termion",
] ]
[[package]]
name = "rustix"
version = "0.36.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.11" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
[[package]] [[package]]
name = "schannel" name = "schannel"
version = "0.1.20" version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
dependencies = [ dependencies = [
"lazy_static",
"windows-sys", "windows-sys",
] ]
[[package]] [[package]]
name = "scratch" name = "scratch"
version = "1.0.2" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
[[package]] [[package]]
name = "security-framework" name = "security-framework"
...@@ -1234,27 +1285,27 @@ dependencies = [ ...@@ -1234,27 +1285,27 @@ dependencies = [
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.14" version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.147" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
...@@ -1263,11 +1314,11 @@ dependencies = [ ...@@ -1263,11 +1314,11 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.88" version = "1.0.91"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7" checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
dependencies = [ dependencies = [
"itoa 1.0.4", "itoa 1.0.5",
"ryu", "ryu",
"serde", "serde",
] ]
...@@ -1279,19 +1330,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" ...@@ -1279,19 +1330,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"itoa 1.0.4", "itoa 1.0.5",
"ryu", "ryu",
"serde", "serde",
] ]
[[package]] [[package]]
name = "serde_yaml" name = "serde_yaml"
version = "0.9.14" version = "0.9.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d232d893b10de3eb7258ff01974d6ee20663d8e833263c99409d4b13a0209da" checksum = "92b5b431e8907b50339b51223b97d102db8d987ced36f6e4d03621db9316c834"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"itoa 1.0.4", "itoa 1.0.5",
"ryu", "ryu",
"serde", "serde",
"unsafe-libyaml", "unsafe-libyaml",
...@@ -1342,9 +1393,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" ...@@ -1342,9 +1393,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.103" version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
...@@ -1394,9 +1445,9 @@ checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" ...@@ -1394,9 +1445,9 @@ checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8"
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.44" version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [ dependencies = [
"libc", "libc",
"wasi", "wasi",
...@@ -1498,9 +1549,9 @@ dependencies = [ ...@@ -1498,9 +1549,9 @@ dependencies = [
[[package]] [[package]]
name = "try-lock" name = "try-lock"
version = "0.2.3" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
[[package]] [[package]]
name = "unicase" name = "unicase"
...@@ -1519,9 +1570,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" ...@@ -1519,9 +1570,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.5" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
...@@ -1540,9 +1591,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" ...@@ -1540,9 +1591,9 @@ checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
[[package]] [[package]]
name = "unsafe-libyaml" name = "unsafe-libyaml"
version = "0.2.4" version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68" checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
...@@ -1721,46 +1772,60 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" ...@@ -1721,46 +1772,60 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.36.1" version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc", "windows_aarch64_msvc",
"windows_i686_gnu", "windows_i686_gnu",
"windows_i686_msvc", "windows_i686_msvc",
"windows_x86_64_gnu", "windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc", "windows_x86_64_msvc",
] ]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
version = "0.36.1" version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
version = "0.36.1" version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
version = "0.36.1" version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
version = "0.36.1" version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
version = "0.36.1" version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
[[package]] [[package]]
name = "winreg" name = "winreg"
......
[package] [package]
name = "ruled-labels" name = "ruled-labels"
version = "0.3.2" version = "0.4.0"
edition = "2021" edition = "2021"
license-file = "LICENSE" license-file = "LICENSE"
description = "Utility to check labels"
[dependencies] [dependencies]
clap = { version = "4", features = ["derive", "env", "unicode", "cargo", "color"] } clap = { version = "4", features = ["derive", "env", "unicode", "cargo", "color"] }
env_logger = "0.9" env_logger = "0.10"
futures = "0.3" futures = "0.3"
hubcaps = "0.6" hubcaps = "0.6"
log = "0.4" log = "0.4"
......
...@@ -109,26 +109,22 @@ You can pull the docker image from `chevdor`/`ruled-labels` or build you own: ...@@ -109,26 +109,22 @@ You can pull the docker image from `chevdor`/`ruled-labels` or build you own:
## Help ## Help
ruled-labels 0.2.0
This utility allows checking labels based on rules This utility allows checking labels based on rules
USAGE: Usage: ruled-labels [OPTIONS] <COMMAND>
ruled-labels [OPTIONS] <SUBCOMMAND>
OPTIONS: Commands:
-d, --dev The output is more developer oriented list List all the rules
-h, --help Print help information lint Lint the rules
--no-color Output without any coloring, this is useful for documentation and CI system check Check label set against the rules
where the color code pollute the output test Run tests using rules and a test set
-V, --version Print version information help Print this message or the help of the given subcommand(s)
SUBCOMMANDS: Options:
check Check label set against the rules --no-color Output without any coloring, this is useful for documentation and CI system where the color code pollute the output
help Print this message or the help of the given subcommand(s) -d, --dev The output is more developer oriented
lint Lint the rules -h, --help Print help information
list List all the rules -V, --version Print version information
test Run tests using rules and a test set
## Lint ## Lint
...@@ -140,55 +136,54 @@ You can pull the docker image from `chevdor`/`ruled-labels` or build you own: ...@@ -140,55 +136,54 @@ You can pull the docker image from `chevdor`/`ruled-labels` or build you own:
desc: Import from chevdor/glabel desc: Import from chevdor/glabel
labels: 14 labels: 14
Rules: Rules:
- Some topics (X labels) - Some topics (X labels) (some_topics)
- Exactly one visibility label (b_rules) - Exactly one visibility label (b_rules)
- Note Worthy need one Prio label (b_need_p) - Note Worthy need one Prio label (b_need_p)
- Note Worthy implies no J label (b_excludes_j) - Note Worthy implies no J label (b1_excludes_j)
- Exclude all Ds - Exclude all Ds (exclude_all_d)
- Require all of J - Require all of J
- Require 1 P and no X - Require 1 P and no X (single_p_no_x) DISABLED
## Test ## Test
Tests specs: tests.yaml Tests specs: tests.yaml
Specs file : specs.yaml Specs file : specs.yaml
▶️ Running test 1: Fail ▶️ Running test 1: Pass
PASSED Pass
▶️ Running test 2: Fail - b_rules
You need to include one of the B* label(s) You need to include one of the B* label(s)
You need to include all of the J* label(s) PASSED Fail - b_rules
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s)
PASSED Fail
▶️ Running test 2: Pass ▶️ Running test 3: Fail - some_topics
Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) You need to include some of the J2, X1, X2 label(s)
You need to include all of the J* label(s) PASSED Fail - some_topics
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s)
FAILED Pass
▶️ Running test 3: Missing topics ▶️ Running test 4: Fail - b_need_p
You need to include some of the X1, X2, J2 label(s)
Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s)
You need to include all of the J* label(s) PASSED Fail - b_need_p
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s)
PASSED Missing topics
▶️ Running test 4: Fail ▶️ Running test 5: Fail - b1_excludes_j
You need to include some of the X1, X2, J2 label(s) Since you have one of the B1 label(s), you need to exclude all of the J* label(s)
Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) PASSED Fail - b1_excludes_j
You need to include all of the J* label(s)
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s) ▶️ Running test 6: Fail - b1_excludes_j 2
PASSED Fail Since you have one of the B1 label(s), you need to exclude all of the J* label(s)
FAILED Some expectations were not OK PASSED Fail - b1_excludes_j 2
PASSED All expectations are OK
## Check ## Check
FAILED Some topics (X labels) | You need to include some of the J2, X1, X2 label(s) s = "B0"
s = "A1"
FAILED Some topics (X labels) | You need to include some of the X2, J2, X1 label(s)
PASSED Exactly one visibility label | You need to include one of the B* label(s) PASSED Exactly one visibility label | You need to include one of the B* label(s)
FAILED Note Worthy need one Prio label | Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) FAILED Note Worthy need one Prio label | Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s)
PASSED Note Worthy implies no J label | You need to exclude all of the T* label(s) SKIPPED Note Worthy implies no J label | Since you have one of the B1 label(s), you need to exclude all of the J* label(s)
PASSED Exclude all Ds | You need to exclude all of the D* label(s) PASSED Exclude all Ds | You need to exclude all of the D* label(s)
FAILED Require all of J | You need to include all of the J* label(s) FAILED Require all of J | You need to include all of the J* label(s)
FAILED Require 1 P and no X | You need to include one of the P* label(s) and you need to exclude all of the X1, X2 label(s) SKIPPED Require 1 P and no X | You need to include one of the P* label(s) and you need to exclude all of the X1, X2 label(s)
FAILED chevdor/glabel v0.1.0 for labels A1, B0 FAILED chevdor/glabel v0.1.0 for labels A1, B0
## Vscode yaml ## Vscode yaml
......
...@@ -227,7 +227,7 @@ include::../../specs.yaml[tags=rules] ...@@ -227,7 +227,7 @@ include::../../specs.yaml[tags=rules]
[source,rust] [source,rust]
---- ----
include::../../src/lib/token_rule/require.rs[] include::../../src/rllib/token_rule/require.rs[]
---- ----
=== Rule anathomy: min === Rule anathomy: min
......
FAILED Some topics (X labels) | You need to include some of the J2, X1, X2 label(s) s = "B0"
s = "A1"
FAILED Some topics (X labels) | You need to include some of the X2, J2, X1 label(s)
PASSED Exactly one visibility label | You need to include one of the B* label(s) PASSED Exactly one visibility label | You need to include one of the B* label(s)
FAILED Note Worthy need one Prio label | Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) FAILED Note Worthy need one Prio label | Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s)
PASSED Note Worthy implies no J label | You need to exclude all of the T* label(s) SKIPPED Note Worthy implies no J label | Since you have one of the B1 label(s), you need to exclude all of the J* label(s)
PASSED Exclude all Ds | You need to exclude all of the D* label(s) PASSED Exclude all Ds | You need to exclude all of the D* label(s)
FAILED Require all of J | You need to include all of the J* label(s) FAILED Require all of J | You need to include all of the J* label(s)
FAILED Require 1 P and no X | You need to include one of the P* label(s) and you need to exclude all of the X1, X2 label(s) SKIPPED Require 1 P and no X | You need to include one of the P* label(s) and you need to exclude all of the X1, X2 label(s)
FAILED chevdor/glabel v0.1.0 for labels A1, B0 FAILED chevdor/glabel v0.1.0 for labels A1, B0
ruled-labels 0.2.0
This utility allows checking labels based on rules This utility allows checking labels based on rules
USAGE: Usage: ruled-labels [OPTIONS] <COMMAND>
ruled-labels [OPTIONS] <SUBCOMMAND>
OPTIONS: Commands:
-d, --dev The output is more developer oriented list List all the rules
-h, --help Print help information lint Lint the rules
--no-color Output without any coloring, this is useful for documentation and CI system check Check label set against the rules
where the color code pollute the output test Run tests using rules and a test set
-V, --version Print version information help Print this message or the help of the given subcommand(s)
SUBCOMMANDS: Options:
check Check label set against the rules --no-color Output without any coloring, this is useful for documentation and CI system where the color code pollute the output
help Print this message or the help of the given subcommand(s) -d, --dev The output is more developer oriented
lint Lint the rules -h, --help Print help information
list List all the rules -V, --version Print version information
test Run tests using rules and a test set
...@@ -2,11 +2,11 @@ name: chevdor/glabel ...@@ -2,11 +2,11 @@ name: chevdor/glabel
desc: Import from chevdor/glabel desc: Import from chevdor/glabel
labels: 14 labels: 14
Rules: Rules:
- Some topics (X labels) - Some topics (X labels) (some_topics)
- Exactly one visibility label (b_rules) - Exactly one visibility label (b_rules)
- Note Worthy need one Prio label (b_need_p) - Note Worthy need one Prio label (b_need_p)
- Note Worthy implies no J label (b_excludes_j) - Note Worthy implies no J label (b1_excludes_j)
- Exclude all Ds - Exclude all Ds (exclude_all_d)
- Require all of J - Require all of J
- Require 1 P and no X - Require 1 P and no X (single_p_no_x) DISABLED
Tests specs: tests.yaml Tests specs: tests.yaml
Specs file : specs.yaml Specs file : specs.yaml
▶️ Running test 1: Fail ▶️ Running test 1: Pass
PASSED Pass
▶️ Running test 2: Fail - b_rules
You need to include one of the B* label(s) You need to include one of the B* label(s)
You need to include all of the J* label(s) PASSED Fail - b_rules
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s)
PASSED Fail
▶️ Running test 2: Pass ▶️ Running test 3: Fail - some_topics
Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) You need to include some of the J2, X1, X2 label(s)
You need to include all of the J* label(s) PASSED Fail - some_topics
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s)
FAILED Pass
▶️ Running test 3: Missing topics ▶️ Running test 4: Fail - b_need_p
You need to include some of the X1, X2, J2 label(s)
Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s)
You need to include all of the J* label(s) PASSED Fail - b_need_p
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s)
PASSED Missing topics
▶️ Running test 4: Fail ▶️ Running test 5: Fail - b1_excludes_j
You need to include some of the X1, X2, J2 label(s) Since you have one of the B1 label(s), you need to exclude all of the J* label(s)
Since you have one of the B* label(s), you need to include one of the P* label(s) and you need to exclude all of the P1 label(s) PASSED Fail - b1_excludes_j
You need to include all of the J* label(s)
You need to include one of the P* label(s) and you need to exclude all of the X2, X1 label(s) ▶️ Running test 6: Fail - b1_excludes_j 2
PASSED Fail Since you have one of the B1 label(s), you need to exclude all of the J* label(s)
FAILED Some expectations were not OK PASSED Fail - b1_excludes_j 2
PASSED All expectations are OK
...@@ -48,6 +48,16 @@ gen_doc: ...@@ -48,6 +48,16 @@ gen_doc:
FILE=specs FILE=specs
tera $FILE.yaml -t templates/template.md.tera > $FILE.md tera $FILE.yaml -t templates/template.md.tera > $FILE.md
# Run Rustfmt
fmt:
cargo +nightly fmt
# Run Clippy
clippy:
cargo +nightly clippy
check: fmt clippy
# Open the slides in a browser # Open the slides in a browser
slides: slides:
#!/usr/bin/env bash #!/usr/bin/env bash
......
...@@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn Error>> { ...@@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn Error>> {
SubCommand::List(cmd_opts) => { SubCommand::List(cmd_opts) => {
log::debug!("list: {:#?}", cmd_opts); log::debug!("list: {:#?}", cmd_opts);
let specs = Specs::load(&cmd_opts.spec_file)?; let specs = Specs::load(&cmd_opts.spec_file)?;
println!("{}", specs); println!("{specs}");
Ok(()) Ok(())
}, },
...@@ -83,7 +83,7 @@ fn main() -> Result<(), Box<dyn Error>> { ...@@ -83,7 +83,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let faulty_rules: Vec<&Rule> = specs.find_faulty(res); let faulty_rules: Vec<&Rule> = specs.find_faulty(res);
if !faulty_rules.is_empty() { if !faulty_rules.is_empty() {
println!("faulty_rules:"); println!("faulty_rules:");
faulty_rules.iter().for_each(|rule| println!("{:#?}", rule)); faulty_rules.iter().for_each(|rule| println!("{rule:#?}"));
} }
} }
......
//! [ParsedLabel] and [LabelId] //! [ParsedLabel] and [LabelId]
use regex::Regex;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt::Display; use std::fmt::Display;
...@@ -71,25 +72,55 @@ impl LabelId { ...@@ -71,25 +72,55 @@ impl LabelId {
Self { letter, number } Self { letter, number }
} }
pub fn from_str(s: &str) -> Result<Self, String> { /// This version, using a 1 digit code, is faster as it does not use
/// a regexp. See [Self::from_str] for the new version based on a regexp.
pub fn from_str_fast(s: &str) -> Result<Self, String> {
let sanitized_str = String::from(s).replace('\"', ""); let sanitized_str = String::from(s).replace('\"', "");
let mut chars = sanitized_str.chars(); let mut chars = sanitized_str.chars();
let first = chars.next(); let first = chars.next();
let second = chars.next(); let second = chars.next();
if first.is_none() || second.is_none() { if first.is_none() || second.is_none() {
return Err(format!("Err 001: Invalid label: {} ({:?}{:?})", s, first, second)) return Err(format!("Err 001: Invalid label: {s} ({first:?}{second:?})"))
} }
let first = first.expect("Cannot fail").to_ascii_uppercase(); let first = first.expect("Cannot fail").to_ascii_uppercase();
let second = second.expect("Cannot fail"); let second = second.expect("Cannot fail");
if !(first.is_alphabetic() && second.is_numeric()) { if !(first.is_alphabetic() && second.is_numeric()) {
return Err(format!("Err 002: Invalid label: {} ({}{})", s, first, second)) return Err(format!("Err 002: Invalid label: {s} ({first}{second})"))
} }
let second = second.to_string().parse::<CodeNumber>().expect("Cannot fail"); let second = second.to_string().parse::<CodeNumber>().expect("Cannot fail");
Ok(LabelId::new(first, second)) Ok(LabelId::new(first, second))
} }
/// Unlike [Self::from_str_fast], this function uses a regexp and allows supporting
/// 2 digits codes.
pub fn from_str(s: &str) -> Result<Self, String> {
let sanitized_str = String::from(s).replace('\"', "").to_uppercase();
let re = Regex::new(r"^([A-Z]{1})(\d+).*$").unwrap();
let caps = re.captures(&sanitized_str);
if caps.is_none() {
return Err(format!("Err 002: Invalid label, no regexp match: {s}"))
}
let caps = caps.unwrap();
let first = caps.get(1).map(|m| m.as_str().chars().next().unwrap());
let second = caps.get(2).map(|m| m.as_str());
if first.is_none() || second.is_none() {
return Err(format!("Err 001: Invalid label: {s} ({first:?}{second:?})"))
}
let first = first.expect("Cannot fail").to_ascii_uppercase();
let second = second.expect("Cannot fail");
let second = second.to_string().parse::<CodeNumber>().expect("Cannot fail");
Ok(LabelId::new(first, second))
}
} }
impl Display for LabelId { impl Display for LabelId {
...@@ -122,7 +153,7 @@ impl TryFrom<&str> for ParsedLabel { ...@@ -122,7 +153,7 @@ impl TryFrom<&str> for ParsedLabel {
impl From<String> for ParsedLabel { impl From<String> for ParsedLabel {
fn from(s: String) -> Self { fn from(s: String) -> Self {
println!("s = {:?}", s); println!("s = {s:?}");
let id = LabelId::from_str(&s).unwrap(); let id = LabelId::from_str(&s).unwrap();
let mut s = s; let mut s = s;
let description = s.drain(0..2).as_str().to_string(); let description = s.drain(0..2).as_str().to_string();
...@@ -181,12 +212,26 @@ mod test_label_id { ...@@ -181,12 +212,26 @@ mod test_label_id {
#[test] #[test]
fn test_label_id_ok() { fn test_label_id_ok() {
const INPUTS: &'static [&'static str] = &["B0-Silent", "B1-silent", "X9-foobar", "B0"]; const INPUTS: &'static [&'static str] =
&["B0-Silent", "B1-silent", "X9-foobar", "X9 -foobar", "X9 - foobar", "B0"];
INPUTS.iter().for_each(|&case| {
let id = LabelId::from_str(case);
println!("{:?}", id);
assert!(id.is_ok());
});
}
#[test]
fn test_label_id_ok_2digits() {
const INPUTS: &'static [&'static str] =
&["B10-Silent", "B11-silent", "X09-foobar", "Z99 -foobar"];
INPUTS.iter().for_each(|&case| { INPUTS.iter().for_each(|&case| {
let id = LabelId::from_str(case); let id = LabelId::from_str(case);
println!("{:?}", id); println!("{:?}", id);
assert!(id.is_ok()); assert!(id.is_ok());
assert!(id.unwrap().number >= 9);
}); });
} }
......
...@@ -54,7 +54,7 @@ impl Display for Rule { ...@@ -54,7 +54,7 @@ impl Display for Rule {
f.write_fmt(format_args!("{}", self.name))?; f.write_fmt(format_args!("{}", self.name))?;
f.write_fmt(format_args!( f.write_fmt(format_args!(
"{}", "{}",
if let Some(id) = &self.id { format!(" ({})", id) } else { "".to_string() } if let Some(id) = &self.id { format!(" ({id})") } else { "".to_string() }
))?; ))?;
f.write_fmt(format_args!("{}", if self.disabled { " DISABLED" } else { "" })) f.write_fmt(format_args!("{}", if self.disabled { " DISABLED" } else { "" }))
} }
......
...@@ -28,8 +28,8 @@ impl RuleSpec { ...@@ -28,8 +28,8 @@ impl RuleSpec {
/// can be shown if a rule check fails. The goal is **not** to /// can be shown if a rule check fails. The goal is **not** to
/// tell the user what is wrong but tell the user how to fix it. /// tell the user what is wrong but tell the user how to fix it.
pub fn to_user_tip(&self) -> String { pub fn to_user_tip(&self) -> String {
let when = if let Some(w) = &self.when { format!("{}, ", w) } else { String::new() }; let when = if let Some(w) = &self.when { format!("{w}, ") } else { String::new() };
let require = if let Some(r) = &self.require { format!("{}", r) } else { String::new() }; let require = if let Some(r) = &self.require { format!("{r}") } else { String::new() };
let and = if self.require.is_some() { let and = if self.require.is_some() {
if self.exclude.is_some() { if self.exclude.is_some() {
...@@ -41,9 +41,9 @@ impl RuleSpec { ...@@ -41,9 +41,9 @@ impl RuleSpec {
"" ""
}; };
let exclude = if let Some(e) = &self.exclude { format!("{}", e) } else { String::new() }; let exclude = if let Some(e) = &self.exclude { format!("{e}") } else { String::new() };
capitalize(&format!("{}{}{}{}", when, require, and, exclude)) capitalize(&format!("{when}{require}{and}{exclude}"))
} }
} }
......
...@@ -52,7 +52,7 @@ impl Display for Specs { ...@@ -52,7 +52,7 @@ impl Display for Specs {
f.write_str("Rules:\n")?; f.write_str("Rules:\n")?;
self.rules.iter().for_each(|rule| { self.rules.iter().for_each(|rule| {
let _ = f.write_fmt(format_args!(" - {}\n", rule)); let _ = f.write_fmt(format_args!(" - {rule}\n"));
}); });
Ok(()) Ok(())
......
...@@ -67,7 +67,7 @@ impl ResultPrinter { ...@@ -67,7 +67,7 @@ impl ResultPrinter {
pub fn print(&self) { pub fn print(&self) {
log::debug!("Printing with color = {:?}", self.color); log::debug!("Printing with color = {:?}", self.color);
println!("{}", self); println!("{self}");
} }
} }
......