diff --git a/src/python/pants/backend/docker/lint/hadolint/rules.py b/src/python/pants/backend/docker/lint/hadolint/rules.py index 30de24ce5be..6d2a7289af6 100644 --- a/src/python/pants/backend/docker/lint/hadolint/rules.py +++ b/src/python/pants/backend/docker/lint/hadolint/rules.py @@ -8,7 +8,7 @@ from pants.backend.docker.lint.hadolint.subsystem import Hadolint from pants.backend.docker.subsystems.dockerfile_parser import DockerfileInfo, DockerfileInfoRequest from pants.backend.docker.target_types import DockerImageSourceField -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.external_tool import DownloadedExternalTool, ExternalToolRequest from pants.engine.fs import Digest, MergeDigests @@ -32,7 +32,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipHadolintField).value -class HadolintRequest(LintRequest): +class HadolintRequest(LintTargetsRequest): field_set_type = HadolintFieldSet name = "Hadolint" @@ -104,5 +104,5 @@ async def run_hadolint(request: HadolintRequest, hadolint: Hadolint) -> LintResu def rules(): return [ *collect_rules(), - UnionRule(LintRequest, HadolintRequest), + UnionRule(LintTargetsRequest, HadolintRequest), ] diff --git a/src/python/pants/backend/go/lint/gofmt/rules.py b/src/python/pants/backend/go/lint/gofmt/rules.py index 5f9c91e1016..3d19aae7d4d 100644 --- a/src/python/pants/backend/go/lint/gofmt/rules.py +++ b/src/python/pants/backend/go/lint/gofmt/rules.py @@ -13,7 +13,7 @@ from pants.backend.go.subsystems.golang import GoRoot from pants.backend.go.target_types import GoPackageSourcesField from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest from pants.engine.internals.selectors import Get @@ -114,5 +114,5 @@ def rules(): *collect_rules(), *golang.rules(), UnionRule(FmtRequest, GofmtRequest), - UnionRule(LintRequest, GofmtRequest), + UnionRule(LintTargetsRequest, GofmtRequest), ] diff --git a/src/python/pants/backend/go/lint/vet/rules.py b/src/python/pants/backend/go/lint/vet/rules.py index bbdb2dccfd8..e2a436a6462 100644 --- a/src/python/pants/backend/go/lint/vet/rules.py +++ b/src/python/pants/backend/go/lint/vet/rules.py @@ -16,7 +16,7 @@ OwningGoModRequest, ) from pants.backend.go.util_rules.sdk import GoSdkProcess -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest, MergeDigests from pants.engine.internals.selectors import Get, MultiGet @@ -39,7 +39,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipGoVetField).value -class GoVetRequest(LintRequest): +class GoVetRequest(LintTargetsRequest): field_set_type = GoVetFieldSet name = "go vet" @@ -87,5 +87,5 @@ async def run_go_vet(request: GoVetRequest, go_vet_subsystem: GoVetSubsystem) -> def rules(): return [ *collect_rules(), - UnionRule(LintRequest, GoVetRequest), + UnionRule(LintTargetsRequest, GoVetRequest), ] diff --git a/src/python/pants/backend/java/lint/google_java_format/rules.py b/src/python/pants/backend/java/lint/google_java_format/rules.py index d7c452b1614..1d818d5ea20 100644 --- a/src/python/pants/backend/java/lint/google_java_format/rules.py +++ b/src/python/pants/backend/java/lint/google_java_format/rules.py @@ -9,7 +9,7 @@ from pants.backend.java.target_types import JavaSourceField from pants.core.goals.fmt import FmtRequest, FmtResult from pants.core.goals.generate_lockfiles import GenerateToolLockfileSentinel -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest from pants.engine.internals.selectors import Get, MultiGet @@ -38,7 +38,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipGoogleJavaFormatField).value -class GoogleJavaFormatRequest(FmtRequest, LintRequest): +class GoogleJavaFormatRequest(FmtRequest, LintTargetsRequest): field_set_type = GoogleJavaFormatFieldSet name = "Google Java Format" @@ -168,6 +168,6 @@ def rules(): *collect_rules(), *jvm_tool.rules(), UnionRule(FmtRequest, GoogleJavaFormatRequest), - UnionRule(LintRequest, GoogleJavaFormatRequest), + UnionRule(LintTargetsRequest, GoogleJavaFormatRequest), UnionRule(GenerateToolLockfileSentinel, GoogleJavaFormatToolLockfileSentinel), ] diff --git a/src/python/pants/backend/python/lint/autoflake/rules.py b/src/python/pants/backend/python/lint/autoflake/rules.py index 96ceed0675d..42a7af58560 100644 --- a/src/python/pants/backend/python/lint/autoflake/rules.py +++ b/src/python/pants/backend/python/lint/autoflake/rules.py @@ -10,7 +10,7 @@ from pants.backend.python.util_rules import pex from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest from pants.engine.process import FallibleProcessResult, Process, ProcessResult @@ -33,7 +33,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipAutoflakeField).value -class AutoflakeRequest(FmtRequest, LintRequest): +class AutoflakeRequest(FmtRequest, LintTargetsRequest): field_set_type = AutoflakeFieldSet name = "autoflake" @@ -143,6 +143,6 @@ def rules(): return [ *collect_rules(), UnionRule(FmtRequest, AutoflakeRequest), - UnionRule(LintRequest, AutoflakeRequest), + UnionRule(LintTargetsRequest, AutoflakeRequest), *pex.rules(), ] diff --git a/src/python/pants/backend/python/lint/bandit/rules.py b/src/python/pants/backend/python/lint/bandit/rules.py index adf2bc9afed..a583f60360e 100644 --- a/src/python/pants/backend/python/lint/bandit/rules.py +++ b/src/python/pants/backend/python/lint/bandit/rules.py @@ -9,7 +9,7 @@ from pants.backend.python.util_rules import pex from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess -from pants.core.goals.lint import REPORT_DIR, LintRequest, LintResult, LintResults +from pants.core.goals.lint import REPORT_DIR, LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import CreateDigest, Digest, Directory, MergeDigests, RemovePrefix @@ -20,7 +20,7 @@ from pants.util.strutil import pluralize -class BanditRequest(LintRequest): +class BanditRequest(LintTargetsRequest): field_set_type = BanditFieldSet name = "Bandit" @@ -113,4 +113,4 @@ async def bandit_lint( def rules(): - return [*collect_rules(), UnionRule(LintRequest, BanditRequest), *pex.rules()] + return [*collect_rules(), UnionRule(LintTargetsRequest, BanditRequest), *pex.rules()] diff --git a/src/python/pants/backend/python/lint/black/rules.py b/src/python/pants/backend/python/lint/black/rules.py index 990c39e1b5d..828ba3a717d 100644 --- a/src/python/pants/backend/python/lint/black/rules.py +++ b/src/python/pants/backend/python/lint/black/rules.py @@ -12,7 +12,7 @@ from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest, MergeDigests @@ -36,7 +36,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipBlackField).value -class BlackRequest(FmtRequest, LintRequest): +class BlackRequest(FmtRequest, LintTargetsRequest): field_set_type = BlackFieldSet name = "Black" @@ -164,6 +164,6 @@ def rules(): return [ *collect_rules(), UnionRule(FmtRequest, BlackRequest), - UnionRule(LintRequest, BlackRequest), + UnionRule(LintTargetsRequest, BlackRequest), *pex.rules(), ] diff --git a/src/python/pants/backend/python/lint/docformatter/rules.py b/src/python/pants/backend/python/lint/docformatter/rules.py index 1bb5f3b37c3..19a3074542a 100644 --- a/src/python/pants/backend/python/lint/docformatter/rules.py +++ b/src/python/pants/backend/python/lint/docformatter/rules.py @@ -10,7 +10,7 @@ from pants.backend.python.util_rules import pex from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest from pants.engine.process import FallibleProcessResult, Process, ProcessResult @@ -32,7 +32,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipDocformatterField).value -class DocformatterRequest(FmtRequest, LintRequest): +class DocformatterRequest(FmtRequest, LintTargetsRequest): field_set_type = DocformatterFieldSet name = "Docformatter" @@ -126,6 +126,6 @@ def rules(): return [ *collect_rules(), UnionRule(FmtRequest, DocformatterRequest), - UnionRule(LintRequest, DocformatterRequest), + UnionRule(LintTargetsRequest, DocformatterRequest), *pex.rules(), ] diff --git a/src/python/pants/backend/python/lint/flake8/rules.py b/src/python/pants/backend/python/lint/flake8/rules.py index be1a6227d2c..e5172b521d6 100644 --- a/src/python/pants/backend/python/lint/flake8/rules.py +++ b/src/python/pants/backend/python/lint/flake8/rules.py @@ -14,7 +14,7 @@ from pants.backend.python.util_rules import pex from pants.backend.python.util_rules.interpreter_constraints import InterpreterConstraints from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess -from pants.core.goals.lint import REPORT_DIR, LintRequest, LintResult, LintResults +from pants.core.goals.lint import REPORT_DIR, LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import CreateDigest, Digest, Directory, MergeDigests, RemovePrefix @@ -25,7 +25,7 @@ from pants.util.strutil import pluralize -class Flake8Request(LintRequest): +class Flake8Request(LintTargetsRequest): field_set_type = Flake8FieldSet name = "Flake8" @@ -138,4 +138,4 @@ async def flake8_lint( def rules(): - return [*collect_rules(), UnionRule(LintRequest, Flake8Request), *pex.rules()] + return [*collect_rules(), UnionRule(LintTargetsRequest, Flake8Request), *pex.rules()] diff --git a/src/python/pants/backend/python/lint/isort/rules.py b/src/python/pants/backend/python/lint/isort/rules.py index ee9e02ec0a5..5cda9661c5b 100644 --- a/src/python/pants/backend/python/lint/isort/rules.py +++ b/src/python/pants/backend/python/lint/isort/rules.py @@ -10,7 +10,7 @@ from pants.backend.python.util_rules import pex from pants.backend.python.util_rules.pex import PexRequest, PexResolveInfo, VenvPex, VenvPexProcess from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest, MergeDigests @@ -33,7 +33,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipIsortField).value -class IsortRequest(FmtRequest, LintRequest): +class IsortRequest(FmtRequest, LintTargetsRequest): field_set_type = IsortFieldSet name = "isort" @@ -162,6 +162,6 @@ def rules(): return [ *collect_rules(), UnionRule(FmtRequest, IsortRequest), - UnionRule(LintRequest, IsortRequest), + UnionRule(LintTargetsRequest, IsortRequest), *pex.rules(), ] diff --git a/src/python/pants/backend/python/lint/pylint/rules.py b/src/python/pants/backend/python/lint/pylint/rules.py index b3e3508bf5a..5ca6642ff1c 100644 --- a/src/python/pants/backend/python/lint/pylint/rules.py +++ b/src/python/pants/backend/python/lint/pylint/rules.py @@ -26,7 +26,7 @@ PythonSourceFiles, PythonSourceFilesRequest, ) -from pants.core.goals.lint import REPORT_DIR, LintRequest, LintResult, LintResults +from pants.core.goals.lint import REPORT_DIR, LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.addresses import Addresses @@ -69,7 +69,7 @@ def __init__( self.interpreter_constraints = interpreter_constraints -class PylintRequest(LintRequest): +class PylintRequest(LintTargetsRequest): field_set_type = PylintFieldSet name = "Pylint" @@ -254,6 +254,6 @@ async def pylint_lint( def rules(): return [ *collect_rules(), - UnionRule(LintRequest, PylintRequest), + UnionRule(LintTargetsRequest, PylintRequest), *pex_from_targets.rules(), ] diff --git a/src/python/pants/backend/python/lint/pyupgrade/rules.py b/src/python/pants/backend/python/lint/pyupgrade/rules.py index 72c1f72aabe..22419618ea8 100644 --- a/src/python/pants/backend/python/lint/pyupgrade/rules.py +++ b/src/python/pants/backend/python/lint/pyupgrade/rules.py @@ -10,7 +10,7 @@ from pants.backend.python.util_rules import pex from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest from pants.engine.process import FallibleProcessResult @@ -32,7 +32,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipPyUpgradeField).value -class PyUpgradeRequest(FmtRequest, LintRequest): +class PyUpgradeRequest(FmtRequest, LintTargetsRequest): field_set_type = PyUpgradeFieldSet name = "pyupgrade" @@ -107,6 +107,6 @@ def rules(): return [ *collect_rules(), UnionRule(FmtRequest, PyUpgradeRequest), - UnionRule(LintRequest, PyUpgradeRequest), + UnionRule(LintTargetsRequest, PyUpgradeRequest), *pex.rules(), ] diff --git a/src/python/pants/backend/python/lint/yapf/rules.py b/src/python/pants/backend/python/lint/yapf/rules.py index 8cac53674f2..ff3fc083877 100644 --- a/src/python/pants/backend/python/lint/yapf/rules.py +++ b/src/python/pants/backend/python/lint/yapf/rules.py @@ -10,7 +10,7 @@ from pants.backend.python.util_rules import pex from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import Digest, MergeDigests @@ -33,7 +33,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipYapfField).value -class YapfRequest(FmtRequest, LintRequest): +class YapfRequest(FmtRequest, LintTargetsRequest): field_set_type = YapfFieldSet name = "yapf" @@ -144,6 +144,6 @@ def rules(): return [ *collect_rules(), UnionRule(FmtRequest, YapfRequest), - UnionRule(LintRequest, YapfRequest), + UnionRule(LintTargetsRequest, YapfRequest), *pex.rules(), ] diff --git a/src/python/pants/backend/scala/lint/scalafmt/rules.py b/src/python/pants/backend/scala/lint/scalafmt/rules.py index 71d48c2ae40..2e72257b6c8 100644 --- a/src/python/pants/backend/scala/lint/scalafmt/rules.py +++ b/src/python/pants/backend/scala/lint/scalafmt/rules.py @@ -13,7 +13,7 @@ from pants.base.glob_match_error_behavior import GlobMatchErrorBehavior from pants.core.goals.fmt import FmtRequest, FmtResult from pants.core.goals.generate_lockfiles import GenerateToolLockfileSentinel -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.goals.tailor import group_by_dir from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest from pants.engine.fs import ( @@ -51,7 +51,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipScalafmtField).value -class ScalafmtRequest(FmtRequest, LintRequest): +class ScalafmtRequest(FmtRequest, LintTargetsRequest): field_set_type = ScalafmtFieldSet name = "scalafmt" @@ -315,6 +315,6 @@ def rules(): *collect_rules(), *lockfile.rules(), UnionRule(FmtRequest, ScalafmtRequest), - UnionRule(LintRequest, ScalafmtRequest), + UnionRule(LintTargetsRequest, ScalafmtRequest), UnionRule(GenerateToolLockfileSentinel, ScalafmtToolLockfileSentinel), ] diff --git a/src/python/pants/backend/shell/lint/shellcheck/rules.py b/src/python/pants/backend/shell/lint/shellcheck/rules.py index 6d6f91af064..ffff5ef10ce 100644 --- a/src/python/pants/backend/shell/lint/shellcheck/rules.py +++ b/src/python/pants/backend/shell/lint/shellcheck/rules.py @@ -6,7 +6,7 @@ from pants.backend.shell.lint.shellcheck.skip_field import SkipShellcheckField from pants.backend.shell.lint.shellcheck.subsystem import Shellcheck from pants.backend.shell.target_types import ShellSourceField -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.external_tool import DownloadedExternalTool, ExternalToolRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest @@ -39,7 +39,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipShellcheckField).value -class ShellcheckRequest(LintRequest): +class ShellcheckRequest(LintTargetsRequest): field_set_type = ShellcheckFieldSet name = "Shellcheck" @@ -110,4 +110,4 @@ async def run_shellcheck(request: ShellcheckRequest, shellcheck: Shellcheck) -> def rules(): - return [*collect_rules(), UnionRule(LintRequest, ShellcheckRequest)] + return [*collect_rules(), UnionRule(LintTargetsRequest, ShellcheckRequest)] diff --git a/src/python/pants/backend/shell/lint/shfmt/rules.py b/src/python/pants/backend/shell/lint/shfmt/rules.py index 6e2d2f14ff4..9bbe7bee065 100644 --- a/src/python/pants/backend/shell/lint/shfmt/rules.py +++ b/src/python/pants/backend/shell/lint/shfmt/rules.py @@ -7,7 +7,7 @@ from pants.backend.shell.lint.shfmt.subsystem import Shfmt from pants.backend.shell.target_types import ShellSourceField from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest from pants.core.util_rules.external_tool import DownloadedExternalTool, ExternalToolRequest from pants.core.util_rules.source_files import SourceFiles, SourceFilesRequest @@ -32,7 +32,7 @@ def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipShfmtField).value -class ShfmtRequest(FmtRequest, LintRequest): +class ShfmtRequest(FmtRequest, LintTargetsRequest): field_set_type = ShfmtFieldSet name = "shfmt" @@ -119,5 +119,5 @@ def rules(): return [ *collect_rules(), UnionRule(FmtRequest, ShfmtRequest), - UnionRule(LintRequest, ShfmtRequest), + UnionRule(LintTargetsRequest, ShfmtRequest), ] diff --git a/src/python/pants/backend/terraform/lint/tffmt/tffmt.py b/src/python/pants/backend/terraform/lint/tffmt/tffmt.py index b4d50e9d8fa..8032b162b1e 100644 --- a/src/python/pants/backend/terraform/lint/tffmt/tffmt.py +++ b/src/python/pants/backend/terraform/lint/tffmt/tffmt.py @@ -8,7 +8,7 @@ from pants.backend.terraform.tool import TerraformProcess from pants.backend.terraform.tool import rules as tool_rules from pants.core.goals.fmt import FmtRequest, FmtResult -from pants.core.goals.lint import LintRequest, LintResult, LintResults +from pants.core.goals.lint import LintResult, LintResults, LintTargetsRequest from pants.core.util_rules import external_tool from pants.engine.fs import Digest, MergeDigests from pants.engine.internals.selectors import Get, MultiGet @@ -103,6 +103,6 @@ def rules(): *collect_rules(), *external_tool.rules(), *tool_rules(), - UnionRule(LintRequest, TffmtRequest), + UnionRule(LintTargetsRequest, TffmtRequest), UnionRule(FmtRequest, TffmtRequest), ] diff --git a/src/python/pants/core/goals/lint.py b/src/python/pants/core/goals/lint.py index f8ea86c07df..2fff8cb5b5e 100644 --- a/src/python/pants/core/goals/lint.py +++ b/src/python/pants/core/goals/lint.py @@ -127,11 +127,8 @@ def cacheable(self) -> bool: @union -class LintRequest(StyleRequest): - """A union for StyleRequests that should be lintable. - - Subclass and install a member of this type to provide a linter. - """ +class LintTargetsRequest(StyleRequest): + """AThe entry point for linters that need targets.""" @union @@ -157,7 +154,7 @@ class LintSubsystem(GoalSubsystem): name = "lint" help = "Run all linters and/or formatters in check mode." - required_union_implementations = (LintRequest,) + required_union_implementations = (LintTargetsRequest,) @classmethod def register_options(cls, register) -> None: @@ -217,7 +214,9 @@ async def lint( union_membership: UnionMembership, dist_dir: DistDir, ) -> Lint: - target_request_types = cast("Iterable[type[LintRequest]]", union_membership[LintRequest]) + target_request_types = cast( + "Iterable[type[LintTargetsRequest]]", union_membership[LintTargetsRequest] + ) target_requests = tuple( request_type( request_type.field_set_type.create(target) @@ -234,7 +233,7 @@ async def lint( if lint_subsystem.per_file_caching: all_requests = [ *( - Get(LintResults, LintRequest, request.__class__([field_set])) + Get(LintResults, LintTargetsRequest, request.__class__([field_set])) for request in target_requests if request.field_sets for field_set in request.field_sets @@ -252,7 +251,7 @@ def address_str(fs: FieldSet) -> str: all_requests = [ *( - Get(LintResults, LintRequest, request.__class__(field_set_batch)) + Get(LintResults, LintTargetsRequest, request.__class__(field_set_batch)) for request in target_requests if request.field_sets for field_set_batch in partition_sequentially( diff --git a/src/python/pants/core/goals/lint_test.py b/src/python/pants/core/goals/lint_test.py index f180f444352..02994f6626c 100644 --- a/src/python/pants/core/goals/lint_test.py +++ b/src/python/pants/core/goals/lint_test.py @@ -11,10 +11,10 @@ from pants.core.goals.lint import ( Lint, LintFilesRequest, - LintRequest, LintResult, LintResults, LintSubsystem, + LintTargetsRequest, lint, ) from pants.core.util_rules.distdir import DistDir @@ -36,7 +36,7 @@ class MockLinterFieldSet(FieldSet): required_fields = (MultipleSourcesField,) -class MockLintRequest(LintRequest, metaclass=ABCMeta): +class MockLintRequest(LintTargetsRequest, metaclass=ABCMeta): field_set_type = MockLinterFieldSet @staticmethod @@ -125,7 +125,7 @@ def make_target(address: Optional[Address] = None) -> Target: def run_lint_rule( rule_runner: RuleRunner, *, - lint_request_types: List[Type[LintRequest]], + lint_request_types: List[Type[LintTargetsRequest]], targets: List[Target], run_files_linter: bool = False, per_file_caching: bool = False, @@ -133,7 +133,7 @@ def run_lint_rule( ) -> Tuple[int, str]: union_membership = UnionMembership( { - LintRequest: lint_request_types, + LintTargetsRequest: lint_request_types, LintFilesRequest: [MockFilesRequest] if run_files_linter else [], } ) @@ -158,7 +158,7 @@ def run_lint_rule( mock_gets=[ MockGet( output_type=LintResults, - input_type=LintRequest, + input_type=LintTargetsRequest, mock=lambda mock_request: mock_request.lint_results, ), MockGet(