Skip to content

Commit

Permalink
Assign some names to rules (pantsbuild#8695)
Browse files Browse the repository at this point in the history
### Problem

Now that we have the named rules abstraction, we should start giving names to rules that we think are important enough to be reflected in workunit reporting.

### Solution

This is a small set of @rules that we're reasonably sure justify having names - the rule to run python tests, to create a PEX, and formatting/linting python code with black.

### Result

The above-mentioned @rules will be reflected in workunit reporting, including zipkin.
  • Loading branch information
gshuflin authored Nov 25, 2019
1 parent c0e4ae9 commit 5d6cf3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/python/pants/backend/python/lint/black/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async def setup_black(wrapped_target: FormattablePythonTarget, black: Black) ->
return BlackSetup(config_path, resolved_requirements_pex, merged_input_files)


@rule
@rule(name="Format using black")
async def fmt(
wrapped_target: FormattablePythonTarget,
black_setup: BlackSetup,
Expand All @@ -124,7 +124,7 @@ async def fmt(
)


@rule
@rule(name="Lint using black")
async def lint(
wrapped_target: FormattablePythonTarget,
black_setup: BlackSetup,
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/backend/python/rules/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Pex(HermeticPex):

# TODO: This is non-hermetic because the requirements will be resolved on the fly by
# pex, where it should be hermetically provided in some way.
@rule
@rule(name="Create PEX")
async def create_pex(
request: CreatePex,
pex_bin: DownloadedPexBin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pants.rules.core.strip_source_root import SourceRootStrippedSources


@rule
@rule(name="Run pytest")
async def run_python_test(
test_target: PythonTestsAdaptor,
pytest: PyTest,
Expand Down

0 comments on commit 5d6cf3d

Please sign in to comment.