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
=== modified file 'clickreviews/cr_lint.py'
--- clickreviews/cr_lint.py 2014-12-10 18:16:46 +0000
+++ clickreviews/cr_lint.py 2015-01-13 18:10:09 +0000
@@ -547,78 +547,6 @@
547 return547 return
548 self._add_result(t, n, s)548 self._add_result(t, n, s)
549549
550 t = 'info'
551 n = 'maintainer_domain'
552 s = 'OK'
553 manual_review = False
554 defaults = ('com.ubuntu.developer.', 'net.launchpad.')
555
556 # Some domains give out email addresses in their toplevel namespace
557 # (eg @ubuntu.com is used by Ubuntu members). Anything in these in
558 # domains should show a warning (for now)
559 special_domains = ('com.ubuntu', 'com.facebook', 'com.yahoo')
560
561 if self.click_pkgname.startswith(defaults):
562 # com.ubuntu.developer is Ubuntu's appstore-- people can use their
563 # own addresses
564 s = "OK (package domain=%s)" % str(defaults)
565 else:
566 domain_rev = self.email.partition('@')[2].split('.')
567 domain_rev.reverse()
568
569 pkg_domain_rev = self.click_pkgname.split('.')
570 if len(domain_rev) < 2: # don't impersonate .com
571 t = 'error'
572 s = "(EMAIL NEEDS HUMAN REVIEW) email domain too short: '%s'" \
573 % self.email
574 manual_review = True
575 # also '=' to leave room for app name
576 elif len(domain_rev) >= len(pkg_domain_rev):
577 # Core apps have a long email, domain, but that's all right
578 if self.is_core_app:
579 t = 'info'
580 s = "OK (email '%s' long, but special case of core apps " \
581 "'com.ubuntu.*')" % self.email
582 elif self.email == "ubuntu-devel-discuss@lists.ubuntu.com":
583 t = 'info'
584 s = "OK (email '%s' long, but special case" % self.email
585 else:
586 t = 'error'
587 s = ("(EMAIL NEEDS HUMAN REVIEW) email domain too long "
588 "'%s' for app name '%s'" % (self.email,
589 ".".join(pkg_domain_rev)))
590 manual_review = True
591 elif domain_rev == pkg_domain_rev[:len(domain_rev)]:
592 is_special = False
593 for special in special_domains:
594 if self.click_pkgname.startswith(special + '.'):
595 is_special = True
596 break
597 if is_special:
598 t = 'warn'
599 s = "email=%s matches special domain=%s" % (self.email,
600 ".".join(pkg_domain_rev))
601 else:
602 s = "OK (email=%s, package domain=%s)" % (self.email,
603 ".".join(pkg_domain_rev))
604 elif self.is_core_scope:
605 t = 'info'
606 s = "OK ('com.ubuntu.scopes' uses '%s' as email)" % self.email
607 elif self.is_core_snappy:
608 t = 'info'
609 s = "OK ('com.ubuntu.snappy' uses '%s' as email)" % self.email
610 else:
611 t = 'error'
612 s = "email=%s does not match package domain=%s " \
613 "(Your email domain needs to match the reverse package " \
614 "namespace.)" % (self.email,
615 ".".join(pkg_domain_rev))
616 # flat namespaces are ok now
617 if self.click_pkgname.count('.') < 1:
618 t = 'info'
619 s = 'OK (flat namespace)'
620 self._add_result(t, n, s, manual_review=manual_review)
621
622 def check_title(self):550 def check_title(self):
623 '''Check title()'''551 '''Check title()'''
624 t = 'info'552 t = 'info'
625553
=== modified file 'clickreviews/tests/test_cr_lint.py'
--- clickreviews/tests/test_cr_lint.py 2014-12-10 18:16:46 +0000
+++ clickreviews/tests/test_cr_lint.py 2015-01-13 18:10:09 +0000
@@ -462,28 +462,6 @@
462 expected_counts = {'info': None, 'warn': 0, 'error': 0}462 expected_counts = {'info': None, 'warn': 0, 'error': 0}
463 self.check_results(r, expected_counts)463 self.check_results(r, expected_counts)
464464
465 def test_check_maintainer_non_default(self):
466 '''Test check_maintainer() - non-default'''
467 self.set_test_control("Package", "com.example.app")
468 self.set_test_manifest("maintainer",
469 "Foo User <user@example.com>")
470 c = ClickReviewLint(self.test_name)
471 c.check_maintainer()
472 r = c.click_report
473 expected_counts = {'info': None, 'warn': 0, 'error': 0}
474 self.check_results(r, expected_counts)
475
476 def test_check_maintainer_non_match(self):
477 '''Test check_maintainer() - non-match'''
478 self.set_test_control("Package", "com.example.app")
479 self.set_test_manifest("maintainer",
480 "Foo User <user@foo.com>")
481 c = ClickReviewLint(self.test_name)
482 c.check_maintainer()
483 r = c.click_report
484 expected_counts = {'info': None, 'warn': 0, 'error': 1}
485 self.check_results(r, expected_counts)
486
487 def test_check_maintainer_empty(self):465 def test_check_maintainer_empty(self):
488 '''Test check_maintainer() - empty'''466 '''Test check_maintainer() - empty'''
489 self.set_test_manifest("maintainer", "")467 self.set_test_manifest("maintainer", "")
@@ -522,30 +500,6 @@
522 expected_counts = {'info': None, 'warn': 0, 'error': 1}500 expected_counts = {'info': None, 'warn': 0, 'error': 1}
523 self.check_results(r, expected_counts)501 self.check_results(r, expected_counts)
524502
525 def test_check_maintainer_bad_email_short_domain(self):
526 '''Test check_maintainer() - bad email (short domain)'''
527 self.set_test_control("Package", "com.example.app")
528 self.set_test_manifest("maintainer",
529 "Foo User <user@com>")
530 c = ClickReviewLint(self.test_name)
531 c.check_maintainer()
532 r = c.click_report
533 expected_counts = {'info': None, 'warn': 0, 'error': 1}
534 self.check_results(r, expected_counts)
535 self.check_manual_review(r, 'lint_maintainer_domain')
536
537 def test_check_maintainer_bad_email_long_domain(self):
538 '''Test check_maintainer() - bad email (long domain)'''
539 self.set_test_control("Package", "com.example.app")
540 self.set_test_manifest("maintainer",
541 "Foo User <user@foo.example.com>")
542 c = ClickReviewLint(self.test_name)
543 c.check_maintainer()
544 r = c.click_report
545 expected_counts = {'info': None, 'warn': 0, 'error': 1}
546 self.check_results(r, expected_counts)
547 self.check_manual_review(r, 'lint_maintainer_domain')
548
549 def test_check_maintainer_domain_appstore(self):503 def test_check_maintainer_domain_appstore(self):
550 '''Test check_maintainer() - appstore domain504 '''Test check_maintainer() - appstore domain
551 (com.ubuntu.developer)'''505 (com.ubuntu.developer)'''
@@ -558,99 +512,6 @@
558 expected_counts = {'info': None, 'warn': 0, 'error': 0}512 expected_counts = {'info': None, 'warn': 0, 'error': 0}
559 self.check_results(r, expected_counts)513 self.check_results(r, expected_counts)
560514
561 def test_check_maintainer_domain_special(self):
562 '''Test check_maintainer() - special (com.facebook)'''
563 self.set_test_control("Package", "com.facebook.app")
564 self.set_test_manifest("maintainer",
565 "Foo User <user@facebook.com>")
566 c = ClickReviewLint(self.test_name)
567 c.check_maintainer()
568 r = c.click_report
569 expected_counts = {'info': None, 'warn': 1, 'error': 0}
570 self.check_results(r, expected_counts)
571
572 def test_check_maintainer_email_special(self):
573 '''Test check_maintainer() - ubuntu-devel-discuss@ - app'''
574 self.set_test_control("Package", "com.canonical.app")
575 self.set_test_manifest("maintainer",
576 "Ubuntu Core Developers "
577 "<ubuntu-devel-discuss@lists.ubuntu.com>")
578 c = ClickReviewLint(self.test_name)
579 c.check_maintainer()
580 r = c.click_report
581 expected_counts = {'info': None, 'warn': 0, 'error': 0}
582 self.check_results(r, expected_counts)
583
584 expected = dict()
585 expected['info'] = dict()
586 expected['warn'] = dict()
587 expected['error'] = dict()
588 expected['info']['lint_maintainer_domain'] = \
589 {"text": "OK (email 'ubuntu-devel-discuss@lists.ubuntu.com' long, "
590 "but special case"}
591 self.check_results(r, expected=expected)
592
593 def test_check_maintainer_email_special2(self):
594 '''Test check_maintainer() - ubuntu-devel-discuss@ - scope'''
595 self.set_test_control("Package", "com.ubuntu.scopes.youtube")
596 self.set_test_manifest("maintainer",
597 "Ubuntu Core Developers "
598 "<ubuntu-devel-discuss@lists.ubuntu.com>")
599 c = ClickReviewLint(self.test_name)
600 c.check_maintainer()
601 r = c.click_report
602 expected_counts = {'info': None, 'warn': 0, 'error': 0}
603 self.check_results(r, expected_counts)
604
605 expected = dict()
606 expected['info'] = dict()
607 expected['warn'] = dict()
608 expected['error'] = dict()
609 expected['info']['lint_maintainer_domain'] = \
610 {"text": "OK ('com.ubuntu.scopes' uses "
611 "'ubuntu-devel-discuss@lists.ubuntu.com' as email)"}
612 self.check_results(r, expected=expected)
613
614 def test_check_maintainer_email_special3(self):
615 '''Test check_maintainer() - ubuntu-devel-discuss@ - snappy'''
616 self.set_test_control("Package", "com.ubuntu.snappy.foo")
617 self.set_test_manifest("maintainer",
618 "Ubuntu Core Developers "
619 "<ubuntu-devel-discuss@lists.ubuntu.com>")
620 c = ClickReviewLint(self.test_name)
621 c.check_maintainer()
622 r = c.click_report
623 expected_counts = {'info': None, 'warn': 0, 'error': 0}
624 self.check_results(r, expected_counts)
625
626 expected = dict()
627 expected['info'] = dict()
628 expected['warn'] = dict()
629 expected['error'] = dict()
630 expected['info']['lint_maintainer_domain'] = \
631 {"text": "OK ('com.ubuntu.snappy' uses "
632 "'ubuntu-devel-discuss@lists.ubuntu.com' as email)"}
633 self.check_results(r, expected=expected)
634
635 def test_check_maintainer_flat_namespace(self):
636 '''Test check_maintainer() - flat namespace'''
637 self.set_test_control("Package", "snapp")
638 self.set_test_manifest("maintainer",
639 "Foo User <user@example.com>")
640 c = ClickReviewLint(self.test_name)
641 c.check_maintainer()
642 r = c.click_report
643 expected_counts = {'info': None, 'warn': 0, 'error': 0}
644 self.check_results(r, expected_counts)
645
646 expected = dict()
647 expected['info'] = dict()
648 expected['warn'] = dict()
649 expected['error'] = dict()
650 expected['info']['lint_maintainer_domain'] = \
651 {"text": "OK (flat namespace)"}
652 self.check_results(r, expected=expected)
653
654 def test_check_icon(self):515 def test_check_icon(self):
655 '''Test check_icon()'''516 '''Test check_icon()'''
656 self.set_test_manifest("icon", "someicon")517 self.set_test_manifest("icon", "someicon")

Subscribers

People subscribed via source and target branches