Skip to content

Commit

Permalink
Rename LintRequest to LintTargetsRequest (#14312)
Browse files Browse the repository at this point in the history
#14102 added `LintFilesRequest`, so now `LintRequest` is poorly named.

I don't yet rename `FmtRequest` to `FmtTargetsRequest` because that API is still in flux until we figure out how to safely have target-less formatters. No need to rename `CheckRequest` because we need dependencies information there, so we will need targets (possibly inferred).

[ci skip-rust]
[ci skip-build-wheels]
  • Loading branch information
Eric-Arellano authored Jan 29, 2022
1 parent e7e0301 commit 8c5cadc
Show file tree
Hide file tree
Showing 19 changed files with 62 additions and 63 deletions.
6 changes: 3 additions & 3 deletions src/python/pants/backend/docker/lint/hadolint/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -104,5 +104,5 @@ async def run_hadolint(request: HadolintRequest, hadolint: Hadolint) -> LintResu
def rules():
return [
*collect_rules(),
UnionRule(LintRequest, HadolintRequest),
UnionRule(LintTargetsRequest, HadolintRequest),
]
4 changes: 2 additions & 2 deletions src/python/pants/backend/go/lint/gofmt/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -114,5 +114,5 @@ def rules():
*collect_rules(),
*golang.rules(),
UnionRule(FmtRequest, GofmtRequest),
UnionRule(LintRequest, GofmtRequest),
UnionRule(LintTargetsRequest, GofmtRequest),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/go/lint/vet/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -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),
]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -168,6 +168,6 @@ def rules():
*collect_rules(),
*jvm_tool.rules(),
UnionRule(FmtRequest, GoogleJavaFormatRequest),
UnionRule(LintRequest, GoogleJavaFormatRequest),
UnionRule(LintTargetsRequest, GoogleJavaFormatRequest),
UnionRule(GenerateToolLockfileSentinel, GoogleJavaFormatToolLockfileSentinel),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/autoflake/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -143,6 +143,6 @@ def rules():
return [
*collect_rules(),
UnionRule(FmtRequest, AutoflakeRequest),
UnionRule(LintRequest, AutoflakeRequest),
UnionRule(LintTargetsRequest, AutoflakeRequest),
*pex.rules(),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/bandit/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,7 +20,7 @@
from pants.util.strutil import pluralize


class BanditRequest(LintRequest):
class BanditRequest(LintTargetsRequest):
field_set_type = BanditFieldSet
name = "Bandit"

Expand Down Expand Up @@ -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()]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/black/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -164,6 +164,6 @@ def rules():
return [
*collect_rules(),
UnionRule(FmtRequest, BlackRequest),
UnionRule(LintRequest, BlackRequest),
UnionRule(LintTargetsRequest, BlackRequest),
*pex.rules(),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/docformatter/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -126,6 +126,6 @@ def rules():
return [
*collect_rules(),
UnionRule(FmtRequest, DocformatterRequest),
UnionRule(LintRequest, DocformatterRequest),
UnionRule(LintTargetsRequest, DocformatterRequest),
*pex.rules(),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/flake8/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,7 +25,7 @@
from pants.util.strutil import pluralize


class Flake8Request(LintRequest):
class Flake8Request(LintTargetsRequest):
field_set_type = Flake8FieldSet
name = "Flake8"

Expand Down Expand Up @@ -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()]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/isort/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -162,6 +162,6 @@ def rules():
return [
*collect_rules(),
UnionRule(FmtRequest, IsortRequest),
UnionRule(LintRequest, IsortRequest),
UnionRule(LintTargetsRequest, IsortRequest),
*pex.rules(),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/pylint/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(
self.interpreter_constraints = interpreter_constraints


class PylintRequest(LintRequest):
class PylintRequest(LintTargetsRequest):
field_set_type = PylintFieldSet
name = "Pylint"

Expand Down Expand Up @@ -254,6 +254,6 @@ async def pylint_lint(
def rules():
return [
*collect_rules(),
UnionRule(LintRequest, PylintRequest),
UnionRule(LintTargetsRequest, PylintRequest),
*pex_from_targets.rules(),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/pyupgrade/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -107,6 +107,6 @@ def rules():
return [
*collect_rules(),
UnionRule(FmtRequest, PyUpgradeRequest),
UnionRule(LintRequest, PyUpgradeRequest),
UnionRule(LintTargetsRequest, PyUpgradeRequest),
*pex.rules(),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/python/lint/yapf/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -144,6 +144,6 @@ def rules():
return [
*collect_rules(),
UnionRule(FmtRequest, YapfRequest),
UnionRule(LintRequest, YapfRequest),
UnionRule(LintTargetsRequest, YapfRequest),
*pex.rules(),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/scala/lint/scalafmt/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -315,6 +315,6 @@ def rules():
*collect_rules(),
*lockfile.rules(),
UnionRule(FmtRequest, ScalafmtRequest),
UnionRule(LintRequest, ScalafmtRequest),
UnionRule(LintTargetsRequest, ScalafmtRequest),
UnionRule(GenerateToolLockfileSentinel, ScalafmtToolLockfileSentinel),
]
6 changes: 3 additions & 3 deletions src/python/pants/backend/shell/lint/shellcheck/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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)]
6 changes: 3 additions & 3 deletions src/python/pants/backend/shell/lint/shfmt/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down Expand Up @@ -119,5 +119,5 @@ def rules():
return [
*collect_rules(),
UnionRule(FmtRequest, ShfmtRequest),
UnionRule(LintRequest, ShfmtRequest),
UnionRule(LintTargetsRequest, ShfmtRequest),
]
Loading

0 comments on commit 8c5cadc

Please sign in to comment.