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

chore: add overview of code quality tools; format code with black (DEV-2224) #391

Merged
merged 36 commits into from Jun 7, 2023

Conversation

jnussbaum
Copy link
Collaborator

resolves DEV-2224

@jnussbaum jnussbaum self-assigned this May 31, 2023
@linear
Copy link

linear bot commented May 31, 2023

Copy link
Collaborator

@BalduinLandolt BalduinLandolt left a comment

Choose a reason for hiding this comment

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

All in all, I definitely like the consistency of it; I'm not sure I like all the changes that black did, but I like some of them.

Regarding the documentation, I think the things you added are too general to be in scope of what our docs should cover.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this should exist in our documentation. It makes sense to note somewhere, which style we follow; but this seems way out of scope of what we should have in our documentation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see your point. For me personally, it was important to make all these notes, and to store them somewhere where they can be accessed, and reevaluated. When the ecosystem will have changed in some years, and we don't have these notes, then it will be more difficult to assess if our choice of tools is still okay.

In my view, these notes make our choice more transparent.

And I would never have put these notes into the user part of the documentation. If they belong somewhere, then here in the developers/ADR section.

Writing this, the idea comes to my mind to move them to my personal github.io page. This would allow me to keep them stored somewhere, and to reference them, without cluttering the dsp-tools docs. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wouldn't recommend mixing private and work stuff too much... but that's up to you. However if it's on your personal page, you shouldn't expect other team members to search for it there.
To me, the most intuitive place for this kind of internal note-keeping would be Notion, as it is our "internal Wiki".

But at the end of the day, it really doesn't matter too much; and you can also just leave it in the docs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

again, this should not be in our documentation

Copy link
Collaborator

Choose a reason for hiding this comment

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

same

Copy link
Collaborator

Choose a reason for hiding this comment

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

same

Copy link
Collaborator

Choose a reason for hiding this comment

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

same

Copy link
Collaborator

Choose a reason for hiding this comment

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

same

Comment on lines +33 to +41
- Code quality tools:
- Overview: developers/code-quality-tools/code-quality-tools.md
- General formatting: developers/code-quality-tools/general-formatting.md
- Python formatting: developers/code-quality-tools/python-formatting.md
- Python docstring formatting: developers/code-quality-tools/python-docstring-formatting.md
- Python type checking: developers/code-quality-tools/python-type-checking.md
- Python linting: developers/code-quality-tools/python-linting.md
- Security checks: developers/code-quality-tools/security.md
- See also: developers/code-quality-tools/python-see-also.md
Copy link
Collaborator

Choose a reason for hiding this comment

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

see my comments above. It is not the purpose of our documentation to describe the python ecosystem. Our documentation should be about our code/product, and to some extent on how this code is written/checked/etc. But anything beyond that just convolutes the docs and makes them less accessible and relevant.

parser_process_files.add_argument("--nthreads", type=int, default=None, help="number of threads to use")
parser_process_files.add_argument("xml_file", help="path to XML file containing the data")

# upload-files
parser_upload_files = subparsers.add_parser(
name="upload-files",
help="For internal use only: upload already processed files"
help="For internal use only: upload already processed files",
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems like a weird linting choice to me

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems weird at first glance, but after thinking more deeply about it, I began to find it cool. It reduces git diffs: If you add a new parameter, the diff will only highlight the single line that you added, because the comma on the old line is already there.

But I agree that black is opinionated (they characterize themselves as opinionated, but my opinion is very close to theirs, so I'm super happy 😄 )

Comment on lines -57 to +59
parser = argparse.ArgumentParser(description=f"DSP-TOOLS (version {version('dsp-tools')}, © {datetime.datetime.now().year} by DaSCH)")
subparsers = parser.add_subparsers(title="Subcommands", description="Valid subcommands are", help="sub-command help")
parser = argparse.ArgumentParser(
description=f"DSP-TOOLS (version {version('dsp-tools')}, © {datetime.datetime.now().year} by DaSCH)"
)
subparsers = parser.add_subparsers(
title="Subcommands", description="Valid subcommands are", help="sub-command help"
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO this got less readable

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the only linting choice of black that I don't like. But since I love the rest, I will have to live with this here...

Comment on lines -24 to 31
from dsp_tools.models.propertyelement import \
PropertyElement as PropertyElement # pylint: disable=useless-import-alias
from dsp_tools.models.propertyelement import PropertyElement as PropertyElement # pylint: disable=useless-import-alias
from dsp_tools.models.value import UriValue
from dsp_tools.utils.shared import \
check_notna as check_notna # pylint: disable=useless-import-alias
from dsp_tools.utils.shared import \
simplify_name as simplify_name # pylint: disable=useless-import-alias
from dsp_tools.utils.shared import check_notna as check_notna # pylint: disable=useless-import-alias
from dsp_tools.utils.shared import simplify_name as simplify_name # pylint: disable=useless-import-alias
from dsp_tools.utils.shared import validate_xml_against_schema
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is nice, though

@jnussbaum jnussbaum changed the title chore: format code with black (DEV-2224) chore: add overview of code quality tools; format code with black (DEV-2224) Jun 7, 2023
@jnussbaum jnussbaum merged commit d7fb690 into main Jun 7, 2023
5 checks passed
@jnussbaum jnussbaum deleted the wip/dev-2224-black branch June 7, 2023 09:22
@daschbot daschbot mentioned this pull request Jun 7, 2023
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.

None yet

2 participants