-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactoring/13 documentation and formatting #30
Refactoring/13 documentation and formatting #30
Conversation
…e at constants.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
pull
-
run
-
code review
-
I would propose creation of python project team format rules in cps-hadnbook.
-
I am missing mentioned black-poetry output.
__repositories (list[ConfigRepository]): List of config repositories to fetch from. | ||
__project_state_mining_enabled (bool): Switch indicating if project state mining is enabled. | ||
__output_path (str): The directory where the markdown pages will be stored. | ||
""" | ||
|
||
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
ISSUE_PAGE_TEMPLATE_FILE = os.path.join(PROJECT_ROOT, "..", "templates", "issue_detail_page_template.md") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
considering using os.pardir
instead of ".."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great advice, change implemented in: 5db1778
A class representing the Living Documentation Generator. | ||
|
||
Attributes: | ||
__github_instance (GitHub): The GitHub instance used for authentication and requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps it's a bit redundant to have the attributes documented here and then also individually below. I'd just probably have the ones below, on the 'function' level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also documenting types is redundant if you are using typing :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment led us into a conversation about the doc in all of our future QA projects, where agreed on some rules, that we will follow. All the documentation is updated.
issue_page_detail_template = f.read() | ||
|
||
with open(LivingDocumentationGenerator.INDEX_PAGE_TEMPLATE_FILE, 'r', encoding='utf-8') as f: | ||
with open(LivingDocumentationGenerator.INDEX_PAGE_TEMPLATE_FILE, "r", encoding="utf-8") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding these 2 with statements: what if the file was not opened successfully for whatever reason? Then issue_page_detail_template
and issue_index_page_template
wouldn't be available and the program would crash. Perhaps consider to either move operations working with them into the individual with
scope, or initialize the variable above as None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic was updated at: 5db1778
" Linked to project | Project status | Issue URL |\n" | ||
"|-------------------|-----------------|------------------------|" | ||
"-------------------|----------------|-----------|\n") | ||
issue_table = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider extracting this to some constants.py or at least on top of the file as global constant perhaps - it's good to have visibility over these things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue tables for index page are now moved into constants.py file (5db1778).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I only reviewed the generator.py
I quite like the way you progressed in Python!! Now, the next evolution of your engineering skills can be to try some testing exercises. Maybe even, when / if that makes sense, to try TDD (Test Driven Development - be careful, this is not a silver bullet in my opinion, but can be incredibly handy sometimes :) )
- https://martinfowler.com/bliki/TestDrivenDevelopment.html
- https://en.wikipedia.org/wiki/Test-driven_development
- https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530 (if you want to take it that far...can be good to read at some point in your engineering career I'd say)
The point is, to cover some of the logic you wrote with unit tests - it actually is a 'documentation' for the 'usage' I would say, beyond just testing. Some people on my team are actually reading tests first, when reviewing someone else's PRs, so that they have good understanding on inputs and outputs and/or side effects of a given functionality, and that helps massively.
But good work, I like how it can be read from top to bottom almost like a book (so like in the book, you open it and tehre is table of content - in your case, method generate
that implements nothing, but only calls high level operations, and then you go to individual operations - chapters of the book, for more details), there is a proper logging, documentation, typing, relatively good responsibility levels & sizes of functions :) keep up with good work
Release notes
|
Poetry was not implemented to the POC and is moved into separate SPIKE issue. |
Place here a link to issue, please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- pull
- code review
- run
You have done excellent work here.
I may have one idea.
- Are we expecting the code ready for review to be "blacked" already? I mean, would black not report any change in any file?
- If the previous bullet is valid. We can prepare a CI check action, which will try to run black again and check if there were some changes in the code. If done, we can report a problem.
get_action_input, | ||
make_absolute_path, | ||
) | ||
from living_documentation_generator.utils.utils import get_action_input, make_absolute_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From how many import items are required ()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever line is more than 120 char. The rules are still same. BUT If we talking about for example constants, which can increase during the time, I also think is alright to put them under each other. Black way of formatting is to reduce as many extra lines as possible. But it won't change your code, if you choose to put just two of your imports under each other.
Here is the link for the SPIKE issue #32. |
I also had that idea to implement Black as a CI workflow. With few adjustments we can make it real! With this workflow, we can make sure that all versions of projects have the same format. |
- name: Check code format with Black | ||
id: check-format | ||
run: | | ||
black --check $(git ls-files '*.py') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it is here also? It's duplicated, perhaps it's enough if black step is in the job analysis
and then you can remove code-format-check
completely - unless there is a good reason for its existence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block of code was not supposed to be there twice. Our idea is to have black tool as separate workflow, since it has different goal than pylint. Changed in: fdafc07.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my idea. There are two possible reasons for job failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok then, as the duplication was removed now, I'll approve as there is nothing else at the moment :) GJ!
README.md
Outdated
``` | ||
|
||
## Run Black Tool Locally | ||
This project uses the Black tool for code formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This project uses the Black tool for code formatting. | |
This project uses the [Black](https://github.com/psf/black) tool for code formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change as well as for Pylint tool: fdafc07
…-formatting' into refactoring/13-Documentation-and-formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no more "problems".
- name: Check code format with Black | ||
id: check-format | ||
run: | | ||
black --check $(git ls-files '*.py') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was my idea. There are two possible reasons for job failure.
This PR has a goal to add to the project:
Closes #13