diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..4a6a1ab --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[resolver] +incompatible-rust-versions = "fallback" diff --git a/.gitignore b/.gitignore index 82e89cd..ea53691 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,7 @@ # will have compiled files and executables debug/ target/ - -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock +coverage/ # These are backup files generated by rustfmt **/*.rs.bk @@ -15,4 +12,5 @@ Cargo.lock *.pdb venv/ -.cargo/ +.cargo/* +!.cargo/config.toml diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c5bfb69 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1037 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "auto_impl" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "clap" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0797fb7aeb1406c84efac526901f7ec3ead2124f946b494e72879d4b54704d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "clap_lex" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "lazy_static" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "lsp-types" +version = "0.94.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" +dependencies = [ + "bitflags 1.3.2", + "serde", + "serde_json", + "serde_repr", + "url", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "bytes", + "pin-project-lite", + "tokio-macros", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "tokio-util" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-lsp" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ba052b54a6627628d9b3c34c176e7eda8359b7da9acd497b9f20998d118508" +dependencies = [ + "async-trait", + "auto_impl", + "bytes", + "dashmap", + "futures", + "httparse", + "lsp-types", + "memchr", + "serde", + "serde_json", + "tokio", + "tokio-util", + "tower", + "tower-lsp-macros", + "tracing", +] + +[[package]] +name = "tower-lsp-macros" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "unicode-ident" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vsg_bridge_ls" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "once_cell", + "regex", + "serde_json", + "tokio", + "tower-lsp", + "tracing-subscriber", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", + "synstructure", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index eab5733..c4eb9fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,7 @@ name = "vsg_bridge_ls" description = "A very featureless VSG to lsp bridge" version = "0.1.0" edition = "2021" +rust-version = "1.85.1" categories =["developement-tools"] license = "GPL-2.0" keywords = ["lsp", "bridge"] @@ -11,17 +12,13 @@ authors = ["dandaedre"] [dependencies] anyhow = "1.0.93" -async-tungstenite = { version = "0.28.0", features = ["tokio", "tokio-runtime"] } clap = { version = "4.5.21", features = ["derive"] } once_cell = "1.20.2" regex = "1.11.1" serde_json = "1.0.133" tokio = { version = "1.41.1", features = ["default", "io-std", "io-util", "macros", "rt-multi-thread", "tokio-macros"] } -tokio-macros = "2.4.0" -tokio-utils = "0.1.2" tower-lsp = "0.20.0" tracing-subscriber = "0.3.18" -ws_stream_tungstenite = { version = "0.14.0", features = ["tokio_io"] } [profile.dev] debug = 0 diff --git a/Jenkinsfile b/Jenkinsfile index 9a85665..e6ecb08 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,8 @@ pipeline { environment { CARGO_TERM_COLOR = 'never' RUST_BACKTRACE = '1' + MSRV = '1.85.1' + CARGO_LLVM_COV_VERSION = '0.9.0' } stages { @@ -36,13 +38,44 @@ pipeline { rustup toolchain install stable \ --profile minimal \ --component rustfmt \ - --component clippy + --component clippy \ + --component llvm-tools-preview + + rustup toolchain install "${MSRV}" \ + --profile minimal rustup default stable echo rustc --version cargo --version + + installed_llvm_cov=$(cargo llvm-cov --version 2>/dev/null || true) + if [ "${installed_llvm_cov}" != "cargo-llvm-cov ${CARGO_LLVM_COV_VERSION}" ]; then + cargo install cargo-llvm-cov \ + --locked \ + --version "${CARGO_LLVM_COV_VERSION}" + fi + ''' + } + } + + stage('MSRV') { + steps { + sh ''' + set -eu + + echo "Checking all targets with Rust ${MSRV}..." + + cargo "+${MSRV}" check \ + --locked \ + --all-targets \ + --all-features + + cargo "+${MSRV}" test \ + --locked \ + --all-targets \ + --all-features ''' } } @@ -70,6 +103,7 @@ pipeline { echo "Running cargo check..." cargo check \ + --locked \ --all-targets \ --all-features ''' @@ -84,6 +118,7 @@ pipeline { echo "Running tests..." cargo test \ + --locked \ --all-targets \ --all-features ''' @@ -98,8 +133,66 @@ pipeline { echo "Running Clippy..." cargo clippy \ + --locked \ --all-targets \ - --all-features + --all-features \ + -- \ + -D warnings + ''' + } + } + + stage('Coverage') { + steps { + sh ''' + set -eu + + cargo llvm-cov clean --workspace + cargo llvm-cov \ + --locked \ + --all-features \ + --html \ + --output-dir coverage + cargo llvm-cov report \ + --json \ + --summary-only \ + --output-path coverage/summary.json + cargo llvm-cov report \ + --lcov \ + --output-path coverage/lcov.info + + coverage_percent=$(cargo llvm-cov report --summary-only | awk ' + $1 == "TOTAL" { + gsub(/%/, "", $10) + print $10 + } + ') + scripts/render-coverage-badge.sh \ + "${coverage_percent}" \ + coverage/coverage.svg + ''' + + archiveArtifacts( + allowEmptyArchive: false, + artifacts: 'coverage/**/*', + fingerprint: true + ) + } + } + + stage('Publish coverage') { + when { + allOf { + branch 'main' + expression { + return env.COVERAGE_PUBLISH_ROOT?.trim() + } + } + } + steps { + sh ''' + set -eu + scripts/publish-coverage.sh "${COVERAGE_PUBLISH_ROOT}" ''' } } @@ -111,7 +204,7 @@ pipeline { conclusion: 'SUCCESS', name: 'Rust CI', summary: 'vsg_bridge_ls passed CI.', - text: 'Formatting, cargo check, tests, and Clippy completed successfully.', + text: 'MSRV/stable checks, formatting, tests, Clippy, and coverage completed successfully.', title: 'Build Successful' ) @@ -123,7 +216,7 @@ pipeline { conclusion: 'FAILURE', name: 'Rust CI', summary: 'vsg_bridge_ls failed CI.', - text: 'Formatting, cargo check, tests, or Clippy failed. Check the Jenkins log.', + text: 'An MSRV/stable, formatting, test, Clippy, or coverage check failed. Check the Jenkins log.', title: 'Build Failed' ) @@ -142,4 +235,4 @@ pipeline { echo '⚠️ vsg_bridge_ls CI is unstable.' } } -} \ No newline at end of file +} diff --git a/README.md b/README.md index 158c10e..714a1ee 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # vsg_bridge_ls +[![coverage](https://assets.dandaedre.com/coverage/MadGobblins/vsg-bridge-ls/main/coverage.svg)](https://assets.dandaedre.com/coverage/MadGobblins/vsg-bridge-ls/main/html/) + `vsg_bridge_ls` reports [VSG](https://github.com/jeremiah-c-leary/vhdl-style-guide) diagnostics through the Language Server Protocol (LSP). A complete setup needs the companion VSG fork and this bridge. @@ -32,7 +34,8 @@ python -m pip install \ ## 2. Install the bridge ```sh -cargo install --git https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls.git +cargo install --locked \ + --git https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls.git ``` Activate the environment and verify both executables: @@ -74,6 +77,7 @@ buffer with the fork. - [Installation alternatives and PATH troubleshooting](doc/installation.md) - [Helix, Vim, and VSCodium setup](doc/editor-configuration.md) - [Development and packaging](doc/development.md) +- [Dependency and CI hardening plan](doc/supply-chain-hardening.md) The bridge is deliberately small. Contributions should preserve clean LSP standard output and keep the VSG subprocess boundary explicit. diff --git a/doc/development.md b/doc/development.md index e4b3ed9..4e6d04b 100644 --- a/doc/development.md +++ b/doc/development.md @@ -1,16 +1,76 @@ # Development and packaging +## Rust compatibility + +The bridge supports Rust 1.85.1 and newer. Rust does not publish long-term +support toolchains; 1.85.1 was chosen as a conservative distribution anchor +because it is shipped by Debian 13 stable. `Cargo.toml` declares the MSRV, +`Cargo.lock` pins an MSRV-compatible graph, and Jenkins checks that graph with +both Rust 1.85.1 and current stable. + +Future dependency updates must preserve this check or deliberately update the +declared MSRV, documentation, and Jenkins value together. Cargo's MSRV-aware +resolver is enabled in `.cargo/config.toml` to avoid selecting newer compatible +crate releases that require a newer compiler. + ## Bridge checks -Run the same checks as Jenkins before submitting a bridge change: +Run the same core checks as Jenkins before submitting a bridge change: ```sh +cargo +1.85.1 check --locked --all-targets --all-features +cargo +1.85.1 test --locked --all-targets --all-features cargo fmt --all -- --check -cargo check --all-targets --all-features -cargo test --all-targets --all-features -cargo clippy --all-targets --all-features -- -D warnings +cargo check --locked --all-targets --all-features +cargo test --locked --all-targets --all-features +cargo clippy --locked --all-targets --all-features -- -D warnings ``` +## Coverage + +Jenkins uses pinned `cargo-llvm-cov` 0.9.0 with the current stable toolchain. +To generate the same reports locally, install the tool and `llvm-tools-preview`, +then run: + +```sh +rustup component add llvm-tools-preview +cargo install cargo-llvm-cov --locked --version 0.9.0 +cargo llvm-cov clean --workspace +cargo llvm-cov --locked --all-features --html --output-dir coverage +cargo llvm-cov report --json --summary-only --output-path coverage/summary.json +cargo llvm-cov report --lcov --output-path coverage/lcov.info +scripts/render-coverage-badge.sh \ + "$(cargo llvm-cov report --summary-only | awk '$1 == "TOTAL" { gsub(/%/, "", $10); print $10 }')" \ + coverage/coverage.svg +``` + +CI archives the HTML report, LCOV data, JSON summary, and SVG badge. There is no +coverage floor yet because the initial bridge has no meaningful automated test +suite. Add a ratcheted line-coverage floor once behavior tests exist; never add +brittle tests merely to improve the percentage. + +For public reports, configure the Jenkins job or node environment variable +`COVERAGE_PUBLISH_ROOT` to the absolute path of the mounted coverage directory. +Successful `main` builds publish immutable artifacts under: + +```text +MadGobblins/vsg-bridge-ls// +``` + +The `main` symlink is updated only after the complete commit directory has been +moved into place. The README badge and report link use: + +```text +https://assets.dandaedre.com/coverage/MadGobblins/vsg-bridge-ls/main/coverage.svg +https://assets.dandaedre.com/coverage/MadGobblins/vsg-bridge-ls/main/html/ +``` + +The web server should receive this mount read-only, disable directory listing, +serve SVG with a restrictive content security policy, and apply long immutable +cache headers only to commit-addressed paths. Retention may remove old commit +directories, but should preserve tagged releases and every commit referenced by +the stable alias. + ## Companion VSG fork The fork keeps its stream-support patch small and rebases it onto upstream diff --git a/doc/installation.md b/doc/installation.md index ee6d377..907301b 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -58,13 +58,17 @@ python -m pip install \ Install the released branch directly from Gitea: ```sh -cargo install --git https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls.git +cargo install --locked \ + --git https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls.git ``` For development, clone this repository and use `cargo build`. Cargo normally places installed binaries in `~/.cargo/bin`; that directory must also be in the editor's PATH. +The bridge supports Rust 1.85.1 and newer. `--locked` uses the dependency +versions tested by CI and is required to preserve that compatibility guarantee. + ## PATH and virtual environments Activating `.venv` before launching the editor is the simplest setup because diff --git a/doc/supply-chain-hardening.md b/doc/supply-chain-hardening.md new file mode 100644 index 0000000..cfdd254 --- /dev/null +++ b/doc/supply-chain-hardening.md @@ -0,0 +1,73 @@ +# Dependency and CI hardening plan + +No single tool can prove that a dependency is safe. Use several independent +controls: reproducible resolution, known-vulnerability scanning, dependency +policy, human review, and an isolated build environment. + +## Available controls + +| Control | What it adds | Advantages | Costs and limits | +| --- | --- | --- | --- | +| Committed `Cargo.lock` and `--locked` | Exact versions and crates.io checksums | Fast, built into Cargo, reproducible, and prevents silent dependency drift | A checksum proves consistency, not that the first accepted crate was trustworthy; updates are manual | +| Pinned CI tools | Exact versions of coverage and security tools | Prevents surprise CI changes and makes failures reproducible | Pins become stale and the initial installation still trusts crates.io and its transitive graph | +| `cargo audit` | RustSec advisory and yanked-crate checks | Low setup cost and good signal for known vulnerabilities | Cannot detect unknown or deliberately malicious code; advisory updates require network access | +| `cargo deny` | License, source, duplicate, ban, advisory, and wildcard policy | One reviewable policy file; blocks unknown registries and Git sources | Needs license decisions and exception maintenance; duplicate versions are not automatically vulnerabilities | +| `cargo vet` | Human or imported audits for dependency code | Best direct answer to whether trusted reviewers inspected a crate | Highest maintenance cost; bootstrap requires imports, reviews, or explicit exemptions, and every update can need new evidence | +| Vendoring with `cargo vendor` | Repository or internal artifact copy of all crate sources | Offline builds, strong availability, and an inspectable frozen source set | Large diffs/storage, frequent refresh work, and vendoring malicious code does not make it safe | +| Private registry or registry proxy | Central allow-list, cache, and availability control | Useful across many projects; can quarantine versions and reduce external CI access | Becomes critical infrastructure and a concentrated trust/availability dependency | +| Ephemeral, unprivileged CI | Limits damage from build scripts and proc macros | Contains compromised build-time code and protects other jobs | Requires worker isolation; shared Cargo caches can reintroduce cross-job state | +| Network-denied build phase | Stops dependencies from calling external services during compilation/tests | Strong containment after sources and advisories are fetched | Requires a separate fetch phase and can expose packages that incorrectly depend on network access | +| Secretless pull-request jobs | Keeps tokens away from untrusted changes | Prevents straightforward credential theft through modified CI scripts | Publishing and deployment need a separate trusted-branch job or protected stage | +| SBOM and `cargo auditable` | Records the dependency graph in artifacts | Improves incident response and deployed-binary inventory | Primarily detective; it does not prevent compromise | +| Automated update proposals | Keeps dependencies and CI tools reviewably current | Small, regular updates are easier to review and audit | Notification noise and unsafe auto-merge rules can reduce review quality | +| Signed releases and provenance attestations | Connects published binaries to a reviewed build | Helps consumers verify origin and supports incident investigation | Key management and reproducible release infrastructure add substantial complexity | + +## Recommended rollout + +### Phase 1: reproducible baseline + +1. Keep `Cargo.lock` committed because this repository builds an executable. +2. Require `--locked` in CI, installation documentation, and release builds. +3. Declare Rust 1.85.1 in `Cargo.toml` and test both that exact toolchain and + current stable. +4. Pin third-party CI tool versions. Review and update them deliberately. + +These controls are implemented now. + +The initial pass also removes four direct dependencies that Cargo reports or +source inspection confirms are unused; the safest dependency is one the program +does not need. + +### Phase 2: policy gates + +1. Add pinned `cargo-audit` and fail on RustSec findings and yanked packages. +2. Add `cargo-deny` with explicit allowed licenses, crates.io as the only + registry, unknown Git sources denied, wildcards denied, and duplicate + versions reported for review. +3. Permit exceptions only with a reason, an owner, and a removal condition. +4. Run advisory refresh in a network-enabled stage, then run compilation and + tests without outbound network access where the Jenkins worker supports it. + +This is the best next cost/security tradeoff for this small project. + +### Phase 3: isolate and attest releases + +1. Run untrusted branches without credentials on disposable workers with + read-only base images and per-job Cargo directories. +2. Move package publication, coverage publication, tagging, and signing to a + protected trusted-branch job that consumes already-tested source revisions. +3. Generate an SBOM and build releases with `cargo auditable`. +4. Sign release checksums and publish provenance that records the commit, + toolchain, lockfile, and Jenkins build. + +### Phase 4: stronger dependency trust when justified + +Adopt `cargo vet` if the project becomes widely distributed or handles a more +sensitive boundary. Start with carefully selected audit imports, record every +exemption honestly, and require review of dependency diffs. Consider a private +registry proxy or vendoring if builds must continue without crates.io or policy +requires centralized dependency admission. + +Do not begin with `cargo vet` or full vendoring for this bridge: their ongoing +review cost is disproportionate until the basic audit, policy, isolation, and +test gates are healthy. diff --git a/scripts/publish-coverage.sh b/scripts/publish-coverage.sh new file mode 100755 index 0000000..c94bafc --- /dev/null +++ b/scripts/publish-coverage.sh @@ -0,0 +1,63 @@ +#!/bin/sh +set -eu + +usage() { + echo "usage: $0 " >&2 + exit 2 +} + +[ "$#" -eq 1 ] || usage +publication_root=$1 + +case "$publication_root" in + /*) ;; + *) + echo "coverage publication root must be an absolute path: $publication_root" >&2 + exit 2 + ;; +esac + +if [ ! -d "$publication_root" ] || [ ! -w "$publication_root" ]; then + echo "coverage publication root is not a writable directory: $publication_root" >&2 + exit 2 +fi + +for artifact in coverage/coverage.svg coverage/lcov.info coverage/summary.json coverage/html/index.html; do + if [ ! -f "$artifact" ]; then + echo "required coverage artifact is missing: $artifact" >&2 + exit 2 + fi +done + +commit=$(git rev-parse --verify HEAD) +case "$commit" in + *[!0-9a-f]*|'') + echo "Git returned an invalid commit identifier: $commit" >&2 + exit 2 + ;; +esac + +project_root="$publication_root/MadGobblins/vsg-bridge-ls" +destination="$project_root/$commit" +mkdir -p -- "$project_root" + +if [ -e "$destination" ]; then + if cmp -s coverage/summary.json "$destination/summary.json"; then + echo "coverage for $commit is already published" + else + echo "refusing to overwrite different coverage for immutable commit $commit" >&2 + exit 1 + fi +else + staging=$(mktemp -d "$project_root/.publish.XXXXXX") + trap 'rm -rf -- "$staging"' EXIT HUP INT TERM + cp -R -- coverage/. "$staging/" + mv -- "$staging" "$destination" + trap - EXIT HUP INT TERM +fi + +latest_link="$project_root/.main.$$" +ln -s -- "$commit" "$latest_link" +mv -f -- "$latest_link" "$project_root/main" + +echo "published coverage for $commit to $destination" diff --git a/scripts/render-coverage-badge.sh b/scripts/render-coverage-badge.sh new file mode 100755 index 0000000..d379b75 --- /dev/null +++ b/scripts/render-coverage-badge.sh @@ -0,0 +1,64 @@ +#!/bin/sh +set -eu + +usage() { + echo "usage: $0 " >&2 + exit 2 +} + +[ "$#" -eq 2 ] || usage +percent=$1 +output=$2 + +if ! awk -v value="$percent" 'BEGIN { + valid = value ~ /^[0-9]+([.][0-9]+)?$/ && value >= 0 && value <= 100 + exit(valid ? 0 : 1) +}'; then + echo "coverage percentage must be a number from 0 through 100: $percent" >&2 + exit 2 +fi + +rounded=$(awk -v value="$percent" 'BEGIN { printf "%.0f", value }') +if [ "$rounded" -ge 90 ]; then + color='#4c1' +elif [ "$rounded" -ge 70 ]; then + color='#dfb317' +else + color='#e05d44' +fi + +output_dir=${output%/*} +if [ "$output_dir" != "$output" ]; then + mkdir -p -- "$output_dir" +fi + +temporary="${output}.tmp.$$" +trap 'rm -f -- "$temporary"' EXIT HUP INT TERM + +sed \ + -e "s/@PERCENT@/${rounded}/g" \ + -e "s/@COLOR@/${color}/g" \ + >"$temporary" <<'EOF' + + coverage: @PERCENT@% + + + + + + + + + + + + + + coverage + @PERCENT@% + + +EOF + +mv -- "$temporary" "$output" +trap - EXIT HUP INT TERM diff --git a/src/main.rs b/src/main.rs index 64155bd..23231c8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,6 +35,7 @@ struct Args { configuration: Vec, } +/// Language-server state and arguments used for each VSG invocation. #[allow(dead_code)] #[derive(Debug)] struct Backend {