Skip to content

Commit

Permalink
feat: Adds typo plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Chernicoff committed Oct 30, 2024
1 parent 1f344b9 commit 3123de3
Show file tree
Hide file tree
Showing 14 changed files with 1,431 additions and 12 deletions.
18 changes: 17 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ members = [
"plugins/entropy",
"plugins/linguist",
"plugins/review",
"plugins/binary"
, "plugins/identity"]
"plugins/binary",
"plugins/identity",
"plugins/typo"]

# Make sure Hipcheck is run with `cargo run`.
#
Expand Down
5 changes: 1 addition & 4 deletions hipcheck/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ fn default_query_explanation(
let core = db.core();
let key = get_plugin_key(publisher.as_str(), plugin.as_str());
let Some(p_handle) = core.plugins.get(&key) else {
return Err(hc_error!(
"Plugin '{}' not found",
key,
));
return Err(hc_error!("Plugin '{}' not found", key,));
};
Ok(p_handle.get_default_query_explanation().cloned())
}
Expand Down
3 changes: 1 addition & 2 deletions plugins/affiliation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ strum = { version = "0.26.3", features = ["derive"] }
tokio = { version = "1.40.0", features = ["rt"] }

[dev-dependencies]
hipcheck-sdk = { path = "../../sdk/rust", features = ["macros", "mock_engine"]}
test-log = "0.2.16"
hipcheck-sdk = { path = "../../sdk/rust", features = ["macros", "mock_engine"]}
4 changes: 1 addition & 3 deletions plugins/affiliation/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,6 @@ mod test {

use pathbuf::pathbuf;
use std::{env, result::Result as StdResult};
use test_log::test;

fn repo() -> LocalGitRepo {
LocalGitRepo {
path: "/home/users/me/.cache/hipcheck/clones/github/foo/bar/".to_string(),
Expand Down Expand Up @@ -547,7 +545,7 @@ mod test {
Ok(mock_responses)
}

#[test(tokio::test)]
#[tokio::test]
async fn test_affiliation() {
let orgs_file = pathbuf![&env::current_dir().unwrap(), "test", "example_orgs.kdl"];
let orgs_spec = OrgSpec::load_from(&orgs_file).unwrap();
Expand Down
10 changes: 10 additions & 0 deletions plugins/npm_dependencies/plugin.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
publisher "mitre"
name "npm_dependencies"
version "0.1.0"
license "Apache-2.0"
entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/npm_dependencies"
on arch="x86_64-apple-darwin" "./target/debug/npm_dependencies"
on arch="x86_64-unknown-linux-gnu" "./target/debug/npm_dependencies"
on arch="x86_64-pc-windows-msvc" "./target/debug/npm_dependencies"
}
22 changes: 22 additions & 0 deletions plugins/typo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "typo_sdk"
version = "0.1.0"
license = "Apache-2.0"
edition = "2021"
publish = false

[dependencies]
anyhow = "1.0.91"
clap = { version = "4.5.18", features = ["derive"] }
hipcheck-sdk = { path = "../../sdk/rust", features = ["macros"] }
log = "0.4.22"
maplit = "1.0.2"
pathbuf = "1.0.0"
serde = { version = "1.0.210", features = ["derive", "rc"] }
serde_json = "1.0.128"
tokio = { version = "1.40.0", features = ["rt"] }
toml = "0.8.19"
url = "2.5.2"

[dev-dependencies]
hipcheck-sdk = { path = "../../sdk/rust", features = ["mock_engine"] }
13 changes: 13 additions & 0 deletions plugins/typo/plugin.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
publisher "mitre"
name "typo"
version "0.1.0"
license "Apache-2.0"
entrypoint {
on arch="aarch64-apple-darwin" "./target/debug/typo"
on arch="x86_64-apple-darwin" "./target/debug/typo"
on arch="x86_64-unknown-linux-gnu" "./target/debug/typo"
on arch="x86_64-pc-windows-msvc" "./target/debug/typo"
}
dependencies {
plugin "mitre/npm_dependencies" version="0.1.0" manifest="./plugins/npm_dependencies/plugin.kdl"
}
Loading

0 comments on commit 3123de3

Please sign in to comment.