Example #1
0
def rules():
    return [
        *collect_rules(),
        *ancestor_files.rules(),
        *source_files.rules(),
        *stripped_source_files.rules(),
        RootRule(PythonSourceFilesRequest),
    ]
Example #2
0
def rules():
    return [
        *collect_rules(),
        UnionRule(LintRequest, Flake8Request),
        *pex.rules(),
        *source_files.rules(),
        *stripped_source_files.rules(),
    ]
Example #3
0
 def rules(cls):
     return super().rules() + [
         get_sources,
         RootRule(SetupPySourcesRequest),
         RootRule(SourceRootConfig),
         *source_files.rules(),
         *stripped_source_files.rules(),
         *python_sources.rules(),
     ]
Example #4
0
def rules():
    return [
        *collect_rules(),
        UnionRule(PythonFmtRequest, BlackRequest),
        UnionRule(LintRequest, BlackRequest),
        *pex.rules(),
        *source_files.rules(),
        *stripped_source_files.rules(),
    ]
Example #5
0
def rules():
    return [
        *collect_rules(),
        UnionRule(LintRequest, PylintRequest),
        *source_files.rules(),
        *pex.rules(),
        *python_sources.rules(),
        *stripped_source_files.rules(),
    ]
Example #6
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *tailor.rules(),
            *source_files.rules(),
            QueryRule(PutativeTargets, (PutativePythonTargetsRequest, )),
        ],
        target_types=[PythonLibrary, PythonTests],
    )
 def rules(cls):
     return (
         *super().rules(),
         *protobuf_rules(),
         *additional_fields.rules(),
         *source_files.rules(),
         *stripped_source_files.rules(),
         RootRule(GeneratePythonFromProtobufRequest),
     )
def rule_runner() -> RuleRunner:
    return RuleRunner(
        target_types=[GoBinary, GoPackage],
        rules=[
            *external_tool.rules(),
            *source_files.rules(),
            *build.rules(),
            QueryRule(BuiltPackage, (GoBinaryFieldSet, )),
        ],
    )
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *bandit_rules(),
            *source_files.rules(),
            *config_files.rules(),
            QueryRule(LintResults, (BanditRequest, )),
        ],
        target_types=[PythonLibrary],
    )
Example #10
0
 def rules(cls):
     return (
         *super().rules(),
         *protobuf_rules(),
         *additional_fields.rules(),
         *source_files.rules(),
         *stripped_source_files.rules(),
         QueryRule(HydratedSources, (HydrateSourcesRequest, )),
         QueryRule(GeneratedSources, (GeneratePythonFromProtobufRequest, )),
     )
Example #11
0
def rules():
    return (
        *test_lockfile_fixtures_rules(),
        *python_rules(),  # python backend
        *core_test_rules(),
        *config_files.rules(),
        *coursier_fetch.rules(),
        *coursier_setup.rules(),
        *source_files.rules(),
    )
Example #12
0
 def rules(cls):
     return (
         *super().rules(),
         get_sources,
         *source_files.rules(),
         *stripped_source_files.rules(),
         *python_sources.rules(),
         QueryRule(SetupPySources,
                   (SetupPySourcesRequest, OptionsBootstrapper)),
     )
Example #13
0
def rules():
    return [
        *collect_rules(),
        UnionRule(TypecheckRequest, MyPyRequest),
        *source_files.rules(),
        *pants_bin.rules(),
        *pex_rules(),
        *python_sources_rules(),
        *stripped_source_files.rules(),
    ]
Example #14
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *flake8_rules(),
            *source_files.rules(),
            *config_files.rules(),
            QueryRule(LintResults, [Flake8Request]),
        ],
        target_types=[PythonLibrary],
    )
Example #15
0
 def rules(cls):
     return (
         *super().rules(),
         *stripped_source_files.rules(),
         *source_files.rules(),
         map_first_party_modules_to_addresses,
         map_module_to_address,
         map_third_party_modules_to_addresses,
         RootRule(PythonModule),
     )
Example #16
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *tailor.rules(),
            *source_files.rules(),
            QueryRule(UniquelyNamedPutativeTargets, (PutativeTargets,)),
            QueryRule(DisjointSourcePutativeTarget, (PutativeTarget,)),
            QueryRule(EditedBuildFiles, (EditBuildFilesRequest,)),
        ],
        target_types=[FortranLibrary, FortranTests],
    )
Example #17
0
def test_jvm_tool_base_extracts_correct_coordinates() -> None:
    rule_runner = RuleRunner(
        rules=[
            *config_files.rules(),
            *coursier_fetch_rules(),
            *coursier_setup_rules(),
            *external_tool_rules(),
            *source_files.rules(),
            *util_rules(),
            *jvm_tool.rules(),
            *lockfile_rules(),
            generate_test_tool_lockfile_request,
            generate_internal_test_tool_lockfile_request,
            SubsystemRule(MockJvmTool),
            QueryRule(GenerateJvmLockfile, (MockJvmToolLockfileSentinel, )),
            QueryRule(GenerateJvmLockfile,
                      (MockInternalToolLockfileSentinel, )),
            QueryRule(DigestContents, (Digest, )),
        ],
        target_types=[JvmArtifactTarget],
    )
    rule_runner.set_options(
        args=[
            "--mock-tool-artifacts=//:junit_junit",
            "--mock-tool-lockfile=/dev/null",
        ],
        env_inherit=PYTHON_BOOTSTRAP_ENV,
    )

    rule_runner.write_files({
        "BUILD":
        textwrap.dedent("""\
            jvm_artifact(
              name="junit_junit",
              group="junit",
              artifact="junit",
              version="4.13.2",
            )
            """)
    })
    lockfile_request = rule_runner.request(GenerateJvmLockfile,
                                           [MockJvmToolLockfileSentinel()])
    coordinates = sorted(i.coordinate for i in lockfile_request.artifacts)
    assert coordinates == [
        Coordinate(group="junit", artifact="junit", version="4.13.2"),
        Coordinate(group="org.hamcrest",
                   artifact="hamcrest-core",
                   version="1.3"),
    ]

    # Ensure that an internal-only tool will not have a lockfile generated.
    default_lockfile_result = rule_runner.request(
        GenerateJvmLockfile, [MockInternalToolLockfileSentinel()])
    assert default_lockfile_result.lockfile_dest == DEFAULT_TOOL_LOCKFILE
Example #18
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *docformatter_rules(),
            *source_files.rules(),
            QueryRule(LintResults, (DocformatterRequest, )),
            QueryRule(FmtResult, (DocformatterRequest, )),
            QueryRule(SourceFiles, (SourceFilesRequest, )),
        ],
        target_types=[PythonLibrary],
    )
Example #19
0
 def rules(cls):
     return (
         *super().rules(),
         *stripped_source_files.rules(),
         *source_files.rules(),
         *dependency_inference_rules(),
         all_roots,
         RootRule(InferPythonDependencies),
         RootRule(InferInitDependencies),
         RootRule(InferConftestDependencies),
     )
Example #20
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *shellcheck_rules(),
            *config_files.rules(),
            *external_tool.rules(),
            *source_files.rules(),
            QueryRule(LintResults, [ShellcheckRequest]),
        ],
        target_types=[ShellLibrary],
    )
Example #21
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *nodejs.rules(),
            *source_files.rules(),
            *config_files.rules(),
            *target_types_rules.rules(),
            QueryRule(ProcessResult, [nodejs.NpxProcess]),
        ],
        target_types=[JSSourcesGeneratorTarget],
    )
Example #22
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *hadolint_rules(),
            *config_files.rules(),
            *external_tool.rules(),
            *source_files.rules(),
            QueryRule(LintResults, [HadolintRequest]),
        ],
        target_types=[DockerImageTarget],
    )
Example #23
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *docformatter_rules(),
            *docformatter_subsystem_rules(),
            *source_files.rules(),
            *target_types_rules.rules(),
            QueryRule(FmtResult, (DocformatterRequest, )),
            QueryRule(SourceFiles, (SourceFilesRequest, )),
        ],
        target_types=[PythonSourcesGeneratorTarget],
    )
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *black_rules(),
            *source_files.rules(),
            *config_files.rules(),
            QueryRule(LintResults, (BlackRequest, )),
            QueryRule(FmtResult, (BlackRequest, )),
            QueryRule(SourceFiles, (SourceFilesRequest, )),
        ],
        target_types=[PythonLibrary],
    )
Example #25
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *bandit_rules(),
            *bandit_subsystem_rules(),
            *source_files.rules(),
            *config_files.rules(),
            *target_types_rules.rules(),
            QueryRule(LintResults, (BanditRequest, )),
        ],
        target_types=[PythonSourcesGeneratorTarget],
    )
Example #26
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *shunit2_test_runner.rules(),
            *source_files.rules(),
            get_filtered_environment,
            QueryRule(TestResult, [Shunit2FieldSet]),
            QueryRule(TestDebugRequest, [Shunit2FieldSet]),
            QueryRule(Shunit2Runner, [Shunit2RunnerRequest]),
        ],
        target_types=[ShellLibrary, Shunit2Tests],
    )
Example #27
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        rules=[
            *flake8_rules(),
            *flake8_subsystem_rules(),
            *source_files.rules(),
            *config_files.rules(),
            *target_types_rules.rules(),
            QueryRule(LintResults, [Flake8Request]),
        ],
        target_types=[PythonSourcesGeneratorTarget],
    )
Example #28
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        target_types=[TerraformModule],
        rules=[
            *external_tool.rules(),
            *fmt.rules(),
            *validate.rules(),
            *tool.rules(),
            *source_files.rules(),
            QueryRule(LintResults, (ValidateRequest, )),
            QueryRule(SourceFiles, (SourceFilesRequest, )),
        ],
    )
def rule_runner() -> RuleRunner:
    return RuleRunner(
        target_types=[GoBinary, GoPackage],
        rules=[
            *external_tool.rules(),
            *fmt.rules(),
            *gofmt_rules(),
            *source_files.rules(),
            QueryRule(LintResults, (GofmtRequest, )),
            QueryRule(FmtResult, (GofmtRequest, )),
            QueryRule(SourceFiles, (SourceFilesRequest, )),
        ],
    )
Example #30
0
def rule_runner() -> RuleRunner:
    return RuleRunner(
        target_types=[TerraformModuleTarget],
        rules=[
            *external_tool.rules(),
            *check.rules(),
            *tool.rules(),
            *style.rules(),
            *source_files.rules(),
            QueryRule(CheckResults, (TerraformCheckRequest, )),
            QueryRule(SourceFiles, (SourceFilesRequest, )),
        ],
    )