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

pantsbuild / pants / 19015773527

02 Nov 2025 05:33PM UTC coverage: 17.872% (-62.4%) from 80.3%
19015773527

Pull #22816

github

web-flow
Merge a12d75757 into 6c024e162
Pull Request #22816: Update Pants internal Python to 3.14

4 of 5 new or added lines in 3 files covered. (80.0%)

28452 existing lines in 683 files now uncovered.

9831 of 55007 relevant lines covered (17.87%)

0.18 hits per line

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

0.0
/src/python/pants/backend/visibility/lint.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
UNCOV
3
from __future__ import annotations
×
4

UNCOV
5
from dataclasses import dataclass
×
6

UNCOV
7
from pants.backend.visibility.subsystem import VisibilitySubsystem
×
UNCOV
8
from pants.core.goals.lint import LintResult, LintTargetsRequest
×
UNCOV
9
from pants.core.util_rules.partitions import PartitionerType
×
UNCOV
10
from pants.engine.internals.build_files import get_dependencies_rule_application
×
UNCOV
11
from pants.engine.internals.dep_rules import DependencyRuleActionDeniedError
×
UNCOV
12
from pants.engine.internals.graph import resolve_dependencies
×
UNCOV
13
from pants.engine.internals.session import RunId
×
UNCOV
14
from pants.engine.platform import Platform
×
UNCOV
15
from pants.engine.rules import collect_rules, concurrently, implicitly, rule
×
UNCOV
16
from pants.engine.target import (
×
17
    AlwaysTraverseDeps,
18
    Dependencies,
19
    DependenciesRequest,
20
    DependenciesRuleApplicationRequest,
21
    FieldSet,
22
)
UNCOV
23
from pants.util.logging import LogLevel
×
24

25

UNCOV
26
@dataclass(frozen=True)
×
UNCOV
27
class VisibilityFieldSet(FieldSet):
×
UNCOV
28
    required_fields = (Dependencies,)
×
UNCOV
29
    dependencies: Dependencies
×
30

31

UNCOV
32
class EnforceVisibilityRules(LintTargetsRequest):
×
UNCOV
33
    tool_subsystem = VisibilitySubsystem  # type: ignore[assignment]
×
UNCOV
34
    field_set_type = VisibilityFieldSet
×
UNCOV
35
    partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION
×
36

37

UNCOV
38
@rule(desc="Check for visibility rule violations", level=LogLevel.DEBUG)
×
UNCOV
39
async def check_visibility_rule_violations(
×
40
    request: EnforceVisibilityRules.Batch, platform: Platform, run_id: RunId
41
) -> LintResult:
42
    all_dependencies = await concurrently(
×
43
        resolve_dependencies(
44
            DependenciesRequest(
45
                field_set.dependencies,
46
                should_traverse_deps_predicate=AlwaysTraverseDeps(),
47
            ),
48
            **implicitly(),
49
        )
50
        for field_set in request.elements
51
    )
52
    all_dependencies_rule_action = await concurrently(
×
53
        get_dependencies_rule_application(
54
            DependenciesRuleApplicationRequest(
55
                address=field_set.address,
56
                dependencies=dependencies,
57
                description_of_origin=f"get dependency rules for {field_set.address}",
58
            ),
59
            **implicitly(),
60
        )
61
        for field_set, dependencies in zip(request.elements, all_dependencies)
62
    )
63

64
    violations: list[str] = []
×
65
    for deps_rule_action in all_dependencies_rule_action:
×
66
        try:
×
67
            deps_rule_action.execute_actions()
×
68
        except DependencyRuleActionDeniedError as e:
×
69
            violations.append(str(e))
×
70

71
    return LintResult(
×
72
        exit_code=0 if not violations else 1,
73
        stdout="\n\n".join(violations),
74
        stderr="",
75
        linter_name=request.tool_name,
76
        partition_description=request.partition_metadata.description,
77
    )
78

79

UNCOV
80
def rules():
×
UNCOV
81
    return (
×
82
        *collect_rules(),
83
        *EnforceVisibilityRules.rules(),
84
    )
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