prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  CheckstyleBear should error when use_spaces is False or indent_size is not 2
  If `checkstyle_configs = Google`, indentation checking using 2 spaces, according to https://google.github.io/styleguide/javaguide.html#s4.2-block-indentation
  
  `use_spaces=False` must emit an error
  `indent_size` must be set to 2, otherwise emit an error.
  
  
  </issue>
  <code>
  [start of bears/java/CheckstyleBear.py]
  1 from coalib.bearlib.abstractions.Linter import linter
  2 from coalib.settings.Setting import path
  3 
  4 
  5 known_checkstyles = {
  6     "google": "https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml",
  7     "sun": 'https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/sun_checks.xml',
  8     "android-check-easy": "https://raw.githubusercontent.com/noveogroup/android-check/master/android-check-plugin/src/main/resources/checkstyle/checkstyle-easy.xml",
  9     "android-check-hard": "https://raw.githubusercontent.com/noveogroup/android-check/master/android-check-plugin/src/main/resources/checkstyle/checkstyle-hard.xml",
  10     "geosoft": "http://geosoft.no/development/geosoft_checks.xml"}
  11 
  12 
  13 def known_checkstyle_or_path(setting):
  14     if str(setting) in known_checkstyles.keys():
  15         return str(setting)
  16     else:
  17         return path(setting)
  18 
  19 
  20 @linter(executable='java',
  21         output_format='regex',
  22         output_regex=r'\[(?P<severity>WARN|INFO)\].*?'
  23                      r'(?P<line>\d+):?(?P<column>\d+)?. '
  24                      r'(?P<message>.*?) *\[(?P<origin>[a-zA-Z]+?)\]')
  25 class CheckstyleBear:
  26     """
  27     Check Java code for possible style, semantic and design issues.
  28 
  29     For more information, consult
  30     <http://checkstyle.sourceforge.net/checks.html>.
  31     """
  32 
  33     LANGUAGES = {"Java"}
  34     AUTHORS = {'The coala developers'}
  35     AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
  36     LICENSE = 'AGPL-3.0'
  37     CAN_DETECT = {'Formatting', 'Smell'}
  38 
  39     def setup_dependencies(self):
  40         type(self).checkstyle_jar_file = self.download_cached_file(
  41             'http://sourceforge.net/projects/checkstyle/files/checkstyle/6.15'
  42             '/checkstyle-6.15-all.jar',
  43             "checkstyle.jar")
  44 
  45     def create_arguments(
  46             self, filename, file, config_file,
  47             checkstyle_configs: known_checkstyle_or_path="google"):
  48         """
  49         :param checkstyle_configs:
  50             A file containing configs to use in ``checkstyle``. It can also
  51             have the special values:
  52 
  53             - google - Google's Java style. More info at
  54               <http://checkstyle.sourceforge.net/style_configs.html>.
  55             - sun - Sun's Java style. These are the same
  56               as the default Eclipse checks. More info at
  57               <http://checkstyle.sourceforge.net/style_configs.html>.
  58             - android-check-easy - The easy Android configs provided by the
  59               android-check eclipse plugin. More info at
  60               <https://github.com/noveogroup/android-check>.
  61             - android-check-hard - The hard Android confis provided by the
  62               android-check eclipse plugin. More info at
  63               <https://github.com/noveogroup/android-check>.
  64             - geosoft - The Java style followed by GeoSoft. More info at
  65               <http://geosoft.no/development/javastyle.html>
  66         """
  67         if checkstyle_configs in known_checkstyles:
  68             checkstyle_configs = self.download_cached_file(
  69                 known_checkstyles[checkstyle_configs],
  70                 checkstyle_configs + ".xml")
  71 
  72         return ('-jar', self.checkstyle_jar_file, '-c',
  73                 checkstyle_configs, filename)
  74
  [end of bears/java/CheckstyleBear.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/bears/java/CheckstyleBear.py b/bears/java/CheckstyleBear.py
  --- a/bears/java/CheckstyleBear.py
  +++ b/bears/java/CheckstyleBear.py
  @@ -10,6 +10,13 @@
       "geosoft": "http://geosoft.no/development/geosoft_checks.xml"}
   
   
  +def check_invalid_configuration(checkstyle_configs, use_spaces, indent_size):
  +    if (checkstyle_configs is 'google' and
  +            (not use_spaces or indent_size != 2)):
  +        raise ValueError('Google checkstyle config does not support '
  +                         'use_spaces=False or indent_size != 2')
  +
  +
   def known_checkstyle_or_path(setting):
       if str(setting) in known_checkstyles.keys():
           return str(setting)
  @@ -44,7 +51,8 @@
   
       def create_arguments(
               self, filename, file, config_file,
  -            checkstyle_configs: known_checkstyle_or_path="google"):
  +            checkstyle_configs: known_checkstyle_or_path="google",
  +            use_spaces: bool=True, indent_size: int=2):
           """
           :param checkstyle_configs:
               A file containing configs to use in ``checkstyle``. It can also
  @@ -64,6 +72,9 @@
               - geosoft - The Java style followed by GeoSoft. More info at
                 <http://geosoft.no/development/javastyle.html>
           """
  +        check_invalid_configuration(
  +            checkstyle_configs, use_spaces, indent_size)
  +
           if checkstyle_configs in known_checkstyles:
               checkstyle_configs = self.download_cached_file(
                   known_checkstyles[checkstyle_configs],
  
verification_info: {"golden_diff": "diff --git a/bears/java/CheckstyleBear.py b/bears/java/CheckstyleBear.py\n--- a/bears/java/CheckstyleBear.py\n+++ b/bears/java/CheckstyleBear.py\n@@ -10,6 +10,13 @@\n     \"geosoft\": \"http://geosoft.no/development/geosoft_checks.xml\"}\n \n \n+def check_invalid_configuration(checkstyle_configs, use_spaces, indent_size):\n+    if (checkstyle_configs is 'google' and\n+            (not use_spaces or indent_size != 2)):\n+        raise ValueError('Google checkstyle config does not support '\n+                         'use_spaces=False or indent_size != 2')\n+\n+\n def known_checkstyle_or_path(setting):\n     if str(setting) in known_checkstyles.keys():\n         return str(setting)\n@@ -44,7 +51,8 @@\n \n     def create_arguments(\n             self, filename, file, config_file,\n-            checkstyle_configs: known_checkstyle_or_path=\"google\"):\n+            checkstyle_configs: known_checkstyle_or_path=\"google\",\n+            use_spaces: bool=True, indent_size: int=2):\n         \"\"\"\n         :param checkstyle_configs:\n             A file containing configs to use in ``checkstyle``. It can also\n@@ -64,6 +72,9 @@\n             - geosoft - The Java style followed by GeoSoft. More info at\n               <http://geosoft.no/development/javastyle.html>\n         \"\"\"\n+        check_invalid_configuration(\n+            checkstyle_configs, use_spaces, indent_size)\n+\n         if checkstyle_configs in known_checkstyles:\n             checkstyle_configs = self.download_cached_file(\n                 known_checkstyles[checkstyle_configs],\n", "issue": "CheckstyleBear should error when use_spaces is False or indent_size is not 2\nIf `checkstyle_configs = Google`, indentation checking using 2 spaces, according to https://google.github.io/styleguide/javaguide.html#s4.2-block-indentation\n\n`use_spaces=False` must emit an error\n`indent_size` must be set to 2, otherwise emit an error.\n\n", "before_files": [{"content": "from coalib.bearlib.abstractions.Linter import linter\nfrom coalib.settings.Setting import path\n\n\nknown_checkstyles = {\n    \"google\": \"https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml\",\n    \"sun\": 'https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/sun_checks.xml',\n    \"android-check-easy\": \"https://raw.githubusercontent.com/noveogroup/android-check/master/android-check-plugin/src/main/resources/checkstyle/checkstyle-easy.xml\",\n    \"android-check-hard\": \"https://raw.githubusercontent.com/noveogroup/android-check/master/android-check-plugin/src/main/resources/checkstyle/checkstyle-hard.xml\",\n    \"geosoft\": \"http://geosoft.no/development/geosoft_checks.xml\"}\n\n\ndef known_checkstyle_or_path(setting):\n    if str(setting) in known_checkstyles.keys():\n        return str(setting)\n    else:\n        return path(setting)\n\n\n@linter(executable='java',\n        output_format='regex',\n        output_regex=r'\\[(?P<severity>WARN|INFO)\\].*?'\n                     r'(?P<line>\\d+):?(?P<column>\\d+)?. '\n                     r'(?P<message>.*?) *\\[(?P<origin>[a-zA-Z]+?)\\]')\nclass CheckstyleBear:\n    \"\"\"\n    Check Java code for possible style, semantic and design issues.\n\n    For more information, consult\n    <http://checkstyle.sourceforge.net/checks.html>.\n    \"\"\"\n\n    LANGUAGES = {\"Java\"}\n    AUTHORS = {'The coala developers'}\n    AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}\n    LICENSE = 'AGPL-3.0'\n    CAN_DETECT = {'Formatting', 'Smell'}\n\n    def setup_dependencies(self):\n        type(self).checkstyle_jar_file = self.download_cached_file(\n            'http://sourceforge.net/projects/checkstyle/files/checkstyle/6.15'\n            '/checkstyle-6.15-all.jar',\n            \"checkstyle.jar\")\n\n    def create_arguments(\n            self, filename, file, config_file,\n            checkstyle_configs: known_checkstyle_or_path=\"google\"):\n        \"\"\"\n        :param checkstyle_configs:\n            A file containing configs to use in ``checkstyle``. It can also\n            have the special values:\n\n            - google - Google's Java style. More info at\n              <http://checkstyle.sourceforge.net/style_configs.html>.\n            - sun - Sun's Java style. These are the same\n              as the default Eclipse checks. More info at\n              <http://checkstyle.sourceforge.net/style_configs.html>.\n            - android-check-easy - The easy Android configs provided by the\n              android-check eclipse plugin. More info at\n              <https://github.com/noveogroup/android-check>.\n            - android-check-hard - The hard Android confis provided by the\n              android-check eclipse plugin. More info at\n              <https://github.com/noveogroup/android-check>.\n            - geosoft - The Java style followed by GeoSoft. More info at\n              <http://geosoft.no/development/javastyle.html>\n        \"\"\"\n        if checkstyle_configs in known_checkstyles:\n            checkstyle_configs = self.download_cached_file(\n                known_checkstyles[checkstyle_configs],\n                checkstyle_configs + \".xml\")\n\n        return ('-jar', self.checkstyle_jar_file, '-c',\n                checkstyle_configs, filename)\n", "path": "bears/java/CheckstyleBear.py"}]}