Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
fix(solidity/core/slither): ignored tests files anaysis
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSwapFeeder committed Dec 18, 2023
1 parent 010bfb2 commit cc53356
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
37 changes: 24 additions & 13 deletions toolchains/solidity/core/crates/slither-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,18 @@ impl LanguageServer for Backend {
),
)
.await;
self.check_slither_result(file.text_document.uri).await
}

async fn did_change(&self, file: DidChangeTextDocumentParams) {
self.client
.log_message(
MessageType::INFO,
format!(
"Changed file '{}' for analyzing.",
file.text_document.uri.path()
),
)
.await;
if file.text_document.uri.path().ends_with(".t.sol") {
self.client
.log_message(
MessageType::INFO,
format!(
"File '{}' is a test solidity file, skipping analysis.",
file.text_document.uri.path()
),
)
.await;
return;
}
self.check_slither_result(file.text_document.uri).await
}

Expand All @@ -104,6 +103,18 @@ impl LanguageServer for Backend {
),
)
.await;
if file.text_document.uri.path().ends_with(".t.sol") {
self.client
.log_message(
MessageType::INFO,
format!(
"File '{}' is a test solidity file, skipping analysis.",
file.text_document.uri.path()
),
)
.await;
return;
}
self.check_slither_result(file.text_document.uri).await
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub fn exec_slither(filepath: &str) -> Result<Vec<Diagnostic>, SlitherError> {
.arg("-")
.output()?;
if out.status.code() == Some(1) {
eprintln!("Unknown error occured: {:?}", out);
return Err(SlitherError::Unknown);
}
if out.stdout.is_empty() {
Expand Down

0 comments on commit cc53356

Please sign in to comment.