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

Add GitHub Actions for ruff for Python linting #5082

Closed
wants to merge 3 commits into from

Conversation

noliveleger
Copy link
Contributor

Description

For developers interest, GitHub Actions is used to raise errors when the python code does not lint

Copy link
Contributor

@rgraber rgraber left a comment

Choose a reason for hiding this comment

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

Question about line-length

[tool.isort]
profile = "black"
known_first_party = "kobo"
no_lines_before = ["LOCALFOLDER"]

[tool.ruff]
line-length = 80
line-length = 88
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we making the line-length longer for ruff than for black?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we use an extra buffer of ~10 characters. If your line is 85 characters and you don't want to break it for 5 characters, we don't want the linter to complain about it. Moreover, that's the default configuration (see https://docs.astral.sh/ruff/configuration/)

 # Same as Black.
line-length = 88
indent-width = 4

I would leave black as-is to format with 80 characters. Does not mean the dev cannot bring a line up to 88 characters after Black formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In PyCharm, I added two visual limits. One at 80 (kinda soft-limit) and the other one at 90 (kind hard-limit).

Screenshot 2024-08-28 at 09 36 09

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still a little confused. Why do we have black at 80 characters then?

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

Successfully merging this pull request may close these issues.

4 participants