-
Notifications
You must be signed in to change notification settings - Fork 10
/
auto_sort_projects.py
256 lines (245 loc) · 8.33 KB
/
auto_sort_projects.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
from typing import Dict, List
from lgtm import LGTMSite, LGTMDataFilters, SimpleProject
project_list_name_to_gh_org = {
'Google_Projects': [
'google',
'GoogleCloudPlatform',
'GoogleContainerTools',
'googleapis',
'googlecolab',
'googlemaps',
'google-cloudsearch',
'flutter'
],
'Apache_Projects': ['apache'],
'AirBnB_Projects': ['airbnb'],
'Amazon_Projects': [
'aws',
'awslabs',
],
'LinkedIn_Projects': ['linkedin'],
'Netflix_Projects': [
'Netflix',
'nebula-plugins'
],
'OpenTracing_Projects': ['opentracing', 'opentracing-contrib'],
'Spring_Projects': ['spring-projects'],
'Jenkins_Projects': ['jenkinsci'],
'Cloudfoundry_Projects': ['cloudfoundry'],
'Square_Projects': ['square'],
'Gradle_Projects': ['gradle'],
'PortSwigger_Projects': ['PortSwigger'],
'Wildlfy_Projects': [
'wildfly',
'jbosstools',
'keycloak',
],
'Graphite_Projects': ['graphite-project'],
'Openmrs_Projects': ['openmrs'],
'JetBrains_Projects': ['JetBrains'],
'Eclipse_Projects': [
'eclipse',
'eclipse-ee4j',
'eclipse-theia',
'eclipse-vertx',
],
'Microsoft_Projects': ['microsoft', 'Azure'],
'PayPal_Projects': ['paypal'],
'Spinnaker_Projects': ['spinnaker'],
'Elastic_Projects': ['elastic'],
'Facebook_Projects': ['facebook'],
'DataDog_Projects': ['DataDog'],
'Micronaut_Projects': ['micronaut-projects'],
'Apple_Projects': ['apple'],
'Gradle_Plugin_Projects': ['nebula-plugins'],
'Open_Rewrite_Projects': ['openrewrite'],
'Oracle_Projects': ['oracle'],
'Sonatype_Projects': ['sonatype'],
'WPI_Projects': [
'wpilibsuite',
'WPIRoboticsProjects',
],
'US_Government_Projects': [
'CDCgov',
'NationalSecurityAgency',
],
'Mozilla_Projects': [
'mozilla',
'mozilla-mobile',
],
'wso2_Projects': ['wso2'],
}
project_list_to_repo = {
'jOOq-Users': [
'self-xdsd/self-storage',
'folio-org/mod-source-record-storage',
'ICIJ/datashare',
'hartwigmedical/hmftools',
'openforis/collect',
'jklingsporn/vertx-jooq',
'trib3/leakycauldron',
'ZupIT/charlescd',
'waikato-datamining/adams-applications'
],
'Gradle_Plugin_Projects': [
'47degrees/hood',
'autonomousapps/dependency-analysis-android-gradle-plugin',
'applandinc/appmap-gradle-plugin',
'anatawa12/auto-visitor',
'aim42/htmlSanityCheck',
'android-async-http/android-async-http',
'diffplug/spotless',
'diffplug/blowdryer',
'diffplug/spotless-changelog',
'spring-cloud/spring-cloud-contract',
'JetBrains/gradle-intellij-plugin',
'JetBrains/gradle-jps-compiler-plugin',
'JetBrains/gradle-grammar-kit-plugin',
'JetBrains/gradle-changelog-plugin',
'JetBrains/gradle-idea-ext-plugin',
'JetBrains/gradle-node-envs',
'JetBrains/gradle-python-envs',
'JetBrains/gradle-ruby-envs',
'JetBrains/gradle-intellij-plugin',
'openrewrite/rewrite-gradle-plugin',
],
'Top_Java_Projects': [
'apereo/cas',
'spring-projects/spring-boot',
'iluwatar/java-design-patterns',
'square/retrofit',
'square/okhttp',
'zxing/zxing',
'libgdx/libgdx',
'google/guava',
'alibaba/dubbo',
'jfeinstein10/SlidingMenu',
'netty/netty',
'JakeWharton/ActionBarSherlock',
'chrisbanes/Android-PullToRefresh',
'alibaba/fastjson',
'deeplearning4j/deeplearning4j',
'JakeWharton/ViewPagerIndicator',
'alibaba/druid',
'liaohuqiu/android-Ultra-Pull-To-Refresh',
'mybatis/mybatis-3',
'springside/springside4',
'apache/storm',
'xetorthio/jedis',
'apache/hadoop',
'dropwizard/dropwizard',
'swagger-api/swagger-codegen',
'code4craft/webmagic',
'junit-team/junit',
'Trinea/android-common',
'clojure/clojure',
'nhaarman/ListViewAnimations',
'perwendel/spark',
'spring-projects/spring-mvc-showcase',
'square/dagger',
'swagger-api/swagger-core',
'jhy/jsoup',
'mcxiaoke/android-volley',
'Activiti/Activiti',
'spring-projects/spring-petclinic',
'openhab/openhab',
'JakeWharton/NineOldAndroids',
'wildfly/wildfly',
'Bukkit/Bukkit',
'jersey/jersey',
'NLPchina/ansj_seg',
'spring-projects/spring-security-oauth',
'eclipse/vert.x',
'apache/flink',
'neo4j/neo4j',
'google/guice',
'MyCATApache/Mycat-Server',
'apache/camel',
'druid-io/druid',
'naver/pinpoint',
'AsyncHttpClient/async-http-client',
'thinkaurelius/titan',
'stanfordnlp/CoreNLP',
'dropwizard/metrics',
'bauerca/drag-sort-listview',
'EnterpriseQualityCoding/FizzBuzzEnterpriseEdition',
'brettwooldridge/HikariCP',
'pardom/ActiveAndroid',
'google/auto',
'square/otto',
'openmrs/openmrs-core',
'alibaba/jstorm',
'b3log/solo',
'hankcs/HanLP',
'knightliao/disconf',
'facebook/presto',
'aws/aws-sdk-java',
'cucumber/cucumber-jvm',
'Atmosphere/atmosphere',
'yusuke/twitter4j',
'yasserg/crawler4j',
'alibaba/canal',
'gephi/gephi',
'NanoHttpd/nanohttpd',
'google/closure-compiler',
'JakeWharton/DiskLruCache',
'apache/hive',
'square/okio',
'scribejava/scribejava',
'checkstyle/checkstyle',
'roboguice/roboguice',
'hazelcast/hazelcast',
'antlr/antlr4',
'databricks/learning-spark',
'Alluxio/alluxio',
'jfinal/jfinal',
'apache/hbase',
'javaee-samples/javaee7-samples',
'joelittlejohn/jsonschema2pojo',
'dangdangdotcom/elastic-job',
'pxb1988/dex2jar',
'alibaba/DataX',
'shuzheng/zheng',
'Graylog2/graylog2-server',
'brianfrankcooper/YCSB',
'essentials/Essentials',
'kbastani/spring-cloud-microservice-example',
'square/javapoet',
'signalapp/Signal-Android',
],
}
# Flip the list
gh_org_to_project_list_name: Dict[str, str] = {}
for list_name in project_list_name_to_gh_org:
for gh_org in project_list_name_to_gh_org[list_name]:
gh_org_to_project_list_name[gh_org] = list_name
gh_repo_to_project_list_name: Dict[str, str] = {}
for list_name in project_list_to_repo:
for gh_repo in project_list_to_repo[list_name]:
gh_repo_to_project_list_name[gh_repo] = list_name
site = LGTMSite.create_from_file()
my_projects = site.get_my_projects()
org_to_projects: Dict[str, List[SimpleProject]] = LGTMDataFilters.org_to_ids(my_projects)
for org in org_to_projects:
project_lists_to_use: List[Dict] = []
if org in gh_org_to_project_list_name:
project_list_name = gh_org_to_project_list_name[org]
project_list_id = site.get_or_create_project_list(project_list_name)
project_lists_to_use.append({'id': project_list_id, 'name': project_list_name})
for project in org_to_projects[org]:
if project.is_protoproject:
print('Unable to add project to project list since it is a protoproject. %s' % project)
continue
# Create a list of project lists to add this project to
project_lists_to_use_local = project_lists_to_use.copy()
if project.display_name in gh_repo_to_project_list_name:
project_list_name = gh_repo_to_project_list_name[project.display_name]
project_list_id = site.get_or_create_project_list(project_list_name)
project_lists_to_use_local.append({'id': project_list_id, 'name': project_list_name})
project_list_str = [project_list["name"] for project_list in project_lists_to_use_local]
print(f'Adding repository {project.display_name} to project lists: {project_list_str}')
# Add the project to the project lists
for project_list in project_lists_to_use_local:
site.load_into_project_list(project_list['id'], [project.key])
if project_lists_to_use_local:
site.unfollow_repository(project)