From d8ef9043d306890af31e9c81ba2649550db311a5 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 25 May 2017 14:16:26 -0400
Subject: [PATCH 16/38] FIXME: rename Tool to Checker in python

---
 checkers/always_fails.py   | 10 +++++-----
 checkers/checker.py        | 28 ++++++++++++++--------------
 checkers/clang_analyzer.py | 10 +++++-----
 checkers/cppcheck.py       | 10 +++++-----
 checkers/flawfinder.py     | 10 +++++-----
 5 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/checkers/always_fails.py b/checkers/always_fails.py
index d19442e..3aae401 100755
--- a/checkers/always_fails.py
+++ b/checkers/always_fails.py
@@ -22,18 +22,18 @@ import unittest
 
 from gccinvocation import GccInvocation
 
-from checker import Tool, Context, ToolTests, make_file, make_stats, \
+from checker import Checker, Context, CheckerTests, make_file, make_stats, \
     tool_main
 
 from firehose.model import Analysis, Generator, Metadata, Failure, \
     Location, File, Message, Issue, Trace
 
-class AlwaysFails(Tool):
+class AlwaysFails(Checker):
     """
-    Tool subclass that always fails
+    Checker subclass that always fails
     """
     def __init__(self, ctxt):
-        Tool.__init__(self, 'always-fails', ctxt)
+        Checker.__init__(self, 'always-fails', ctxt)
 
     def raw_invoke(self, gccinv, sourcefile):
         args = ['/this/executable/does/not/exist', sourcefile]
@@ -52,7 +52,7 @@ class AlwaysFails(Tool):
                                   ' '.join(result.argv))
         result.set_custom_fields(analysis)
 
-class AlwaysFailsTests(ToolTests):
+class AlwaysFailsTests(CheckerTests):
     def make_tool(self):
         ctxt = self.make_ctxt(capture_exceptions=True)
         return AlwaysFails(ctxt)
diff --git a/checkers/checker.py b/checkers/checker.py
index dc79f17..454da4f 100755
--- a/checkers/checker.py
+++ b/checkers/checker.py
@@ -117,7 +117,7 @@ class SubprocessResult:
         analysis.set_custom_field('stdout', self.out.decode('utf-8'))
         analysis.set_custom_field('stderr', self.err.decode('utf-8'))
 
-class Tool:
+class Checker:
     def __init__(self, name, ctxt):
         self.name = name
         self.timeout = 60
@@ -227,15 +227,15 @@ class Tool:
             return analysis
 
 ############################################################################
-# Tool subclasses
+# Checker subclasses
 ############################################################################
 
-class InvokeRealGcc(Tool):
+class InvokeRealGcc(Checker):
     """
-    Tool subclass that invokes a real gcc compiler binary
+    Checker subclass that invokes a real gcc compiler binary
     """
     def __init__(self, executable, ctxt, extra_args=None, extra_env=None):
-        Tool.__init__(self, 'gcc', ctxt)
+        Checker.__init__(self, 'gcc', ctxt)
         self.executable = executable
         self.extra_args = extra_args
         self.extra_env = extra_env
@@ -280,7 +280,7 @@ class InvokeRealGcc(Tool):
 
 class InvokeCustomGcc(InvokeRealGcc):
     """
-    Tool subclass that invokes a custom build of gcc 6 I have.
+    Checker subclass that invokes a custom build of gcc 6 I have.
     This is a patched version of gcc that writes out a file
     to DUMPBASE.custom-dump.txt, containing a series of
     lines of the form
@@ -310,15 +310,15 @@ class InvokeCustomGcc(InvokeRealGcc):
             self.log('could not find custom dumpfile: %s' % dumpfile_path)
         return analysis
 
-class InvokeCpychecker(Tool):
+class InvokeCpychecker(Checker):
     """
-    Tool subclass that invoke the gcc-python-plugin's "cpychecker" code.
+    Checker subclass that invoke the gcc-python-plugin's "cpychecker" code.
 
     This currently requires the "firehose" branch of gcc-python-plugin
     """
 
     def __init__(self, ctxt):
-        Tool.__init__(self, 'cpychecker', ctxt)
+        Checker.__init__(self, 'cpychecker', ctxt)
 
     def raw_invoke(self, gccinv, sourcefile):
         # Invoke the plugin, but for robustness, do it in an entirely
@@ -390,7 +390,7 @@ class InvokeCpychecker(Tool):
 # Test suite
 ############################################################################
 
-class ToolTests(unittest.TestCase):
+class CheckerTests(unittest.TestCase):
     def make_ctxt(self, capture_exceptions=False):
         return Context(enable_logging=0, capture_exceptions=capture_exceptions)
 
@@ -439,18 +439,18 @@ class ToolTests(unittest.TestCase):
         self.assert_(analysis.customfields)
         self.assert_(name in analysis.customfields)
 
-class BuggyToolTests(ToolTests):
+class BuggyCheckerTests(CheckerTests):
     def make_tool(self):
         """
         Override base class impl, so that we can enable
         exception-capture (and provide a custom tool)
         """
-        class BuggyTool(Tool):
+        class BuggyChecker(Checker):
             def raw_invoke(self, gccinv, sourcefile):
                 raise ValueError('test of raising an exception')
 
         ctxt = self.make_ctxt(capture_exceptions=True)
-        tool = BuggyTool('buggy', ctxt)
+        tool = BuggyChecker('buggy', ctxt)
         return tool
 
     def verify_basic_metadata(self, analysis, sourcefile):
@@ -469,7 +469,7 @@ class BuggyToolTests(ToolTests):
         self.assert_(analysis.customfields['traceback'].startswith(
             'Traceback (most recent call last):\n'))
 
-class RealGccTests(ToolTests):
+class RealGccTests(CheckerTests):
     def make_tool(self):
         ctxt = self.make_ctxt()
         return InvokeRealGcc('gcc', ctxt)
diff --git a/checkers/clang_analyzer.py b/checkers/clang_analyzer.py
index bbe8050..327cfe4 100755
--- a/checkers/clang_analyzer.py
+++ b/checkers/clang_analyzer.py
@@ -25,19 +25,19 @@ import unittest
 
 from gccinvocation import GccInvocation
 
-from checker import Tool, Context, ToolTests, make_file, make_stats, \
+from checker import Checker, Context, CheckerTests, make_file, make_stats, \
     tool_main
 
 from firehose.model import Analysis, Generator, Metadata, Failure, \
     Location, File, Message, Issue, Trace
 from firehose.parsers.clanganalyzer import parse_plist
 
-class InvokeClangAnalyzer(Tool):
+class InvokeClangAnalyzer(Checker):
     """
-    Tool subclass that invokes the clang analyzer
+    Checker subclass that invokes the clang analyzer
     """
     def __init__(self, ctxt):
-        Tool.__init__(self, 'clang-analyzer', ctxt)
+        Checker.__init__(self, 'clang-analyzer', ctxt)
 
     def raw_invoke(self, gccinv, sourcefile):
         self.resultdir = tempfile.mkdtemp()
@@ -81,7 +81,7 @@ class InvokeClangAnalyzer(Tool):
                                   ' '.join(result.argv))
         result.set_custom_fields(analysis)
 
-class ClangAnalyzerTests(ToolTests):
+class ClangAnalyzerTests(CheckerTests):
     def make_tool(self):
         ctxt = self.make_ctxt()
         return InvokeClangAnalyzer(ctxt)
diff --git a/checkers/cppcheck.py b/checkers/cppcheck.py
index 15c3f36..61ab18f 100755
--- a/checkers/cppcheck.py
+++ b/checkers/cppcheck.py
@@ -22,19 +22,19 @@ import unittest
 
 from gccinvocation import GccInvocation
 
-from checker import Tool, Context, ToolTests, make_file, make_stats, \
+from checker import Checker, Context, CheckerTests, make_file, make_stats, \
     tool_main
 
 from firehose.model import Analysis, Generator, Metadata, Failure, \
     Location, File, Message, Issue, Trace
 from firehose.parsers.cppcheck import parse_file
 
-class InvokeCppcheck(Tool):
+class InvokeCppcheck(Checker):
     """
-    Tool subclass that invokes "cppcheck"
+    Checker subclass that invokes "cppcheck"
     """
     def __init__(self, ctxt):
-        Tool.__init__(self, 'cppcheck', ctxt)
+        Checker.__init__(self, 'cppcheck', ctxt)
 
     def raw_invoke(self, gccinv, sourcefile):
         args = ['cppcheck',
@@ -70,7 +70,7 @@ class InvokeCppcheck(Tool):
                                   ' '.join(result.argv))
         result.set_custom_fields(analysis)
 
-class CppcheckTests(ToolTests):
+class CppcheckTests(CheckerTests):
     def make_tool(self):
         ctxt = self.make_ctxt()
         return InvokeCppcheck(ctxt)
diff --git a/checkers/flawfinder.py b/checkers/flawfinder.py
index 5d1aedc..0722e3e 100755
--- a/checkers/flawfinder.py
+++ b/checkers/flawfinder.py
@@ -22,19 +22,19 @@ import unittest
 
 from gccinvocation import GccInvocation
 
-from checker import Tool, Context, ToolTests, make_file, make_stats, \
+from checker import Checker, Context, CheckerTests, make_file, make_stats, \
     tool_main
 
 from firehose.model import Analysis, Generator, Metadata, Failure, \
     Location, File, Message, Issue, Trace
 from firehose.parsers.flawfinder import parse_file
 
-class InvokeFlawfinder(Tool):
+class InvokeFlawfinder(Checker):
     """
-    Tool subclass that invokes "flawfinder"
+    Checker subclass that invokes "flawfinder"
     """
     def __init__(self, ctxt):
-        Tool.__init__(self, 'flawfinder', ctxt)
+        Checker.__init__(self, 'flawfinder', ctxt)
 
     def raw_invoke(self, gccinv, sourcefile):
         args = ['flawfinder', sourcefile] # FIXME
@@ -73,7 +73,7 @@ class InvokeFlawfinder(Tool):
                                   ' '.join(result.argv))
         result.set_custom_fields(analysis)
 
-class FlawfinderTests(ToolTests):
+class FlawfinderTests(CheckerTests):
     def make_tool(self):
         ctxt = self.make_ctxt()
         return InvokeFlawfinder(ctxt)
-- 
1.8.5.3

