b29d65416481efe627ee832e9f7e6646edcd81a6,tests/python/pants_test/test_utf8_header.py,Utf8HeaderTest,test_file_have_coding_utf8,#Utf8HeaderTest#,16

Before Change


    nonconforming_files = []
    for root, dirs, files in os.walk(buildroot):
      // build-support contains a lot of external files.
      if root.find(os.sep + "build-support") >= 0:
        continue
      for filename in files:
        if filename.endswith(".py"):
          path = root + os.sep + filename;
          with open(path, "r") as pyFile:
            firstLine = pyFile.readline()
            if not firstLine.rstrip() == "// coding=utf-8":

After Change


      return (not tgt.is_synthetic) and tgt.is_original and tgt.has_sources(".py")

    nonconforming_files = []
    for target in build_file_parser.scan().targets(has_hand_coded_python_files):
      for src in target.sources_relative_to_buildroot():
        with open(os.path.join(get_buildroot(), src), "r") as python_file:
          first_line = python_file.readline()
          if not first_line.rstrip() == "// coding=utf-8":
            nonconforming_files.append(src)

    if len(nonconforming_files) > 0:
      self.fail("Expected these files to contain first line "// coding=utf8": "
                + str(nonconforming_files))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: pantsbuild/pants
Commit Name: b29d65416481efe627ee832e9f7e6646edcd81a6
Time: 2014-06-16
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/test_utf8_header.py
Class Name: Utf8HeaderTest
Method Name: test_file_have_coding_utf8


Project Name: pantsbuild/pants
Commit Name: 96776e481b45574973223af77a9959d06cba75af
Time: 2018-01-09
Author: benjyw@gmail.com
File Name: contrib/kythe/src/python/pants/contrib/kythe/tasks/indexable_java_targets.py
Class Name: IndexableJavaTargets
Method Name: get


Project Name: pantsbuild/pants
Commit Name: c93bab32fa8c3f6fc72c83e6d87917b29b4e017f
Time: 2015-08-31
Author: pl@foursquare.com
File Name: src/python/pants/backend/jvm/tasks/jvm_dependency_check.py
Class Name: JvmDependencyCheck
Method Name: targets_by_file