wide-midnight-78598
06/17/2022, 6:30 PMclass PythonSourceField(SingleSourceField):
# Note that Python scripts often have no file ending.
expected_file_extensions: ClassVar[tuple[str, ...]] = ("", ".py", ".pyi")
and later on we're building a lint rule like:
class Flake8FieldSet(FieldSet):
required_fields = (PythonSourceField,)
source: PythonSourceField
What would the expected behaviour be for a SourceFilesRequest
when I have this target field?
python_sources(sources=["1.py", "2.yml", "3.json"])
wide-midnight-78598
06/17/2022, 6:33 PMrule_runner.write_files(
{
"playbook.yml": VALID_PLAYBOOK,
"subdir/playbook.yml": EMPTY_PLAYBOOK,
"subdir/.ansible-lint": ANSIBLE_LINT_CONFIG,
"BUILD": "ansible_sources(name='t', sources=['playbook.yml', 'subdir/playbook.yml'])",
}
)
tgt = rule_runner.get_target(
Address("", target_name="t", relative_file_path="playbook.yml")
)
and my AnsibleSourceField is basically unspecified
class AnsibleSourceField(SingleSourceField):
pass
When I do a SourceFilesRequest
, I'm only ever seeing the single root playbook.yml, which seems strange - as I thought I would get both or neither
https://github.com/sureshjoshi/pants-plugins/blob/63-ansible-lint/pants-plugins/experimental/ansible/lint/ansible_lint/rules.pywide-midnight-78598
06/17/2022, 6:42 PM