Today, to check if the npm/yarn package is used in files we are only checking that the file contains the package name.
We'll need to modify thoses conditions to improve file dependencies checking.
For example, now we're using the string_exists_in_multiline_text function:
pub fn string_exists_in_multiline_text(term: &str, content: &str) -> bool {
for line in content.lines() {
if line.contains(term) {
return true;
}
}
false
}
NOTE: We are reading files line by line because generally import are matched in like 10-20 first lines.
I think that we should move and rename this function into the Project trait to handle multiple (project's relative) ways to check if the dependency is used in the file.
Example for NodeJS Projects that should detect lines like :
import foo from "bar";
import "foo";
import { Foo } from "bar";
Remember to handle CSS/Scss files too.
And in JSON file a think that we should only match the values and not the keys but I didn't thought too much of it.
Today, to check if the npm/yarn package is used in files we are only checking that the file contains the package name.
We'll need to modify thoses conditions to improve file dependencies checking.
For example, now we're using the
string_exists_in_multiline_textfunction:I think that we should move and rename this function into the
Projecttrait to handle multiple (project's relative) ways to check if the dependency is used in the file.Example for NodeJS Projects that should detect lines like :
import foo from "bar";import "foo";import { Foo } from "bar";Remember to handle CSS/Scss files too.
And in JSON file a think that we should only match the values and not the keys but I didn't thought too much of it.