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

Tag glossary #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mrkaiser
Copy link
Contributor

Added functionality for a complete tag list

Added a cli option `-L` to list all tags.
* verified `black .`
* verified `flake8 .`
* verified `mypy .`

Bumped the version up via `poetry version patch`
Added a cli option `-L` to list all tags.
* verified `black .`
* verified `flake8 .`
* verified `mypy .`

Bumped the version up via `poetry version patch`
@mrkaiser
Copy link
Contributor Author

@dgou hey! I haven't taken a look at the refactor yet, but I wrote this was wondering if I could a review.

Appreciate it! Thanks!

taglist_filename = output_path / f"{tag_list_name}.rst"
verbose(f"Writing sphinx tag list: {taglist_filename}")
taglist_dox.write_to_file(taglist_filename)

Copy link
Contributor

Choose a reason for hiding this comment

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

This code block looks like it was copied from the glossary block right above it.
Being that the previous block has 'return' statements in it, the code might never get to this block.
And if another block is added after this one, a return here might prevent the code from getting to that.
This means restructuring the two blocks. My initial feeling is that this function is already too big :-) but that is a pre-existing condition for this change. I think in the interests of simplicity, I'm willing to leave this as is unless you want to undertake refactoring the glossary and this new tags into helper functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at this moment @dgou 😆

def add_tag(sphinx_dox: SphinxWriter, tag: str) -> SphinxWriter:
"""Map function over tag list."""
sphinx_dox.add_output(f"* {tag}")
sphinx_dox.blank_line()
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why the extra blank line (it's more apparent in the test code that the unnumbered list has the extra line.
Not sure if we don't have a helper for that, I need to look at this more in depth.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This seems to be the pattern in other places where we build sphinx documents.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, ok then, you can just use the line_breaks keyword parameter instead, for example: https://github.com/jolly-good-toolbelt/sphinx_gherkindoc/blob/master/sphinx_gherkindoc/writer.py#L105

@@ -244,6 +245,8 @@ def ticket_url_or_tag(tag: str) -> str:
return _value_with_url(tag, url) if url else tag

def tags(tags: List[str], *parent_objs: behave.model_core.BasicStatement) -> None:
# this appends the tags to the previous set
tag_set.update(set(tags))
Copy link
Contributor

Choose a reason for hiding this comment

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

The set.update method can take any iterable, so you don't need to convert tags to a set first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

casting an interable to `set` is unnecessary
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