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

Create (and enforce) a TARDIS code style guide #1170

Closed
harpolea opened this issue May 27, 2020 · 7 comments
Closed

Create (and enforce) a TARDIS code style guide #1170

harpolea opened this issue May 27, 2020 · 7 comments
Assignees

Comments

@harpolea
Copy link
Contributor

There should be a section of the documentation which describes TARDIS' code style conventions. This will help the code's readability and assist new contributors. The guide could cover

  • adherence to PEP 8
  • function and variable names
  • docstrings

To enforce this, it would be helpful to automatically run a linter (e.g. flake8) on PRs which prints out any infringements of PEP 8 it finds. (Note some of PEP 8's suggestions are not always useful, so I suggest creating a .flake8 file to list files and style conventions we'd like it to ignore)

@harpolea
Copy link
Contributor Author

This will address #1094

@jaladh-singhal
Copy link
Member

@harpolea I think autopep8 can be helpful (I came to know about when making PR on astroquery)?

Apparently, it also provides option of configuring with .flake8 as you mentioned!

@harpolea
Copy link
Contributor Author

Yeah, there are several style linters around (black is another popular one) - I mainly suggested flake8 as that’s the one I normally use, but they all pretty much do the same thing.

@arjunsavel
Copy link
Contributor

Another thing that might be helpful is isort — just in the way of making things more automated.

@harpolea
Copy link
Contributor Author

One way to do this would be to use a precommit hook: yt-project/yt#2600

@jaladh-singhal
Copy link
Member

jaladh-singhal commented Jan 21, 2021

Code style guide has been "create"ed in #1405 but we still need to work on "enforce"ing it by creating a black pre-commit hook!

@jaladh-singhal
Copy link
Member

jaladh-singhal commented Jul 1, 2021

we still need to work on "enforce"ing it

It's made possible by #1398, new PRs can't be merged unless code is formatted by black

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants