diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4a3a451a..84fb9023 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -81,11 +81,11 @@ jobs: - name: Clippy run: cargo clippy --all-targets --all-features - - name: Lint + - name: Check for Forbidden Words if: matrix.target == 'x86_64-apple-darwin' run: | brew install ripgrep - ./bin/lint + ./bin/forbid - name: Check Formatting run: cargo fmt --all -- --check diff --git a/bin/forbid b/bin/forbid new file mode 100755 index 00000000..6be43d2d --- /dev/null +++ b/bin/forbid @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +which rg + +! rg \ + --glob !bin/forbid \ + --glob !CHANGELOG.md \ + --ignore-case \ + 'dbg!|fixme|todo|xxx' diff --git a/bin/lint b/bin/lint deleted file mode 100755 index 389270c0..00000000 --- a/bin/lint +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -! rg \ - --glob !bin/lint \ - --ignore-case \ - 'FIXME|TODO|XXX|todo!|#\[ignore\]' diff --git a/justfile b/justfile index a3df8afc..339fc1ae 100644 --- a/justfile +++ b/justfile @@ -38,8 +38,8 @@ clippy: fmt: cargo +nightly fmt --all -lint: - ./bin/lint +forbid: + ./bin/forbid preview-readme: grip -b README.md @@ -64,7 +64,7 @@ gen: check-minimal-versions: ./bin/check-minimal-versions -check: test clippy lint check-minimal-versions gen +check: test clippy forbid check-minimal-versions gen git diff --no-ext-diff --quiet --exit-code cargo +nightly fmt --all -- --check diff --git a/src/peer/message.rs b/src/peer/message.rs index 72342b46..0ad9b318 100644 --- a/src/peer/message.rs +++ b/src/peer/message.rs @@ -51,7 +51,7 @@ impl Message { // // where prefix is the network byte order encoding of `x + 1` into a u32. pub(crate) fn serialize(&self) -> Result> { - // TODO: find a way to test this without blowing the stack. + // find a way to test this without blowing the stack. let message_length = self.len().try_into().context(error::PeerMessagePayload)?; let mut buf: Vec = u32::to_be_bytes(message_length).to_vec(); buf.push(self.flavour.into()); diff --git a/src/peer/message/extended/ut_metadata.rs b/src/peer/message/extended/ut_metadata.rs index 2c323335..75f1ddd3 100644 --- a/src/peer/message/extended/ut_metadata.rs +++ b/src/peer/message/extended/ut_metadata.rs @@ -75,7 +75,7 @@ mod tests { let mut msg = bendy::serde::ser::to_bytes(&req).unwrap(); let benc = b"d8:msg_typei1e5:piecei1ee"; assert_eq!(benc, &*msg); - msg.extend_from_slice(b"piece data goes here xxxx..."); + msg.extend_from_slice(b"piece data goes here..."); let req2 = bendy::serde::de::from_bytes(&msg).unwrap(); assert_eq!(req, req2); } diff --git a/src/tracker/client.rs b/src/tracker/client.rs index 15f7c416..320cf550 100644 --- a/src/tracker/client.rs +++ b/src/tracker/client.rs @@ -16,12 +16,12 @@ impl Client { pub fn connect(address: A) -> Result { let addrs = address - .to_socket_addrs() // XXX: this may cause DNS look-ups! + .to_socket_addrs() // this may cause DNS look-ups! .context(error::TrackerSocketAddrs)?; for tracker_addr in addrs { let Ok(sock) = Self::new_udp_socket(tracker_addr) else { - continue; // TODO: log these as warnings + continue; // log these as warnings }; let mut client = Client { peer_id: rand::thread_rng().gen(),