diff --git a/src/python/pants/core/goals/fix.py b/src/python/pants/core/goals/fix.py index 70c93bc7b35..5aba1974668 100644 --- a/src/python/pants/core/goals/fix.py +++ b/src/python/pants/core/goals/fix.py @@ -210,7 +210,7 @@ def activated(cls, union_membership: UnionMembership) -> bool: class Fix(Goal): subsystem_cls = FixSubsystem - environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY # TODO(#17129) — Migrate this. + environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY @rule_helper diff --git a/src/python/pants/core/goals/fmt.py b/src/python/pants/core/goals/fmt.py index 38d7393c8fe..27f934436af 100644 --- a/src/python/pants/core/goals/fmt.py +++ b/src/python/pants/core/goals/fmt.py @@ -63,7 +63,7 @@ def activated(cls, union_membership: UnionMembership) -> bool: class Fmt(Goal): subsystem_cls = FmtSubsystem - environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY # TODO(#17129) — Migrate this. + environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY @goal_rule diff --git a/src/python/pants/core/goals/lint.py b/src/python/pants/core/goals/lint.py index de08722a72f..f6566f18621 100644 --- a/src/python/pants/core/goals/lint.py +++ b/src/python/pants/core/goals/lint.py @@ -19,6 +19,7 @@ write_reports, ) from pants.core.util_rules.distdir import DistDir +from pants.core.util_rules.environments import _warn_on_non_local_environments from pants.core.util_rules.partitions import PartitionElementT, PartitionerType, PartitionMetadataT from pants.core.util_rules.partitions import Partitions as Partitions # re-export from pants.core.util_rules.partitions import ( @@ -267,7 +268,7 @@ def activated(cls, union_membership: UnionMembership) -> bool: class Lint(Goal): subsystem_cls = LintSubsystem - environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY # TODO(#17129) — Migrate this. + environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY def _print_results( @@ -365,6 +366,8 @@ async def _get_partitions_by_request_type( targets, specs_paths = await MultiGet(_get_targets, _get_specs_paths) + await _warn_on_non_local_environments(targets, f"the {subsystem.name} goal") + def partition_request_get(request_type: type[LintRequest]) -> Get[Partitions]: partition_request_type: type = getattr(request_type, "PartitionRequest") if partition_request_type in target_partitioners: diff --git a/src/python/pants/core/goals/lint_test.py b/src/python/pants/core/goals/lint_test.py index df617c937b2..d286c0bb8a7 100644 --- a/src/python/pants/core/goals/lint_test.py +++ b/src/python/pants/core/goals/lint_test.py @@ -25,8 +25,10 @@ lint, ) from pants.core.util_rules.distdir import DistDir +from pants.core.util_rules.environments import EnvironmentNameRequest from pants.core.util_rules.partitions import Partition, PartitionerType from pants.engine.addresses import Address +from pants.engine.environment import EnvironmentName from pants.engine.fs import PathGlobs, SpecsPaths, Workspace from pants.engine.internals.native_engine import EMPTY_SNAPSHOT, Snapshot from pants.engine.rules import QueryRule @@ -308,6 +310,11 @@ def run_lint_rule( input_types=(LintTargetsRequest.PartitionRequest,), mock=mock_target_partitioner, ), + MockGet( + output_type=EnvironmentName, + input_types=(EnvironmentNameRequest,), + mock=lambda _: EnvironmentName(None), + ), MockGet( output_type=Partitions, input_types=(LintFilesRequest.PartitionRequest,),