Merge lp:~beuno/click-reviewers-tools/remove-namespace-checks into lp:click-reviewers-tools

Proposed by Martin Albisetti
Status: Merged
Approved by: Jamie Strandboge
Approved revision: 350
Merged at revision: 350
Proposed branch: lp:~beuno/click-reviewers-tools/remove-namespace-checks
Merge into: lp:click-reviewers-tools
Diff against target: 246 lines (+0/-211)
2 files modified
clickreviews/cr_lint.py (+0/-72)
clickreviews/tests/test_cr_lint.py (+0/-139)
To merge this branch: bzr merge lp:~beuno/click-reviewers-tools/remove-namespace-checks
Reviewer Review Type Date Requested Status
Jamie Strandboge (community) Approve
Review via email: mp+246336@code.launchpad.net

Description of the change

Remove checks that validate namespaces and email addresses, those are better suited for the store, which knows the information about the uploading user.

To post a comment you must log in.
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Looks good. Thanks!

review: Approve
Revision history for this message
Daniel Holbach (dholbach) wrote :

Shall I upload a new release to the archive and backport it to the SDK PPA?

Revision history for this message
Martin Albisetti (beuno) wrote :

On Wed, Jan 14, 2015 at 9:01 AM, Daniel Holbach
<email address hidden> wrote:
> Shall I upload a new release to the archive and backport it to the SDK PPA?

Yes please and thank you!

--
Martin

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'clickreviews/cr_lint.py'
2--- clickreviews/cr_lint.py 2014-12-10 18:16:46 +0000
3+++ clickreviews/cr_lint.py 2015-01-13 18:10:09 +0000
4@@ -547,78 +547,6 @@
5 return
6 self._add_result(t, n, s)
7
8- t = 'info'
9- n = 'maintainer_domain'
10- s = 'OK'
11- manual_review = False
12- defaults = ('com.ubuntu.developer.', 'net.launchpad.')
13-
14- # Some domains give out email addresses in their toplevel namespace
15- # (eg @ubuntu.com is used by Ubuntu members). Anything in these in
16- # domains should show a warning (for now)
17- special_domains = ('com.ubuntu', 'com.facebook', 'com.yahoo')
18-
19- if self.click_pkgname.startswith(defaults):
20- # com.ubuntu.developer is Ubuntu's appstore-- people can use their
21- # own addresses
22- s = "OK (package domain=%s)" % str(defaults)
23- else:
24- domain_rev = self.email.partition('@')[2].split('.')
25- domain_rev.reverse()
26-
27- pkg_domain_rev = self.click_pkgname.split('.')
28- if len(domain_rev) < 2: # don't impersonate .com
29- t = 'error'
30- s = "(EMAIL NEEDS HUMAN REVIEW) email domain too short: '%s'" \
31- % self.email
32- manual_review = True
33- # also '=' to leave room for app name
34- elif len(domain_rev) >= len(pkg_domain_rev):
35- # Core apps have a long email, domain, but that's all right
36- if self.is_core_app:
37- t = 'info'
38- s = "OK (email '%s' long, but special case of core apps " \
39- "'com.ubuntu.*')" % self.email
40- elif self.email == "ubuntu-devel-discuss@lists.ubuntu.com":
41- t = 'info'
42- s = "OK (email '%s' long, but special case" % self.email
43- else:
44- t = 'error'
45- s = ("(EMAIL NEEDS HUMAN REVIEW) email domain too long "
46- "'%s' for app name '%s'" % (self.email,
47- ".".join(pkg_domain_rev)))
48- manual_review = True
49- elif domain_rev == pkg_domain_rev[:len(domain_rev)]:
50- is_special = False
51- for special in special_domains:
52- if self.click_pkgname.startswith(special + '.'):
53- is_special = True
54- break
55- if is_special:
56- t = 'warn'
57- s = "email=%s matches special domain=%s" % (self.email,
58- ".".join(pkg_domain_rev))
59- else:
60- s = "OK (email=%s, package domain=%s)" % (self.email,
61- ".".join(pkg_domain_rev))
62- elif self.is_core_scope:
63- t = 'info'
64- s = "OK ('com.ubuntu.scopes' uses '%s' as email)" % self.email
65- elif self.is_core_snappy:
66- t = 'info'
67- s = "OK ('com.ubuntu.snappy' uses '%s' as email)" % self.email
68- else:
69- t = 'error'
70- s = "email=%s does not match package domain=%s " \
71- "(Your email domain needs to match the reverse package " \
72- "namespace.)" % (self.email,
73- ".".join(pkg_domain_rev))
74- # flat namespaces are ok now
75- if self.click_pkgname.count('.') < 1:
76- t = 'info'
77- s = 'OK (flat namespace)'
78- self._add_result(t, n, s, manual_review=manual_review)
79-
80 def check_title(self):
81 '''Check title()'''
82 t = 'info'
83
84=== modified file 'clickreviews/tests/test_cr_lint.py'
85--- clickreviews/tests/test_cr_lint.py 2014-12-10 18:16:46 +0000
86+++ clickreviews/tests/test_cr_lint.py 2015-01-13 18:10:09 +0000
87@@ -462,28 +462,6 @@
88 expected_counts = {'info': None, 'warn': 0, 'error': 0}
89 self.check_results(r, expected_counts)
90
91- def test_check_maintainer_non_default(self):
92- '''Test check_maintainer() - non-default'''
93- self.set_test_control("Package", "com.example.app")
94- self.set_test_manifest("maintainer",
95- "Foo User <user@example.com>")
96- c = ClickReviewLint(self.test_name)
97- c.check_maintainer()
98- r = c.click_report
99- expected_counts = {'info': None, 'warn': 0, 'error': 0}
100- self.check_results(r, expected_counts)
101-
102- def test_check_maintainer_non_match(self):
103- '''Test check_maintainer() - non-match'''
104- self.set_test_control("Package", "com.example.app")
105- self.set_test_manifest("maintainer",
106- "Foo User <user@foo.com>")
107- c = ClickReviewLint(self.test_name)
108- c.check_maintainer()
109- r = c.click_report
110- expected_counts = {'info': None, 'warn': 0, 'error': 1}
111- self.check_results(r, expected_counts)
112-
113 def test_check_maintainer_empty(self):
114 '''Test check_maintainer() - empty'''
115 self.set_test_manifest("maintainer", "")
116@@ -522,30 +500,6 @@
117 expected_counts = {'info': None, 'warn': 0, 'error': 1}
118 self.check_results(r, expected_counts)
119
120- def test_check_maintainer_bad_email_short_domain(self):
121- '''Test check_maintainer() - bad email (short domain)'''
122- self.set_test_control("Package", "com.example.app")
123- self.set_test_manifest("maintainer",
124- "Foo User <user@com>")
125- c = ClickReviewLint(self.test_name)
126- c.check_maintainer()
127- r = c.click_report
128- expected_counts = {'info': None, 'warn': 0, 'error': 1}
129- self.check_results(r, expected_counts)
130- self.check_manual_review(r, 'lint_maintainer_domain')
131-
132- def test_check_maintainer_bad_email_long_domain(self):
133- '''Test check_maintainer() - bad email (long domain)'''
134- self.set_test_control("Package", "com.example.app")
135- self.set_test_manifest("maintainer",
136- "Foo User <user@foo.example.com>")
137- c = ClickReviewLint(self.test_name)
138- c.check_maintainer()
139- r = c.click_report
140- expected_counts = {'info': None, 'warn': 0, 'error': 1}
141- self.check_results(r, expected_counts)
142- self.check_manual_review(r, 'lint_maintainer_domain')
143-
144 def test_check_maintainer_domain_appstore(self):
145 '''Test check_maintainer() - appstore domain
146 (com.ubuntu.developer)'''
147@@ -558,99 +512,6 @@
148 expected_counts = {'info': None, 'warn': 0, 'error': 0}
149 self.check_results(r, expected_counts)
150
151- def test_check_maintainer_domain_special(self):
152- '''Test check_maintainer() - special (com.facebook)'''
153- self.set_test_control("Package", "com.facebook.app")
154- self.set_test_manifest("maintainer",
155- "Foo User <user@facebook.com>")
156- c = ClickReviewLint(self.test_name)
157- c.check_maintainer()
158- r = c.click_report
159- expected_counts = {'info': None, 'warn': 1, 'error': 0}
160- self.check_results(r, expected_counts)
161-
162- def test_check_maintainer_email_special(self):
163- '''Test check_maintainer() - ubuntu-devel-discuss@ - app'''
164- self.set_test_control("Package", "com.canonical.app")
165- self.set_test_manifest("maintainer",
166- "Ubuntu Core Developers "
167- "<ubuntu-devel-discuss@lists.ubuntu.com>")
168- c = ClickReviewLint(self.test_name)
169- c.check_maintainer()
170- r = c.click_report
171- expected_counts = {'info': None, 'warn': 0, 'error': 0}
172- self.check_results(r, expected_counts)
173-
174- expected = dict()
175- expected['info'] = dict()
176- expected['warn'] = dict()
177- expected['error'] = dict()
178- expected['info']['lint_maintainer_domain'] = \
179- {"text": "OK (email 'ubuntu-devel-discuss@lists.ubuntu.com' long, "
180- "but special case"}
181- self.check_results(r, expected=expected)
182-
183- def test_check_maintainer_email_special2(self):
184- '''Test check_maintainer() - ubuntu-devel-discuss@ - scope'''
185- self.set_test_control("Package", "com.ubuntu.scopes.youtube")
186- self.set_test_manifest("maintainer",
187- "Ubuntu Core Developers "
188- "<ubuntu-devel-discuss@lists.ubuntu.com>")
189- c = ClickReviewLint(self.test_name)
190- c.check_maintainer()
191- r = c.click_report
192- expected_counts = {'info': None, 'warn': 0, 'error': 0}
193- self.check_results(r, expected_counts)
194-
195- expected = dict()
196- expected['info'] = dict()
197- expected['warn'] = dict()
198- expected['error'] = dict()
199- expected['info']['lint_maintainer_domain'] = \
200- {"text": "OK ('com.ubuntu.scopes' uses "
201- "'ubuntu-devel-discuss@lists.ubuntu.com' as email)"}
202- self.check_results(r, expected=expected)
203-
204- def test_check_maintainer_email_special3(self):
205- '''Test check_maintainer() - ubuntu-devel-discuss@ - snappy'''
206- self.set_test_control("Package", "com.ubuntu.snappy.foo")
207- self.set_test_manifest("maintainer",
208- "Ubuntu Core Developers "
209- "<ubuntu-devel-discuss@lists.ubuntu.com>")
210- c = ClickReviewLint(self.test_name)
211- c.check_maintainer()
212- r = c.click_report
213- expected_counts = {'info': None, 'warn': 0, 'error': 0}
214- self.check_results(r, expected_counts)
215-
216- expected = dict()
217- expected['info'] = dict()
218- expected['warn'] = dict()
219- expected['error'] = dict()
220- expected['info']['lint_maintainer_domain'] = \
221- {"text": "OK ('com.ubuntu.snappy' uses "
222- "'ubuntu-devel-discuss@lists.ubuntu.com' as email)"}
223- self.check_results(r, expected=expected)
224-
225- def test_check_maintainer_flat_namespace(self):
226- '''Test check_maintainer() - flat namespace'''
227- self.set_test_control("Package", "snapp")
228- self.set_test_manifest("maintainer",
229- "Foo User <user@example.com>")
230- c = ClickReviewLint(self.test_name)
231- c.check_maintainer()
232- r = c.click_report
233- expected_counts = {'info': None, 'warn': 0, 'error': 0}
234- self.check_results(r, expected_counts)
235-
236- expected = dict()
237- expected['info'] = dict()
238- expected['warn'] = dict()
239- expected['error'] = dict()
240- expected['info']['lint_maintainer_domain'] = \
241- {"text": "OK (flat namespace)"}
242- self.check_results(r, expected=expected)
243-
244 def test_check_icon(self):
245 '''Test check_icon()'''
246 self.set_test_manifest("icon", "someicon")

Subscribers

People subscribed via source and target branches