Skip to content

Remove unnecessary empty string in print function #40419

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 5 commits into
base: develop
Choose a base branch
from

Conversation

tqa236
Copy link

@tqa236 tqa236 commented Jul 16, 2025

Autofix a few FURB105 errors with ruff check src/sage --select FURB105 --fix in the first commit and enforce the rule in the second commit to avoid regression. Let me know if updating pyproject.toml with enforceable rules are ok or not. I can revert the second commit if needed.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@fchapoton
Copy link
Contributor

pyproject.toml is probably not the right place ; see .github/workflows/lint.yml

@tqa236
Copy link
Author

tqa236 commented Jul 16, 2025

thanks a lot for pointing me to that file @fchapoton. I found that the command line is more natural for opt-out rather than opt-in, but I moved it there anyway.

Abusing a bit the scope of this PR, I added the rule B005 here too, as requested by @user202729, if the config works correctly, this PR should fail now but pass after #40415 is merged.

@tqa236
Copy link
Author

tqa236 commented Jul 16, 2025

Look like the B005 violations are correctly flagged here. Regarding the 2 FURB105 violations, it's ok to fix errors in src/sage_setup/autogen and build/sage_bootstrap? I just assumed autogen is short for autogenerated code (?) and left it out.

@fchapoton
Copy link
Contributor

fchapoton commented Jul 16, 2025

you can also fix the failure in autogen, as this is not an autogenerated file

and also in bootstrap, for sure

@tqa236
Copy link
Author

tqa236 commented Jul 16, 2025

i pushed the fix but it's a bit strange that this check failed. Anything we can do with it?

@fchapoton
Copy link
Contributor

I would suggest to wait a few weeks or months until #40415 is merged.

@tqa236
Copy link
Author

tqa236 commented Jul 17, 2025

hi @fchapoton, sorry for not being clear. What surprised me is that the "Synchronize labels" job failed. The Lint job fails as expected.

However, as you (humorously?) pointed out that the dev cycle for a PR that needs a dependency is quite long. It'll be quite inefficient if there are many rules to fix.

I suggest we'll only fix the errors for now and then some times later when we have a few rules to enforce I'll do that at once in a single PR. Will this work for you?

@fchapoton
Copy link
Contributor

ok, I agree with enforcing the checks later

@tqa236
Copy link
Author

tqa236 commented Jul 18, 2025

thanks, @fchapoton. This PR should be ready for review in that case.

Copy link
Contributor

@fchapoton fchapoton left a comment

Choose a reason for hiding this comment

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

ok, good, thanks

vbraun pushed a commit to vbraun/sage that referenced this pull request Jul 20, 2025
sagemathgh-40419: Remove unnecessary empty string in print function
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

Autofix a few [`FURB105`](https://docs.astral.sh/ruff/rules/print-empty-
string/) errors with `ruff check src/sage --select FURB105 --fix` in the
first commit and enforce the rule in the second commit to avoid
regression. Let me know if updating `pyproject.toml` with enforceable
rules are ok or not. I can revert the second commit if needed.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#40419
Reported by: Trinh Quoc Anh
Reviewer(s): Frédéric Chapoton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants