@@ -29,37 +29,41 @@ var (
29
29
errNotEnoughArg = errors .New ("path argument required" )
30
30
)
31
31
32
- // configuredUpdates returns the set of Go modules and Dockerfiles dependabot
32
+ // configuredUpdates returns the set of Go modules, Dockerfiles, Pip requirements dependabot
33
33
// is configured to check updates for.
34
- func configuredUpdates (path string ) (mods map [string ]struct {}, docker map [string ]struct {}, err error ) {
34
+ func configuredUpdates (path string ) (mods map [string ]struct {}, docker map [string ]struct {}, pip map [ string ] struct {}, err error ) {
35
35
f , err := os .Open (filepath .Clean (path ))
36
36
if errors .Is (err , os .ErrNotExist ) {
37
- return nil , nil , fmt .Errorf ("dependabot configuration file does not exist: %s" , path )
37
+ return nil , nil , nil , fmt .Errorf ("dependabot configuration file does not exist: %s" , path )
38
38
}
39
39
if err != nil {
40
- return nil , nil , fmt .Errorf ("failed to read dependabot configuration file: %s" , path )
40
+ return nil , nil , nil , fmt .Errorf ("failed to read dependabot configuration file: %s" , path )
41
41
}
42
42
43
43
var c dependabotConfig
44
44
if err := yaml .NewDecoder (f ).Decode (& c ); err != nil {
45
- return nil , nil , fmt .Errorf ("invalid dependabot configuration: %w" , err )
45
+ return nil , nil , nil , fmt .Errorf ("invalid dependabot configuration: %w" , err )
46
46
}
47
47
48
48
mods = make (map [string ]struct {})
49
49
docker = make (map [string ]struct {})
50
+ pip = make (map [string ]struct {})
50
51
for _ , u := range c .Updates {
51
52
if u .PackageEcosystem == dockerPkgEco {
52
53
docker [u .Directory ] = struct {}{}
53
54
}
54
55
if u .PackageEcosystem == gomodPkgEco {
55
56
mods [u .Directory ] = struct {}{}
56
57
}
58
+ if u .PackageEcosystem == pipPkgEco {
59
+ pip [u .Directory ] = struct {}{}
60
+ }
57
61
}
58
- return mods , docker , nil
62
+ return mods , docker , pip , nil
59
63
}
60
64
61
- // verify ensures dependabot configuration contains a check for all modules and
62
- // Dockerfiles.
65
+ // verify ensures dependabot configuration contains a check for all modules,
66
+ // Dockerfiles, and requirements.txt files .
63
67
func verify (args []string ) error {
64
68
switch len (args ) {
65
69
case 0 :
@@ -80,7 +84,12 @@ func verify(args []string) error {
80
84
return err
81
85
}
82
86
83
- modUp , dockerUp , err := configuredUpdatesFunc (args [0 ])
87
+ pipFiles , err := allPipFunc (root )
88
+ if err != nil {
89
+ return err
90
+ }
91
+
92
+ modUp , dockerUp , pipUp , err := configuredUpdatesFunc (args [0 ])
84
93
if err != nil {
85
94
return err
86
95
}
@@ -107,15 +116,29 @@ func verify(args []string) error {
107
116
missingDocker = append (missingDocker , local )
108
117
}
109
118
}
119
+ var missingPip []string
120
+ for _ , p := range pipFiles {
121
+ local , err := localPath (root , p )
122
+ if err != nil {
123
+ return err
124
+ }
125
+
126
+ if _ , ok := pipUp [local ]; ! ok {
127
+ missingPip = append (missingPip , local )
128
+ }
129
+ }
110
130
111
- if len (missingMod ) > 0 || len (missingDocker ) > 0 {
131
+ if len (missingMod ) > 0 || len (missingDocker ) > 0 || len ( missingPip ) > 0 {
112
132
msg := "missing update check(s):"
113
133
if len (missingMod ) > 0 {
114
134
msg = fmt .Sprintf ("%s\n - Go mod files: %s" , msg , strings .Join (missingMod , ", " ))
115
135
}
116
136
if len (missingDocker ) > 0 {
117
137
msg = fmt .Sprintf ("%s\n - Dockerfiles: %s" , msg , strings .Join (missingDocker , ", " ))
118
138
}
139
+ if len (missingPip ) > 0 {
140
+ msg = fmt .Sprintf ("%s\n - Pip files: %s" , msg , strings .Join (missingPip , ", " ))
141
+ }
119
142
msg += "\n "
120
143
return errors .New (msg )
121
144
}
0 commit comments