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

Before Change


    buildroot = get_buildroot();

    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":
              nonconforming_files.append(path)

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

After Change


    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)
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: 8479b6a979a0433c9b360c340fca454f03b0ff77
Time: 2016-04-07
Author: nhoward@twopensource.com
File Name: contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle/checker.py
Class Name: PythonCheckStyleTask
Method Name: get_nits


Project Name: pantsbuild/pants
Commit Name: dee363930f4d4f37438695128e082a1266253d26
Time: 2021-01-05
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/backend/python/macros/python_requirements.py
Class Name: PythonRequirements
Method Name: __call__