コード例 #1
0
ファイル: testing_commands.py プロジェクト: yunuem118/servo
    def test_tidy(self, all_files, no_progress, self_test, stylo, force_cpp=False, no_wpt=False):
        if self_test:
            return test_tidy.do_tests()
        else:
            if no_wpt:
                manifest_dirty = False
            else:
                manifest_dirty = run_update(self.context.topdir, check_clean=True)
            tidy_failed = tidy.scan(not all_files, not no_progress, stylo=stylo, no_wpt=no_wpt)
            self.install_rustfmt()
            rustfmt_failed = self.call_rustup_run(["cargo", "fmt", "--", "--check"])

            env = self.build_env()
            clangfmt_failed = False
            available, cmd, files = setup_clangfmt(env)
            if available:
                for file in files:
                    stdout = check_output([cmd, "-output-replacements-xml", file], env=env)
                    if len(XML(stdout)) > 0:
                        print("%s is not formatted correctly." % file)
                        clangfmt_failed = True
            elif force_cpp:
                print("Error: can't find suitable clang-format version. Required with --force-cpp.")
                return True

            if rustfmt_failed or clangfmt_failed:
                print("Run `./mach fmt` to fix the formatting")

            return tidy_failed or manifest_dirty or rustfmt_failed or clangfmt_failed
コード例 #2
0
    def test_tidy(self, all_files, no_wpt, no_progress, self_test, stylo,
                  no_cpp):
        if self_test:
            return test_tidy.do_tests()
        else:
            if no_wpt:
                manifest_dirty = False
            else:
                manifest_dirty = run_update(self.context.topdir,
                                            check_clean=True)
            tidy_failed = tidy.scan(not all_files,
                                    not no_progress,
                                    stylo=stylo)
            self.install_rustfmt()
            rustfmt_failed = self.call_rustup_run(
                ["cargo", "fmt", "--", "--check"])

            clangfmt_failed = False
            if not no_cpp:
                available, cmd, files = setup_clangfmt()
                if available:
                    for file in files:
                        stdout = subprocess.check_output(
                            [cmd, "-output-replacements-xml", file])
                        if len(XML(stdout)) > 0:
                            print("%s is not formatted correctly." % file)
                            clangfmt_failed = True

            if rustfmt_failed or clangfmt_failed:
                print("Run `./mach fmt` to fix the formatting")

            return tidy_failed or manifest_dirty or rustfmt_failed or clangfmt_failed
コード例 #3
0
 def test_tidy(self, all_files, no_progress, self_test, stylo):
     if self_test:
         return test_tidy.do_tests()
     else:
         manifest_dirty = run_update(self.context.topdir, check_clean=True)
         tidy_failed = tidy.scan(not all_files, not no_progress, stylo=stylo)
         return tidy_failed or manifest_dirty
コード例 #4
0
ファイル: testing_commands.py プロジェクト: rubiagatra/servo
 def test_tidy(self, all_files, no_progress, self_test, stylo):
     if self_test:
         return test_tidy.do_tests()
     else:
         manifest_dirty = run_update(self.context.topdir, check_clean=True)
         tidy_failed = tidy.scan(not all_files, not no_progress, stylo=stylo)
         return tidy_failed or manifest_dirty
コード例 #5
0
ファイル: testing_commands.py プロジェクト: trexnix/servo
 def test_tidy(self, all_files, no_progress, self_test, stylo):
     if self_test:
         return test_tidy.do_tests()
     else:
         manifest_dirty = run_update(self.context.topdir, check_clean=True)
         tidy_failed = tidy.scan(not all_files, not no_progress, stylo=stylo)
         self.install_rustfmt()
         rustfmt_failed = self.call_rustup_run(["cargo", "fmt", "--", "--check"])
         if rustfmt_failed:
             print("Run `./mach fmt` to fix the formatting")
         return tidy_failed or manifest_dirty or rustfmt_failed
コード例 #6
0
 def test_tidy(self, all_files, no_progress, self_test, stylo):
     if self_test:
         return test_tidy.do_tests()
     else:
         manifest_dirty = run_update(self.context.topdir, check_clean=True)
         tidy_failed = tidy.scan(not all_files, not no_progress, stylo=stylo)
         self.install_rustfmt()
         rustfmt_failed = self.call_rustup_run(["cargo", "fmt", "--", "--check"])
         if rustfmt_failed:
             print("Run `./mach fmt` to fix the formatting")
         return tidy_failed or manifest_dirty or rustfmt_failed
コード例 #7
0
ファイル: testing_commands.py プロジェクト: kilobtye/servo
    def test_tidy(self, faster, all_files, no_progress, self_test):
        if self_test:
            return test_tidy.do_tests()
        else:
            # The `test-tidy` command is currently mid-migration from --faster to --all.
            # Since --faster and --all are opposites, they cannot both be used at the same time
            if faster and all_files:
                print("Cannot tidy --all while also being --faster")
                return -1

            # |--faster|--all|behaviour of tidy.scan()
            # |   false|false|scan all files          # This was the behaviour before adding --all
            # |    true|false|only scan changed files # Expected behaviour if --faster is used
            # |   false| true|scan all files          # Expected behaviour if --all is used
            #
            # The pattern: if `faster` is true, go fast. Otherwise, go slow.
            return tidy.scan(faster, not no_progress)
コード例 #8
0
ファイル: testing_commands.py プロジェクト: kilobtye/servo
    def test_tidy(self, faster, all_files, no_progress, self_test):
        if self_test:
            return test_tidy.do_tests()
        else:
            # The `test-tidy` command is currently mid-migration from --faster to --all.
            # Since --faster and --all are opposites, they cannot both be used at the same time
            if faster and all_files:
                print("Cannot tidy --all while also being --faster")
                return -1

            # |--faster|--all|behaviour of tidy.scan()
            # |   false|false|scan all files          # This was the behaviour before adding --all
            # |    true|false|only scan changed files # Expected behaviour if --faster is used
            # |   false| true|scan all files          # Expected behaviour if --all is used
            #
            # The pattern: if `faster` is true, go fast. Otherwise, go slow.
            return tidy.scan(faster, not no_progress)
コード例 #9
0
 def test_tidy(self, all_files, no_progress, self_test, stylo):
     if self_test:
         return test_tidy.do_tests()
     else:
         return tidy.scan(not all_files, not no_progress, stylo=stylo)
コード例 #10
0
 def test_tidy(self, all_files, no_progress, self_test):
     if self_test:
         return test_tidy.do_tests()
     else:
         return tidy.scan(not all_files, not no_progress)
コード例 #11
0
ファイル: testing_commands.py プロジェクト: Zaggy1024/servo
 def test_tidy(self, faster, no_progress, self_test):
     if self_test:
         return test_tidy.do_tests()
     else:
         return tidy.scan(faster, not no_progress)
コード例 #12
0
 def test_tidy(self, faster, no_progress, self_test):
     if self_test:
         return test_tidy.do_tests()
     else:
         return tidy.scan(faster, not no_progress)