[codemod][lint][caffe2] Extend BLACK coverage
authorAndres Suarez <asuarez@fb.com>
Fri, 13 Aug 2021 16:26:38 +0000 (09:26 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 13 Aug 2021 16:28:10 +0000 (09:28 -0700)
Test Plan: Sandcastle

Reviewed By: zsol

Differential Revision: D30302716

fbshipit-source-id: f9724d4f4d1b8950f581cc2c6c77eedf19b4b6fc

tools/code_coverage/package/tool/parser/gcov_coverage_parser.py
tools/code_coverage/package/tool/parser/llvm_coverage_parser.py
tools/code_coverage/package/tool/parser/llvm_coverage_segment.py
tools/code_coverage/package/util/utils.py

index 4d06cce..000b72c 100644 (file)
@@ -5,9 +5,9 @@ from .coverage_record import CoverageRecord
 
 class GcovCoverageParser:
     """
-        Accepts a parsed json produced by gcov --json-format -- typically,
-        representing a single C++ test and produces a list
-        of CoverageRecord(s).
+    Accepts a parsed json produced by gcov --json-format -- typically,
+    representing a single C++ test and produces a list
+    of CoverageRecord(s).
     """
 
     def __init__(self, llvm_coverage: Dict[str, Any]) -> None:
@@ -16,9 +16,9 @@ class GcovCoverageParser:
     @staticmethod
     def _skip_coverage(path: str) -> bool:
         """
-            Returns True if file path should not be processed.
-            This is repo-specific and only makes sense for the current state of
-            ovrsource.
+        Returns True if file path should not be processed.
+        This is repo-specific and only makes sense for the current state of
+        ovrsource.
         """
         if "third-party" in path:
             return True
index 8d0cc21..691bb40 100644 (file)
@@ -6,9 +6,9 @@ from .llvm_coverage_segment import LlvmCoverageSegment, parse_segments
 
 class LlvmCoverageParser:
     """
-        Accepts a parsed json produced by llvm-cov export -- typically,
-        representing a single C++ test and produces a list
-        of CoverageRecord(s).
+    Accepts a parsed json produced by llvm-cov export -- typically,
+    representing a single C++ test and produces a list
+    of CoverageRecord(s).
 
     """
 
@@ -18,9 +18,9 @@ class LlvmCoverageParser:
     @staticmethod
     def _skip_coverage(path: str) -> bool:
         """
-            Returns True if file path should not be processed.
-            This is repo-specific and only makes sense for the current state of
-            ovrsource.
+        Returns True if file path should not be processed.
+        This is repo-specific and only makes sense for the current state of
+        ovrsource.
         """
         if "/third-party/" in path:
             return True
@@ -31,7 +31,7 @@ class LlvmCoverageParser:
         segments: List[LlvmCoverageSegment],
     ) -> Tuple[List[int], List[int]]:
         """
-            Stateful parsing of coverage segments.
+        Stateful parsing of coverage segments.
         """
         covered_lines: Set[int] = set()
         uncovered_lines: Set[int] = set()
index 17d7c18..6f780c1 100644 (file)
@@ -34,8 +34,8 @@ class LlvmCoverageSegment(NamedTuple):
 
 def parse_segments(raw_segments: List[List[int]]) -> List[LlvmCoverageSegment]:
     """
-        Creates LlvmCoverageSegment from a list of lists in llvm export json.
-        each segment is represented by 5-element array.
+    Creates LlvmCoverageSegment from a list of lists in llvm export json.
+    each segment is represented by 5-element array.
     """
     ret: List[LlvmCoverageSegment] = []
     for raw_segment in raw_segments:
index 06a6ba0..6133c35 100644 (file)
@@ -138,7 +138,9 @@ def check_test_type(test_type: str, target: str) -> None:
     )
 
 
-def raise_no_test_found_exception(cpp_binary_folder: str, python_binary_folder: str) -> NoReturn:
+def raise_no_test_found_exception(
+    cpp_binary_folder: str, python_binary_folder: str
+) -> NoReturn:
     raise RuntimeError(
         f"No cpp and python tests found in folder **{cpp_binary_folder} and **{python_binary_folder}**"
     )