hundreds-lion-13128
11/06/2024, 4:06 PMLintFilesRequest
ignore anything that's in a project's. .gitignore
(and thus pants' ignore).polite-angle-82480
11/06/2024, 6:51 PM--pants-ignore
pants --pants-ignore="$(tr '\n' ',' < .gitignore)"
happy-kitchen-89482
11/06/2024, 8:49 PMhundreds-lion-13128
11/07/2024, 2:24 PMpoc.py
from typing import Any
from pants.core.goals.lint import LintFilesRequest, LintResult, Partitions
from pants.engine.rules import collect_rules, rule
from pants.option.subsystem import Subsystem
from pants.source.filespec import FilespecMatcher
class PocLintSubsystem(Subsystem):
name = "poc"
options_scope = "poc"
help = "poc"
class PocLintRequest(LintFilesRequest):
tool_subsystem = PocLintSubsystem
@rule
async def partition_inputs(
request: PocLintRequest.PartitionRequest,
subsystem: PocLintSubsystem,
) -> Partitions[str, Any]:
matched_filepaths = FilespecMatcher(
includes=["**"],
excludes=[],
).matches(tuple(request.files))
return Partitions.single_partition(sorted(matched_filepaths))
@rule(desc="poc")
async def do_poc(
request: PocLintRequest.Batch[str, Any],
lint_subsystem: PocLintSubsystem,
) -> LintResult:
return LintResult(
exit_code=0,
stdout=", ".join(request.elements),
stderr="",
linter_name=PocLintSubsystem.name,
)
def rules():
return [
*collect_rules(),
*PocLintRequest.rules(),
]
hundreds-lion-13128
11/07/2024, 2:24 PMpants lint --only=poc ::
hundreds-lion-13128
11/07/2024, 2:24 PMhundreds-lion-13128
11/07/2024, 6:55 PM.gitignore
is considered. Not those in subtrees.hundreds-lion-13128
11/07/2024, 6:58 PMhappy-kitchen-89482
11/07/2024, 10:12 PMhappy-kitchen-89482
11/07/2024, 10:13 PMhappy-kitchen-89482
11/07/2024, 10:13 PMhappy-kitchen-89482
11/07/2024, 10:13 PMhundreds-lion-13128
11/08/2024, 8:39 AMhappy-kitchen-89482
11/08/2024, 7:45 PM