• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 22285099215

22 Feb 2026 08:52PM UTC coverage: 75.854% (-17.1%) from 92.936%
22285099215

Pull #23121

github

web-flow
Merge c7299df9c into ba8359840
Pull Request #23121: fix issue with optional fields in dependency validator

28 of 29 new or added lines in 2 files covered. (96.55%)

11174 existing lines in 400 files now uncovered.

53694 of 70786 relevant lines covered (75.85%)

1.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.91
/src/python/pants/backend/codegen/protobuf/tailor.py
1
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3

4
from __future__ import annotations
1✔
5

6
from dataclasses import dataclass
1✔
7

8
from pants.backend.codegen.protobuf.protoc import Protoc
1✔
9
from pants.backend.codegen.protobuf.target_types import ProtobufSourcesGeneratorTarget
1✔
10
from pants.core.goals.tailor import (
1✔
11
    AllOwnedSources,
12
    PutativeTarget,
13
    PutativeTargets,
14
    PutativeTargetsRequest,
15
)
16
from pants.engine.intrinsics import path_globs_to_paths
1✔
17
from pants.engine.rules import collect_rules, rule
1✔
18
from pants.engine.unions import UnionRule
1✔
19
from pants.util.dirutil import group_by_dir
1✔
20
from pants.util.logging import LogLevel
1✔
21

22

23
@dataclass(frozen=True)
1✔
24
class PutativeProtobufTargetsRequest(PutativeTargetsRequest):
1✔
25
    pass
1✔
26

27

28
@rule(level=LogLevel.DEBUG, desc="Determine candidate Protobuf targets to create")
1✔
29
async def find_putative_targets(
1✔
30
    req: PutativeProtobufTargetsRequest, all_owned_sources: AllOwnedSources, protoc: Protoc
31
) -> PutativeTargets:
UNCOV
32
    if not protoc.tailor:
×
33
        return PutativeTargets()
×
34

UNCOV
35
    all_proto_files = await path_globs_to_paths(req.path_globs("*.proto"))
×
UNCOV
36
    unowned_proto_files = set(all_proto_files.files) - set(all_owned_sources)
×
UNCOV
37
    pts = [
×
38
        PutativeTarget.for_target_type(
39
            ProtobufSourcesGeneratorTarget,
40
            path=dirname,
41
            name=None,
42
            triggering_sources=sorted(filenames),
43
        )
44
        for dirname, filenames in group_by_dir(unowned_proto_files).items()
45
    ]
UNCOV
46
    return PutativeTargets(pts)
×
47

48

49
def rules():
1✔
50
    return [
1✔
51
        *collect_rules(),
52
        UnionRule(PutativeTargetsRequest, PutativeProtobufTargetsRequest),
53
    ]
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc