@@ -53,6 +53,7 @@ def initialize_(self, action):
53
53
init = True
54
54
self .uniform_score = action .readParam ("uniform_score" )
55
55
self .min_contributions = action .readParam ("min_contributions" , default = 0 )
56
+ self .include_deps = action .readParam ("include_dependencies" , default = False )
56
57
init = False if not self .uniform_score or not self .min_contributions else True
57
58
return init
58
59
@@ -112,34 +113,14 @@ def gather_(self, cachedContributors=[]):
112
113
"Gathering project information of '%s' at local folder '%s"
113
114
% (projectUrl , self .directory )
114
115
)
115
-
116
116
if self .include_main_repository :
117
- #### find official repositories
118
- self .log (
119
- "Including contributors of root project '%s'"
120
- % localProject .full_name
121
- )
122
-
123
- self .log (" -- %s" % localProject .html_url )
124
- # print(" -- %s" % [c.author.email for c in localContributors])
125
-
126
- ### grab contributors
127
- remoteContributors = self .githubConnector .grabRemoteProjectContributors (
128
- localProject
129
- )
130
- ### filter contributors
131
- remoteContributors = self .validateContributors (remoteContributors )
132
- ### extract relevant contributor information from the guthub api
133
- for c in remoteContributors :
134
- email = c .stats .author .email .lower ()
135
- username = c .stats .author .login
136
- project = c .fromProject
137
- if email and username :
138
- contributors .append (Contributor (username , email , fromProject = project ))
139
- ### calculate scores of the contributors
140
- ### we could dosome fancy stuff here
141
- ### but for now, everyone gets uniform "base" score and nothing else
142
- scores = [self .uniform_score for i in range (len (contributors ))]
117
+ cons , scrs = self .gatherProjectContributors (localProject )
118
+ contributors .extend (cons )
119
+ scores .extend (scrs )
120
+ if self .include_deps :
121
+ cons , scrs = self .gatherProjectDeps (localProject )
122
+ contributors .extend (cons )
123
+ scores .extend (scrs )
143
124
else :
144
125
self .log (
145
126
"Skipping work because no Connector with name '%s' could be found!"
@@ -153,6 +134,38 @@ def gather_(self, cachedContributors=[]):
153
134
### specialzed plugin methods can be added here
154
135
##################################################################################
155
136
###
137
+ def gatherProjectContributors (self , project ):
138
+ contributors = []
139
+ #### find official repositories
140
+ self .log ("Including contributors of root project '%s'" % project .full_name )
141
+ self .log (" -- %s" % project .html_url )
142
+ # print(" -- %s" % [c.author.email for c in localContributors])
143
+
144
+ ### grab contributors
145
+ remoteContributors = self .githubConnector .grabRemoteProjectContributors (project )
146
+ ### filter contributors
147
+ remoteContributors = self .validateContributors (remoteContributors )
148
+ ### extract relevant contributor information from the guthub api
149
+ for c in remoteContributors :
150
+ email = c .stats .author .email .lower ()
151
+ username = c .stats .author .login
152
+ project = c .fromProject
153
+ if email and username :
154
+ contributors .append (Contributor (username , email , fromProject = project ))
155
+ ### calculate scores of the contributors
156
+ ### we could dosome fancy stuff here
157
+ ### but for now, everyone gets uniform "base" score and nothing else
158
+ scores = [self .uniform_score for i in range (len (contributors ))]
159
+ return contributors , scores
160
+
161
+ def gatherProjectDeps (self , project ):
162
+ contributors = []
163
+ scores = []
164
+ ### do stuff to include deps contributors as well
165
+ ### ...
166
+ self .log ("XAXA" )
167
+ return contributors , scores
168
+
156
169
def validateContributors (self , contributors ):
157
170
valid = []
158
171
for c in contributors :
@@ -201,6 +214,11 @@ def test():
201
214
"contributions_from_github" : {
202
215
"debug" : True ,
203
216
"type" : "github_remote_contributors_action" , ### type of action (also the name of the plugin _alias_ used!)
217
+ "params" : {
218
+ "min_contributions" : 1 ,
219
+ "uniform_score" : 30 ,
220
+ "include_dependencies" : True ,
221
+ },
204
222
"metrics" : [ ### metrics applied to this action, what gets score and what doesnt
205
223
{"UNIFORM" : {}} ### metric identifier
206
224
],
@@ -222,9 +240,7 @@ def test():
222
240
config = LibreSeleryConfig (
223
241
{
224
242
"directory" : os .path .abspath (os .path .join (os .getcwd (), ".." , ".." )),
225
- "min_contributions_required_payout" : 1 ,
226
243
"include_main_repository" : True ,
227
- "uniform_score" : 30 ,
228
244
}
229
245
)
230
246
action .updateGlobals (config = config , connectors = connectors )
0 commit comments