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

Include function args in ast.vars (and prefer-snake-case rule) #947

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

anderseknert
Copy link
Member

Fixes #942

@@ -25,8 +25,8 @@ find_duplicates(arr) := {indices |

# METADATA
# description: returns true if array has duplicates of item
has_duplicates(array, item) if count([x |
some x in array
has_duplicates(arr, item) if count([x |
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice side effect of args counting as vars is how this now got flagged as shadowing the built-in array namespace.

@anderseknert anderseknert force-pushed the include-args branch 2 times, most recently from 088d1d9 to 3fb68ae Compare July 30, 2024 07:52
@@ -43,9 +56,26 @@ test_success_snake_cased_multiple_some_declaration if {
r == set()
}

test_fail_camel_cased_function_argument if {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want a _function_argument success case for completeness?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll add one before merging 👍

Also add end location to `prefer-snake-case` violations

Fixes #942

Signed-off-by: Anders Eknert <[email protected]>
@anderseknert anderseknert merged commit f2b1029 into main Jul 30, 2024
3 checks passed
@anderseknert anderseknert deleted the include-args branch July 30, 2024 08:49
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.

Function arguments not considered by prefer-snake-case
2 participants