|
169 | 169 | :description "code.gouv.fr/sources - Nouveaux comptes d'organisation"}) |
170 | 170 | (spit "latest-owners.xml")) |
171 | 171 |
|
| 172 | +(defn compute-awesome-score [v] |
| 173 | + (let [files (:files (:metadata v)) |
| 174 | + high 1000 |
| 175 | + medium 100 |
| 176 | + low 10] |
| 177 | + ;; We assume a readme and not archived |
| 178 | + (+ (if (:license files) high 0) |
| 179 | + (if (:publiccode files) medium 0) |
| 180 | + (if (:contributing files) medium 0) |
| 181 | + (if (:template v) (* medium 2) 0) |
| 182 | + (if (not-empty (:description v)) 0 (- medium)) |
| 183 | + (if-let [f (:forks_count v)] |
| 184 | + (condp < f 1000 high 100 medium 10 low 0) |
| 185 | + 0) |
| 186 | + (if-let [f (:subscribers_count v)] |
| 187 | + (condp < f 100 high 10 medium 1 low 0) |
| 188 | + 0)))) |
| 189 | + |
172 | 190 | ;; Spit repositories.json |
173 | 191 | (->> |
174 | 192 | @repositories |
|
177 | 195 | (not-empty (:readme (:files (:metadata v)))) |
178 | 196 | (not (:archived v))))) |
179 | 197 | (map (fn [[_ v]] |
180 | | - (let [d (:description v) |
181 | | - dd (if (not-empty d) (subs d 0 (min (count d) 200)) "") |
182 | | - fn (:full_name v) |
183 | | - n (or (last (re-matches #".+/([^/]+)/?" fn)) fn) |
184 | | - md (:metadata v)] |
185 | | - {:u (:updated_at v) |
| 198 | + (let [d (:description v) |
| 199 | + dd (if (not-empty d) (subs d 0 (min (count d) 200)) "") |
| 200 | + fn (:full_name v) |
| 201 | + n (or (last (re-matches #".+/([^/]+)/?" fn)) fn) |
| 202 | + files (:files (:metadata v)) |
| 203 | + awesome (compute-awesome-score v)] |
| 204 | + {:a awesome |
| 205 | + :u (:updated_at v) |
186 | 206 | :d dd |
187 | 207 | :f? (:fork v) |
188 | 208 | :t? (:template v) |
189 | | - :c? (false? (empty? (:contributing (:files md)))) |
190 | | - :p? (false? (empty? (:publiccode (:files md)))) |
| 209 | + :c? (false? (empty? (:contributing files))) |
| 210 | + :p? (false? (empty? (:publiccode files))) |
191 | 211 | :l (:language v) |
192 | 212 | :li (:license v) |
193 | 213 | :fn fn |
|
0 commit comments