Skip to content

enable stricter ruff configuration #1982

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

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

Conversation

danieleades
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Feb 22, 2025

Codecov Report

Attention: Patch coverage is 94.44444% with 4 lines in your changes missing coverage. Please review.

Project coverage is 97.95%. Comparing base (a731d2b) to head (02a8c9c).

Files with missing lines Patch % Lines
copier/user_data.py 75.00% 1 Missing ⚠️
devtasks.py 0.00% 1 Missing ⚠️
tests/test_config.py 0.00% 1 Missing ⚠️
tests/test_prompt.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1982      +/-   ##
==========================================
- Coverage   97.95%   97.95%   -0.01%     
==========================================
  Files          53       53              
  Lines        5581     5575       -6     
==========================================
- Hits         5467     5461       -6     
  Misses        114      114              
Flag Coverage Δ
unittests 97.95% <94.44%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

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

Thanks so much @danieleades for opening a new PR this quick 🚀

LGTM.

I'm really not a fan of E501, especially with 80-characters width, which is quite short and triggers a lot of those, but let's not address this here 👍

@danieleades
Copy link
Contributor Author

Thanks so much @danieleades for opening a new PR this quick 🚀

LGTM.

I'm really not a fan of E501, especially with 80-characters width, which is quite short and triggers a lot of those, but let's not address this here 👍

If you feel that way, it makes sense to increase that character limit before merging this PR since the lines will wrap differently. Do you have a specific width in mind?

@pawamoy
Copy link
Contributor

pawamoy commented Feb 22, 2025

I generally use 120. Let see what other maintainers think.

@sisp
Copy link
Member

sisp commented Feb 26, 2025

I have don't have a strong opinion on line length, but I tend to prefer sticking with (sane) defaults. Ruff defaults to 88. Do you feel it's a too low value?

@pawamoy
Copy link
Contributor

pawamoy commented Feb 26, 2025

With 4-space indents, I think it's too low, yes. There are many, many strings and snippets that get split or exploded on multiple lines because we're in a condition in a loop in a method in a class, and it feels like the code get squished. But I understand why people sometimes prefer sticking to 80/88, as it makes it easier to read code side by side in multiple panes. So, no strong opinion. If none of us has strong opinions, lets keep the current line length 🙂

Copy link
Member

@sisp sisp left a comment

Choose a reason for hiding this comment

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

@danieleades Looks great! Just some minor remarks from my side.

class CopierAnswersInterrupt(CopierError, KeyboardInterrupt):
class CopierAnswersInterruptError(CopierError, KeyboardInterrupt):
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add an alias

# Backwards compatibility
CopierAnswersInterrupt = CopierAnswersInterruptError

to retain backwards compatibility, just in case somebody relies on catching this exception.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, good catch @sisp.

@@ -69,7 +69,7 @@ def test_answer_changes(
with local.cwd(src):
build_file_tree(
{
"{{ _copier_conf.answers_file }}.jinja": "{{ _copier_answers|to_nice_yaml }}",
"{{ _copier_conf.answers_file }}.jinja": "{{ _copier_answers|to_nice_yaml }}", # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

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

I think we could avoid such rule exceptions:

Suggested change
"{{ _copier_conf.answers_file }}.jinja": "{{ _copier_answers|to_nice_yaml }}", # noqa: E501
"{{ _copier_conf.answers_file }}.jinja": (
"{{ _copier_answers|to_nice_yaml }}"
),

Several more cases like this below.

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.

3 participants