@@ -41,7 +41,7 @@ func (gdf PythonDepsFetcher) GetDepsList(ctx context.Context, restyClient *resty
4141 re := regexp .MustCompile (`^([a-zA-Z0-9_-]+)[^a-zA-Z0-9_-]` )
4242 match := re .FindStringSubmatch (line )
4343 if len (match ) >= 2 {
44- directDeps = append (directDeps , match [1 ])
44+ directDeps = append (directDeps , strings . ToLower ( match [1 ]) )
4545 }
4646 }
4747 }
@@ -63,7 +63,7 @@ func (gdf PythonDepsFetcher) GetDepsList(ctx context.Context, restyClient *resty
6363
6464 if depSection , ok := cfg .Get ("tool.poetry.dependencies" ).(* toml.Tree ); ok {
6565 for name := range depSection .ToMap () {
66- directDeps = append (directDeps , name )
66+ directDeps = append (directDeps , strings . ToLower ( name ) )
6767 }
6868 }
6969 }
@@ -94,6 +94,40 @@ func (gdf PythonDepsFetcher) GetDepsList(ctx context.Context, restyClient *resty
9494 }
9595 }
9696
97+ pipfileUrl := fmt .Sprintf ("%s/%s/%s/Pipfile" , rawGHUrl , ghRepo , result .DefaultBranch )
98+
99+ resp , err = restyReq .Get (pipfileUrl )
100+
101+ if resp .IsSuccess () && err == nil {
102+ reader := bytes .NewReader ([]byte (resp .Body ()))
103+ scanner := bufio .NewScanner (reader )
104+
105+ dependencyRegex := regexp .MustCompile (`\b([\w\d_-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+))` )
106+ currentSection := ""
107+
108+ for scanner .Scan () {
109+ line := strings .TrimSpace (scanner .Text ())
110+
111+ // Check if the line contains a section header
112+ if strings .HasPrefix (line , "[" ) && strings .HasSuffix (line , "]" ) {
113+ currentSection = line [1 : len (line )- 1 ]
114+ continue
115+ }
116+
117+ // Check if the line contains a dependency
118+ matches := dependencyRegex .FindStringSubmatch (line )
119+ if len (matches ) >= 2 && (currentSection == "dev-packages" || currentSection == "packages" ) {
120+ dependencyName := matches [1 ]
121+ directDeps = append (directDeps , strings .ToLower (dependencyName ))
122+ }
123+ }
124+
125+ // Check for errors during scanning
126+ if err := scanner .Err (); err != nil {
127+ return err
128+ }
129+ }
130+
97131 result .DirectDeps = directDeps
98132
99133 return nil
0 commit comments