Skip to content

enable stricter ruff configuration#1982

Open
danieleades wants to merge 3 commits intocopier-org:masterfrom
danieleades:ruff-stricter2
Open

enable stricter ruff configuration#1982
danieleades wants to merge 3 commits intocopier-org:masterfrom
danieleades:ruff-stricter2

Conversation

@danieleades
Copy link
Copy Markdown
Contributor

No description provided.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 22, 2025

Codecov Report

❌ 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).
⚠️ Report is 432 commits behind head on master.

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

pawamoy commented Feb 22, 2025

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

@sisp
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread copier/errors.py


class CopierAnswersInterrupt(CopierError, KeyboardInterrupt):
class CopierAnswersInterruptError(CopierError, KeyboardInterrupt):
Copy link
Copy Markdown
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
Copy Markdown
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.

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
Copy Markdown
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