Skip to content

Conversation

TranquilMarmot
Copy link
Contributor

Closes #387

]


def is_abstract_annotation_for_statement(statement: Tree, next_statement: Tree) -> bool:
Copy link
Contributor Author

@TranquilMarmot TranquilMarmot Jul 6, 2025

Choose a reason for hiding this comment

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

Had to do some extra checks in order to get the @abstract annotation on the same line as func/class_name/class.

Based on the reference to @abstract here:
https://godotengine.org/article/dev-snapshot-godot-4-5-beta-2/
and looking at the GDScript style guide, it does seem like the @ annotations are supposed to be on the same line as what they're modifying.

blank_lines = _add_extra_blanks_due_to_next_statement(
blank_lines, statement.data, surrounding_empty_lines_table
)
is_first_annotation = len(context.annotations) == 1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to refactor this function a bit to get around:

    lint: commands[0]> pylint -rn -j0 setup.py gdtoolkit/ tests/ --rcfile=pylintrc
************* Module gdtoolkit.formatter.block
gdtoolkit/formatter/block.py:21:0: R0914: Too many local variables (16/15) (too-many-locals)

Copy link
Owner

@Scony Scony left a comment

Choose a reason for hiding this comment

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

Well done, thanks!

@Scony Scony merged commit 5917852 into Scony:master Jul 16, 2025
12 checks passed
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.

Issue with @abstract annotation on a function
2 participants