Compare commits
No commits in common. "31a459637c97e7ebf1c042536197dac590ea8cb4" and "bf8df3bd39c81fe108ef0c930c4ab2e2da9d2ba6" have entirely different histories.
31a459637c
...
bf8df3bd39
|
@ -1,5 +1,6 @@
|
||||||
.direnv/
|
# Generated by Cargo
|
||||||
coverage/
|
|
||||||
debug/
|
debug/
|
||||||
target/
|
target/
|
||||||
Cargo.lock
|
|
||||||
|
# Code coverage results
|
||||||
|
coverage/
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
Cargo.toml
|
@ -11,12 +11,12 @@ edition = "2021"
|
||||||
path = "source/lib.rs"
|
path = "source/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chrono = "0.4.34"
|
chrono = "0.4.26"
|
||||||
duplicate = "^1.0.0"
|
duplicate = "^1.0.0"
|
||||||
lazy_static = "^1.4.0"
|
lazy_static = "^1.4.0"
|
||||||
regex = "^1.10.3"
|
regex = "^1.8.4"
|
||||||
scraper = "^0.18.1"
|
scraper = "^0.16.0"
|
||||||
thiserror = "1.0.57"
|
thiserror = "1.0.40"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "^1.35.1"
|
insta = "^1.29.0"
|
||||||
|
|
|
@ -1,21 +1,33 @@
|
||||||
# Do a full check of everything.
|
[tasks.fmt]
|
||||||
[tasks.complete-check]
|
command = "cargo"
|
||||||
dependencies = [
|
args = ["fmt", "${@}"]
|
||||||
"format",
|
|
||||||
"spellcheck",
|
[tasks.check]
|
||||||
"check",
|
command = "cargo"
|
||||||
"clippy",
|
args = ["check", "${@}"]
|
||||||
"test",
|
|
||||||
"code-coverage",
|
[tasks.clippy]
|
||||||
"docs",
|
command = "cargo"
|
||||||
"build",
|
args = ["clippy", "${@}"]
|
||||||
"audit-flow",
|
|
||||||
"outdated-flow",
|
[tasks.test]
|
||||||
]
|
command = "cargo"
|
||||||
|
args = ["test", "${@}"]
|
||||||
|
|
||||||
|
[tasks.doc]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["doc", "${@}"]
|
||||||
|
|
||||||
|
[tasks.build]
|
||||||
|
command = "cargo"
|
||||||
|
args = ["build", "${@}"]
|
||||||
|
|
||||||
|
[tasks.complete-check]
|
||||||
|
dependencies = ["fmt", "check", "clippy", "test", "doc", "build"]
|
||||||
|
|
||||||
# Run cargo-tarpaulin and output the test coverage.
|
|
||||||
[tasks.code-coverage]
|
[tasks.code-coverage]
|
||||||
workspace = false
|
workspace = false
|
||||||
|
install_crate = "cargo-tarpaulin"
|
||||||
command = "cargo"
|
command = "cargo"
|
||||||
args = [
|
args = [
|
||||||
"tarpaulin",
|
"tarpaulin",
|
||||||
|
@ -23,10 +35,5 @@ args = [
|
||||||
"--out=html",
|
"--out=html",
|
||||||
"--output-dir=coverage",
|
"--output-dir=coverage",
|
||||||
"--skip-clean",
|
"--skip-clean",
|
||||||
"--target-dir=target/tarpaulin",
|
"--target-dir=target/tarpaulin"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Do a source code spellcheck.
|
|
||||||
[tasks.spellcheck]
|
|
||||||
clear = true
|
|
||||||
command = "typos"
|
|
||||||
|
|
128
flake.lock
128
flake.lock
|
@ -1,128 +0,0 @@
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705309234,
|
|
||||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1705309234,
|
|
||||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1708751719,
|
|
||||||
"narHash": "sha256-0uWOKSpXJXmXswOvDM5Vk3blB74apFB6rNGWV5IjoN0=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "f63ce824cd2f036216eb5f637dfef31e1a03ee89",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"id": "nixpkgs",
|
|
||||||
"type": "indirect"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1706487304,
|
|
||||||
"narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "90f456026d284c22b3e3497be980b2e47d0b28ac",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": "nixpkgs",
|
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-utils": "flake-utils_2",
|
|
||||||
"nixpkgs": "nixpkgs_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1708827164,
|
|
||||||
"narHash": "sha256-oBNS6pO04Y6gZBLThP3JDDgviex0+WTXz3bVBenyzms=",
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"rev": "e0626adabd5ea461f80b1b11390da2a6575adb30",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
17
flake.nix
17
flake.nix
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
inputs = {
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
|
||||||
let
|
|
||||||
overlays = [ (import rust-overlay) ];
|
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
|
||||||
in
|
|
||||||
{
|
|
||||||
devShells.default = import ./shell.nix { inherit pkgs; };
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
[toolchain]
|
|
||||||
channel = "stable"
|
|
||||||
components = ["cargo", "clippy", "rustfmt", "rust-src"]
|
|
19
shell.nix
19
shell.nix
|
@ -1,19 +0,0 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }:
|
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
let
|
|
||||||
rustup-toolchain = rust-bin.fromRustupToolchainFile ./rustup-toolchain.toml;
|
|
||||||
in
|
|
||||||
mkShell rec {
|
|
||||||
packages = [
|
|
||||||
cargo-audit
|
|
||||||
cargo-edit
|
|
||||||
cargo-insta
|
|
||||||
cargo-make
|
|
||||||
cargo-outdated
|
|
||||||
cargo-tarpaulin
|
|
||||||
rustup-toolchain
|
|
||||||
typos
|
|
||||||
];
|
|
||||||
}
|
|
|
@ -64,7 +64,7 @@ pub enum TopicAuthor {
|
||||||
/// The topic was posted by Tildes itself.
|
/// The topic was posted by Tildes itself.
|
||||||
///
|
///
|
||||||
/// Technically the user for this is [Tildes](https://tildes.net/user/tildes)
|
/// Technically the user for this is [Tildes](https://tildes.net/user/tildes)
|
||||||
/// but in the topic it says "Automatically posted <date>" where the username
|
/// but in the topic it says "Automatically posted <date>" where the username
|
||||||
/// normally goes, so may as well special-case it here too.
|
/// normally goes, so may as well special-case it here too.
|
||||||
Scheduled,
|
Scheduled,
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ impl Topic {
|
||||||
} else {
|
} else {
|
||||||
TopicAuthor::Name(
|
TopicAuthor::Name(
|
||||||
topic_byline
|
topic_byline
|
||||||
.split(' ')
|
.split(" ")
|
||||||
.last()
|
.last()
|
||||||
.ok_or(ParseError::MissingExpectedHtml)?
|
.ok_or(ParseError::MissingExpectedHtml)?
|
||||||
.to_string(),
|
.to_string(),
|
||||||
|
@ -121,7 +121,7 @@ impl Topic {
|
||||||
select_first_element_text(topic_article_element, &TOPIC_COMMENT_COUNT)
|
select_first_element_text(topic_article_element, &TOPIC_COMMENT_COUNT)
|
||||||
{
|
{
|
||||||
comment_total
|
comment_total
|
||||||
.split(' ')
|
.split(" ")
|
||||||
.next()
|
.next()
|
||||||
.map(|count| count.parse::<i32>())
|
.map(|count| count.parse::<i32>())
|
||||||
.ok_or(ParseError::MissingExpectedHtml)?
|
.ok_or(ParseError::MissingExpectedHtml)?
|
||||||
|
@ -154,7 +154,7 @@ impl Topic {
|
||||||
"",
|
"",
|
||||||
)
|
)
|
||||||
.to_string();
|
.to_string();
|
||||||
assert!(group.starts_with('~'));
|
assert!(group.starts_with("~"));
|
||||||
|
|
||||||
let id = topic_article_element
|
let id = topic_article_element
|
||||||
.value()
|
.value()
|
||||||
|
|
Loading…
Reference in New Issue