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 flake8 extra plugins #1098

Merged
merged 3 commits into from
Aug 7, 2023

Conversation

afrid18
Copy link
Contributor

@afrid18 afrid18 commented Aug 4, 2023

Fedora workflow runners are missing flake8's other plugins used in opensuse.
Added plugins:
python3-flake8-builtins
python3-flake8-quotes

And still python3-flake8-bugbear is missing. Which can be installed through pip if required. Please confirm on this if I can add a pip install command for the same as well.

These plugins are already used
in opensuse distros
@danigm
Copy link
Member

danigm commented Aug 4, 2023

Looks like fedora rawhide doesn't like the quotes:

Run flake8
./rpmlint/lint.py:97:61: Q000 Double quotes found but single quotes preferred
./rpmlint/lint.py:97:105: Q000 Double quotes found but single quotes preferred
./rpmlint/lint.py:134:34: Q000 Double quotes found but single quotes preferred
./rpmlint/lint.py:134:48: Q000 Double quotes found but single quotes preferred
./rpmlint/lint.py:134:72: Q000 Double quotes found but single quotes preferred
./rpmlint/lint.py:146:22: Q000 Double quotes found but single quotes preferred
Error: Process completed with exit code 1.

@afrid18
Copy link
Contributor Author

afrid18 commented Aug 4, 2023

I will add an another commit with those edits.

@afrid18 afrid18 force-pushed the add-flake8-plugins branch 3 times, most recently from 1c37026 to f3a73e8 Compare August 7, 2023 06:54
@danigm
Copy link
Member

danigm commented Aug 7, 2023

Looks like the python3.12 in fedora rawhide is complaining about quotes in fstrings. This is related to the new syntactic formalization of f-string.

To make this compatible between 3.12 and previous versions, we can just ignore the error just in these kind of lines. The other option is to move values to variables so there's no "quotes" in f-strings, and looks like this PR is following that option.

rpmlint/lint.py Outdated Show resolved Hide resolved
Copy link
Member

@danigm danigm left a comment

Choose a reason for hiding this comment

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

Now this change looks good to me.

@danigm danigm merged commit 6eb0be4 into rpm-software-management:main Aug 7, 2023
12 of 13 checks passed
@afrid18 afrid18 deleted the add-flake8-plugins branch August 7, 2023 08:03
@afrid18 afrid18 restored the add-flake8-plugins branch August 7, 2023 08:57
@DimStar77
Copy link
Contributor

This seems to be invalid code:

> rpmlint --time-report

Check time report (>1% & >0.1s):
Traceback (most recent call last):
  File "/usr/bin/rpmlint", line 33, in <module>
    sys.exit(load_entry_point('rpmlint==2.4.0', 'console_scripts', 'rpmlint')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/cli.py", line 184, in lint
    sys.exit(lint.run())
             ^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 123, in run
    return self._run()
           ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 108, in _run
    self._maybe_print_reports()
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 130, in _maybe_print_reports
    self._print_time_report()
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 151, in _print_time_report
    check = format('Check', ':32s')
            ^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid format specifier ':32s' for object of type 'str'

line 151 being: check = format('Check', ':32s')

@danigm
Copy link
Member

danigm commented Sep 18, 2023

This seems to be invalid code:

> rpmlint --time-report

Check time report (>1% & >0.1s):
Traceback (most recent call last):
  File "/usr/bin/rpmlint", line 33, in <module>
    sys.exit(load_entry_point('rpmlint==2.4.0', 'console_scripts', 'rpmlint')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/cli.py", line 184, in lint
    sys.exit(lint.run())
             ^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 123, in run
    return self._run()
           ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 108, in _run
    self._maybe_print_reports()
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 130, in _maybe_print_reports
    self._print_time_report()
  File "/usr/lib/python3.11/site-packages/rpmlint/lint.py", line 151, in _print_time_report
    check = format('Check', ':32s')
            ^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid format specifier ':32s' for object of type 'str'

line 151 being: check = format('Check', ':32s')

My bad, all these lines should be like check = '{:32s}'.format('Check') or format('Check', '32s'), without the :

@danigm
Copy link
Member

danigm commented Sep 18, 2023

Just created a new PR to fix the issue, I'll merge as soon as the CI pass: #1111

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