def checkstyle(self, targets, sources):
    union_classpath = OrderedSet(self.tool_classpath('checkstyle'))
    if self.get_options().include_user_classpath:
      runtime_classpaths = self.context.products.get_data('runtime_classpath')
      for target in targets:
        runtime_classpath = runtime_classpaths.get_for_targets(target.closure(bfs=True))
        union_classpath.update(jar for conf, jar in runtime_classpath
                               if conf in self.get_options().confs)

    args = [
      '-c', self.get_options().configuration,
      '-f', 'plain'
    ]

    if self.get_options().properties:
      properties_file = os.path.join(self.workdir, 'checkstyle.properties')
      with safe_open(properties_file, 'w') as pf:
        for k, v in self.get_options().properties.items():
          pf.write('{key}={value}\n'.format(key=k, value=v))
      args.extend(['-p', properties_file])

    # We've hit known cases of checkstyle command lines being too long for the system so we guard
    # with Xargs since checkstyle does not accept, for example, @argfile style arguments.
    def call(xargs):
      return self.runjava(classpath=union_classpath, main=self._CHECKSTYLE_MAIN,
                          jvm_options=self.get_options().jvm_options,
                          args=args + xargs, workunit_name='checkstyle')
    checks = Xargs(call)

    return checks.execute(sources)
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/backend/jvm/tasks/checkstyle.py/Checkstyle.checkstyle/original