Open rimutaka opened 3 years ago
Possible regex: (?im)\s*use\s+[a-zA-Z:]+\{[a-zA-Z:\s,{}]+;
This same problem applies to Go and can be solved with (?im)\s*import\s*\([^\)]+\)
import (
"encoding/binary"
"encoding/json"
"errors"
"net/url"
"reflect"
"testing"
"time"
. "gopkg.in/check.v1"
"gopkg.in/mgo.v2/bson"
)
Relates to #8
When someone commits a single .rs file it doesn't have any pkg or refs sections because:
use
statements are not parsed due to their complexityCargo.toml
is not part of the commitFor example, committing https://github.com/matrix-org/matrix-rust-sdk/blob/master/matrix_sdk/src/client.rs generates matrix-org/matrix-rust-sdk/7772f89445b843a1b656bfcd9642776af2ae2094.report. The use-part there is not easy to parse. Even if it was parsed, what should be included in the report? How many levels down?
An easier way may be to always grab Cargo.toml, get the list of dependencies and run through the file looking for matches. Any matching deps will be included in the contribution report.
This should only apply to some languages where imports are too hard to parse.