stackmuncher / stm_app

This software engineer profile builder turns your code into a detailed list of skills for an online directory of software developers.
https://stackmuncher.com
GNU Affero General Public License v3.0
22 stars 1 forks source link

Rust dependencies are missing from single file commits #7

Open rimutaka opened 3 years ago

rimutaka commented 3 years ago

When someone commits a single .rs file it doesn't have any pkg or refs sections because:

For 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.

rimutaka commented 3 years ago

Possible regex: (?im)\s*use\s+[a-zA-Z:]+\{[a-zA-Z:\s,{}]+;

rimutaka commented 3 years ago

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"
)
rimutaka commented 3 years ago

Relates to #8