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): fixed lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSwapFeeder committed Feb 15, 2024
1 parent e874d78 commit e6b1cd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 5 additions & 9 deletions toolchains/solidity/core/crates/slither-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl Backend {
async fn is_in_libs(&self, path: &str) -> bool {
let state = self.data.lock().await;
for lib in state.libs_paths.iter() {
let fsrc = format!("/{}/", lib.replace("\"", ""));
let fsrc = format!("/{}/", lib.replace('\"', ""));
eprintln!("Check path: '{}' contains lib: '{}'", path, fsrc);
if path.contains(&fsrc) {
return true;
Expand All @@ -194,7 +194,7 @@ impl Backend {
async fn is_in_src(&self, path: &str) -> bool {
let state = self.data.lock().await;
for src in state.src_paths.iter() {
let fsrc = format!("/{}/", src.replace("\"", ""));
let fsrc = format!("/{}/", src.replace('\"', ""));
eprintln!("Check path: '{}' contains src: '{}'", path, fsrc);
if path.contains(&fsrc) {
return true;
Expand All @@ -206,7 +206,7 @@ impl Backend {
async fn is_in_tests(&self, path: &str) -> bool {
let state = self.data.lock().await;
for test in state.tests_paths.iter() {
let fsrc = format!("/{}/", test.replace("\"", ""));
let fsrc = format!("/{}/", test.replace('\"', ""));
eprintln!("Check path: '{}' contains test: '{}'", path, fsrc);
if path.contains(&fsrc) {
return true;
Expand All @@ -221,8 +221,7 @@ impl Backend {
for folder in workspaces {
let folderpath = normalize_slither_path(folder.uri.path());
let foundry_path = find_foundry_toml_config(&folderpath);
match foundry_path {
Ok(path) => {
if let Ok(path) = foundry_path {
let foundry = std::fs::read_to_string(path.clone());
match foundry {
Ok(foundry) => {
Expand All @@ -236,8 +235,6 @@ impl Backend {
}
}
}
Err(_) => {}
}
}
Ok(())
}
Expand All @@ -253,7 +250,6 @@ impl Backend {
tokio::select! {
_ = clone.cancelled() => {
eprintln!("SLITHER CANCELLED");
return;
}
output = parse_slither_out(uri.path()) => {
match output {
Expand Down Expand Up @@ -293,6 +289,6 @@ async fn main() {
let stdin = tokio::io::stdin();
let stdout = tokio::io::stdout();

let (service, socket) = LspService::new(|client| Backend::new(client));
let (service, socket) = LspService::new(Backend::new);
Server::new(stdin, stdout, socket).serve(service).await;
}
3 changes: 2 additions & 1 deletion toolchains/solidity/extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export async function activate(context: ExtensionContext) {
foundryCompilerClient = createFoundryCompilerClient(context);
slitherClient = await createSlitherClient(context);
testsPositionsClient = await createTestsPositionsClient(context);
if (workspace.workspaceFolders?.length)
if (workspace.workspaceFolders?.length) {
testManager = new TestManager(testsPositionsClient, workspace.workspaceFolders[0].uri.fsPath);
}

context.subscriptions.push(linterClient, foundryCompilerClient, slitherClient, testsPositionsClient, testManager.testController);

Expand Down

0 comments on commit e6b1cd9

Please sign in to comment.