diff --git a/src/actions/linter/Cargo.toml b/src/actions/linter/Cargo.toml deleted file mode 100644 index d5db5a62a..000000000 --- a/src/actions/linter/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "linter" -version = "26.4.0" -edition = "2024" - -[dependencies] -serde = { version = "1.0.228", features = ["derive"] } -serde_json = "1.0.149" - -[[bin]] -name = "linter" -path = "linter.rs" \ No newline at end of file diff --git a/src/actions/linter/linter.rs b/src/actions/linter/linter.rs deleted file mode 100644 index df323cc7d..000000000 --- a/src/actions/linter/linter.rs +++ /dev/null @@ -1,44 +0,0 @@ -// this was written in like 30 minutes -use std::fs; -use std::process::{Command, exit}; -use std::path::Path; - -fn main() { - let output = Command::new("git") - .args(&["diff", "--name-only", "HEAD~1", "HEAD"]) - .output() - .expect("Failed to execute git diff"); - - let stdout = String::from_utf8_lossy(&output.stdout); - let mut failed = false; - - for file_path in stdout.lines() { - let path = Path::new(file_path); - - if !path.exists() { continue; } - - if file_path.ends_with(".json") || file_path.ends_with(".mcmeta") { - if file_path.starts_with("modpacks/") || - file_path.starts_with("resourcepacks/") || - file_path.starts_with("datapacks/") { - - println!("::group::Linting {}", file_path); - let content = fs::read_to_string(path).expect("Read Error"); - - if let Err(e) = serde_json::from_str::(&content) { - eprintln!("::error file={}::INVALID JSON: {}", file_path, e); - failed = true; - } - println!("::endgroup::"); - } - } - } - - if failed { - eprintln!("Fix yo json chud..."); - exit(1); - } else { - println!("Lint success"); - } -} -// if this doesnt work i will cry bro i havent used rust since i was 11 \ No newline at end of file diff --git a/src/actions/somnus/core/src/lib.rs b/src/actions/somnus/core/src/lib.rs index bda255782..5a035a4e5 100644 --- a/src/actions/somnus/core/src/lib.rs +++ b/src/actions/somnus/core/src/lib.rs @@ -7,6 +7,8 @@ pub mod state; pub mod logger; pub mod linter; +pub use linter::{lint_changed_files, LintReport}; + use git2::Repository; use crate::errors::SomnusError;