Skip to content

Conversation

@frenzymadness
Copy link
Contributor

Add smart newline logic after %pyproject_check_import based on existing
%check section content (adds blank line if section has empty lines or
is multiline)

This ensures consistent spec file formatting while avoiding unnecessary
blank lines in simple check sections.

The content of the second commit is just what happened when I ran tox. Can be removed or kept as you wish.

Should I push updated specfiles somewhere for review?

@hroncok
Copy link
Owner

hroncok commented Aug 5, 2025

Is there a check section with empty lines that's not multiline? Shouldn't the multiline check always pass for a check section with empty lines?

@hroncok
Copy link
Owner

hroncok commented Aug 5, 2025

The content of the second commit is just what happened when I ran tox.

Apparently, tox -e doc changes to README take the width of the terminal window into account, so the output is unstable. See #10

@frenzymadness
Copy link
Contributor Author

Is there a check section with empty lines that's not multiline? Shouldn't the multiline check always pass for a check section with empty lines?

You are right, every section with empty lines has to also be multiline, but not vice versa – a multiline section doesn't have to contain an empty line.

@hroncok
Copy link
Owner

hroncok commented Aug 6, 2025

So, checking only for being multiline should be sufficient.

I.e. something like:

if len(l for l in sections.check if l.strip()) > 1:
    # add the empty line

@frenzymadness
Copy link
Contributor Author

Symplified and you can check the result here: frenzymadness@9e23300

Add smart newline logic after %pyproject_check_import based on existing
%check section content (adds blank line iff %check was multiline).

This ensures consistent spec file formatting while avoiding unnecessary
blank lines in simple check sections.
@hroncok hroncok force-pushed the check_import_newline branch from ec5ec4c to 82c64b4 Compare August 11, 2025 09:59
@hroncok hroncok merged commit 82c64b4 into hroncok:main Aug 11, 2025
3 checks passed
@hroncok
Copy link
Owner

hroncok commented Aug 11, 2025

Thank you. I'll make a release and push the spec change.

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.

2 participants