Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fixtures to current ansible-core docs; improve linting of array stubs #208

Merged
merged 2 commits into from
Sep 5, 2023

Conversation

felixfontein
Copy link
Collaborator

@felixfontein felixfontein commented Sep 2, 2023

This includes semantic markup for most plugin docs.

Once ansible/ansible#81450 is merged and we can use that some of the unrelated information will vanish. (I'm really looking forward to that...)

@felixfontein felixfontein changed the title Update fixtures to current ansible-core docs Update fixtures to current ansible-core docs; improve linting of array stubs Sep 2, 2023
@felixfontein
Copy link
Collaborator Author

I had to add a code change since one of the current tests was now failing: RV(ansible.builtin.stat#module:stat[foo.bar].exists) is now correct, since the type of the ansible.builtin.stat module's return value stat changed from complex to dict - and dictionaries allow subscription with [].

This shows another problem: while stat is a dictionary, stat[something] can be correct (depending on what exactly something is), while stat[something].exists is not correct (or at least not linkable to a documented return value). So I added a new rule to only allow array stubs for dictionaries if they show up as the last element (i.e. foo.bar[baz] is ok, but foo[bar].baz is not if foo is a dictionary).

@felixfontein
Copy link
Collaborator Author

I'll merge in a couple of days if nobody objects by then.

@gotmax23
Copy link
Collaborator

gotmax23 commented Sep 5, 2023

Side note:

IMO, this code would be a easier to understand if

for index, part in enumerate(name):

was written along the lines of

    for index, (part, array_stub) in enumerate(name):
        ...

Accessing the tuples returned by split_option_like_name() without unpacking them is a bit confusing, as the reader has to go look at that function's signature to figure out that it's a 2 tuple and what those two values refer to.

@felixfontein
Copy link
Collaborator Author

Good point. I'll have to clean that up at some point.

@felixfontein felixfontein merged commit 1288d70 into ansible-community:main Sep 5, 2023
@felixfontein felixfontein deleted the fixtures branch September 5, 2023 21:59
@felixfontein
Copy link
Collaborator Author

@gotmax23 thanks a lot for reviewing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants