Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
[codemod][lint][caffe2] Extend BLACK coverage
Browse files Browse the repository at this point in the history
Test Plan: Sandcastle

Reviewed By: zsol

Differential Revision: D30302716

fbshipit-source-id: f9724d4f4d1b8950f581cc2c6c77eedf19b4b6fc
  • Loading branch information
zertosh authored and facebook-github-bot committed Aug 13, 2021
1 parent c5f3ab6 commit bd9fad2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
12 changes: 6 additions & 6 deletions tools/code_coverage/package/tool/parser/gcov_coverage_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

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:
Expand All @@ -16,9 +16,9 @@ def __init__(self, llvm_coverage: Dict[str, Any]) -> None:
@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
Expand Down
14 changes: 7 additions & 7 deletions tools/code_coverage/package/tool/parser/llvm_coverage_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

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).
"""

Expand All @@ -18,9 +18,9 @@ def __init__(self, llvm_coverage: Dict[str, Any]) -> None:
@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
Expand All @@ -31,7 +31,7 @@ def _collect_coverage(
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def get_coverage(

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:
Expand Down
4 changes: 3 additions & 1 deletion tools/code_coverage/package/util/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}**"
)

0 comments on commit bd9fad2

Please sign in to comment.