Rev 4059: Remove the test_source checks that cause failures on non-quality or legal issues. in http://people.ubuntu.com/~robertc/baz2.0/test-source

Robert Collins robertc at robertcollins.net
Fri Feb 27 00:41:34 GMT 2009


At http://people.ubuntu.com/~robertc/baz2.0/test-source

------------------------------------------------------------
revno: 4059
revision-id: robertc at robertcollins.net-20090227004128-ev8gozn78zbgl3qy
parent: pqm at pqm.ubuntu.com-20090226191409-iowt3d9s53c7mqs2
committer: Robert Collins <robertc at robertcollins.net>
branch nick: test-source
timestamp: Fri 2009-02-27 11:41:28 +1100
message:
  Remove the test_source checks that cause failures on non-quality or legal issues.
=== modified file 'NEWS'
--- a/NEWS	2009-02-26 18:26:03 +0000
+++ b/NEWS	2009-02-27 00:41:28 +0000
@@ -145,6 +145,9 @@
       delta references. The method is ``scan_unvalidated_index``.
       (Andrew Bennetts, Robert Collins)
 
+    * The selftest checks for coding style have been removed; incorrect
+      coding style is a review and merge issue. (Robert Collins)
+
     * There is a RemoteSink object which handles pushing to smart servers.
       (Andrew Bennetts, Robert Collins)
 

=== modified file 'bzrlib/tests/test_source.py'
--- a/bzrlib/tests/test_source.py	2009-01-17 12:26:31 +0000
+++ b/bzrlib/tests/test_source.py	2009-02-27 00:41:28 +0000
@@ -262,76 +262,6 @@
 
             self.fail('\n'.join(help_text))
 
-    def _push_file(self, dict_, fname, line_no):
-        if fname not in dict_:
-            dict_[fname] = [line_no]
-        else:
-            dict_[fname].append(line_no)
-
-    def _format_message(self, dict_, message):
-        files = ["%s: %s" % (f, ', '.join([str(i+1) for i in lines]))
-                for f, lines in dict_.items()]
-        files.sort()
-        return message + '\n\n    %s' % ('\n    '.join(files))
-
-    def test_coding_style(self):
-        """Check if bazaar code conforms to some coding style conventions.
-
-        Currently we check for:
-         * any tab characters
-         * trailing white space
-         * non-unix newlines
-         * no newline at end of files
-         * lines longer than 79 chars
-           (only print how many files and lines are in violation)
-        """
-        tabs = {}
-        trailing_ws = {}
-        illegal_newlines = {}
-        long_lines = {}
-        no_newline_at_eof = []
-        for fname, text in self.get_source_file_contents():
-            if not self.is_our_code(fname):
-                continue
-            lines = text.splitlines(True)
-            last_line_no = len(lines) - 1
-            for line_no, line in enumerate(lines):
-                if '\t' in line:
-                    self._push_file(tabs, fname, line_no)
-                if not line.endswith('\n') or line.endswith('\r\n'):
-                    if line_no != last_line_no: # not no_newline_at_eof
-                        self._push_file(illegal_newlines, fname, line_no)
-                if line.endswith(' \n'):
-                    self._push_file(trailing_ws, fname, line_no)
-                if len(line) > 80:
-                    self._push_file(long_lines, fname, line_no)
-            if not lines[-1].endswith('\n'):
-                no_newline_at_eof.append(fname)
-        problems = []
-        if tabs:
-            problems.append(self._format_message(tabs,
-                'Tab characters were found in the following source files.'
-                '\nThey should either be replaced by "\\t" or by spaces:'))
-        if trailing_ws:
-            problems.append(self._format_message(trailing_ws,
-                'Trailing white space was found in the following source files:'
-                ))
-        if illegal_newlines:
-            problems.append(self._format_message(illegal_newlines,
-                'Non-unix newlines were found in the following source files:'))
-        if long_lines:
-            print ("There are %i lines longer than 79 characters in %i files."
-                % (sum([len(lines) for f, lines in long_lines.items()]),
-                    len(long_lines)))
-        if no_newline_at_eof:
-            no_newline_at_eof.sort()
-            problems.append("The following source files doesn't have a "
-                "newline at the end:"
-               '\n\n    %s'
-               % ('\n    '.join(no_newline_at_eof)))
-        if problems:
-            self.fail('\n\n'.join(problems))
-
     def test_no_asserts(self):
         """bzr shouldn't use the 'assert' statement."""
         # assert causes too much variation between -O and not, and tends to




More information about the bazaar-commits mailing list