Bug 2141866 - Review Request: python-flake8-blind-except - A flake8 extension that checks for catch-all except statements
Summary: Review Request: python-flake8-blind-except - A flake8 extension that checks f...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1225692
TreeView+ depends on / blocked
 
Reported: 2022-11-10 22:57 UTC by Scott K Logan
Modified: 2024-02-23 01:01 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Scott K Logan 2022-11-10 22:57:40 UTC
Spec URL: https://cottsay.fedorapeople.org/python-flake8-blind-except/python-flake8-blind-except.spec
SRPM URL: https://cottsay.fedorapeople.org/python-flake8-blind-except/python-flake8-blind-except-0.2.1-1.fc38.src.rpm

Description:
A flake8 extension that checks for blind, catch-all "except:" and
"except Exception:" statements.

As of pycodestyle 2.1.0, "E722 do not use bare except, specify exception
instead" is built-in. However, bare Exception and BaseException are still
allowed. This extension flags them as B902.

Using except without explicitly specifying which exceptions to catch is
generally considered bad practice, since it catches system signals like
SIGINT. You probably want to handle system interrupts differently than
exceptions occurring in your code.

Fedora Account System Username: cottsay
Target branches: f36 f37 epel9
Koji scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=94030751

Thanks!

Comment 2 Wayne Sun 2022-11-22 15:26:20 UTC
This is informal review as I'm not sponsored.

The upstream is with MIT license and Modern Style with sublicense, the SPDX identifier in the spec is accurate:

https://github.com/elijahandrews/flake8-blind-except/blob/master/LICENSE

The %check part is with %pytest --doctest-modules which is same from the project doc and the test pass.

rpmlint on srpm, spec and built rpm all pass:

# rpmlint results/python-flake8-blind-except-0.2.1-2.fc38.src.rpm 
=================================================================== rpmlint session starts ===================================================================
rpmlint: 2.2.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 32, packages: 1

==================================== 1 packages and 0 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.8 s ====================================
[root@localhost 2141866-python-flake8-blind-except]# rpmlint results/python3-flake8-blind-except-0.2.1-2.fc38.noarch.rpm
=================================================================== rpmlint session starts ===================================================================
rpmlint: 2.2.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 32, packages: 1

==================================== 1 packages and 0 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.0 s ====================================
[root@localhost 2141866-python-flake8-blind-except]# rpmlint srpm/python-flake8-blind-except.spec
=================================================================== rpmlint session starts ===================================================================
rpmlint: 2.2.0
configuration:
    /usr/lib/python3.10/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/licenses.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 32, packages: 1

==================================== 0 packages and 1 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.7 s ====================================

The package requires:
Requires
--------
python3-flake8-blind-except (rpmlib, GLIBC filtered):
    python(abi)
    python3dist(flake8)
    python3dist(pycodestyle)

as the package is flake8 extension and in code require pycodestyle:
https://github.com/elijahandrews/flake8-blind-except/blob/master/flake8_blind_except.py#L2

so the require info is come from manual generation config in spec:

Requires:       %{py3_dist flake8}
Requires:       %{py3_dist pycodestyle}


@Miro is this expected, since upstream did not maintain requirement explicitly in the repo?



Test with install the built rpm pass with provide and require info.

Fedora review with manually review:

Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated



===== MUST items =====

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "MIT License", "Unknown or generated".
[x]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[x]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[x]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Package is not known to require an ExcludeArch tag.
[x]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 10240 bytes in 1 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: Package must own all directories that it creates.
[x]: Package does not own files or directories owned by other packages.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package must not depend on deprecated() packages.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

Python:
[x]: Python eggs must not download any dependencies during the build
     process.
[x]: A package which is used by another package via an egg interface should
     provide egg info.
[x]: Package meets the Packaging Guidelines::Python
[x]: Package contains BR: python2-devel or python3-devel
[x]: Packages MUST NOT have dependencies (either build-time or runtime) on
     packages named with the unversioned python- prefix unless no properly
     versioned package exists. Dependencies on Python packages instead MUST
     use names beginning with python2- or python3- as appropriate.
[x]: Python packages must not contain %{pythonX_site(lib|arch)}/* in %files
[x]: Binary eggs must be removed in %prep

===== SHOULD items =====

Generic:
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[?]: Package functions as described.
[x]: Latest version is packaged.
[x]: Package does not include license text files separate from upstream.
[-]: Sources are verified with gpgverify first in %prep if upstream
     publishes signatures.
     Note: gpgverify is not used.
[?]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: %check is present and all tests pass.
[?]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: No rpmlint messages.
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Cannot parse rpmlint output:


Rpmlint (installed packages)
----------------------------
============================ rpmlint session starts ============================
rpmlint: 2.4.0
configuration:
    /usr/lib/python3.11/site-packages/rpmlint/configdefaults.toml
    /etc/xdg/rpmlint/fedora-legacy-licenses.toml
    /etc/xdg/rpmlint/fedora-spdx-licenses.toml
    /etc/xdg/rpmlint/fedora.toml
    /etc/xdg/rpmlint/scoring.toml
    /etc/xdg/rpmlint/users-groups.toml
    /etc/xdg/rpmlint/warn-on-functions.toml
checks: 31, packages: 1

 1 packages and 0 specfiles checked; 0 errors, 0 warnings, 0 badness; has taken 0.0 s 



Source checksums
----------------
https://github.com/elijahandrews/flake8-blind-except/archive/v0.2.1/flake8-blind-except-0.2.1.tar.gz :
  CHECKSUM(SHA256) this package     : d418273d9595f18d25ef8bd43af27f78aa5a29753207990854bf3ecb198cd955
  CHECKSUM(SHA256) upstream package : d418273d9595f18d25ef8bd43af27f78aa5a29753207990854bf3ecb198cd955


Requires
--------
python3-flake8-blind-except (rpmlib, GLIBC filtered):
    python(abi)
    python3dist(flake8)
    python3dist(pycodestyle)



Provides
--------
python3-flake8-blind-except:
    python-flake8-blind-except
    python3-flake8-blind-except
    python3.11-flake8-blind-except
    python3.11dist(flake8-blind-except)
    python3dist(flake8-blind-except)



Generated by fedora-review 0.9.0 (6761b6c) last change: 2022-08-23
Command line :/usr/bin/fedora-review -b 2141866 -m fedora-rawhide-x86_64
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, Python, Shell-api
Disabled plugins: fonts, Ocaml, Haskell, PHP, SugarActivity, Perl, Java, C/C++, R
Disabled flags: EPEL6, EPEL7, DISTTAG, BATCH, EXARCH

Comment 3 Wayne Sun 2022-11-22 16:48:05 UTC
When testing with install the built rpm on my laptop:

# dnf install results/python3-flake8-blind-except-0.2.1-2.fc38.noarch.rpm 
Last metadata expiration check: 0:05:58 ago on Tue 22 Nov 2022 04:40:26 PM GMT.
Error: 
 Problem: conflicting requests
  - nothing provides python(abi) = 3.11 needed by python3-flake8-blind-except-0.2.1-2.fc38.noarch
(try to add '--skip-broken' to skip uninstallable packages)

the error shows only python(abi) is required, not sure why python3dist(flake8) and python3dist(pycodestyle) are missing.

Comment 4 Miro Hrončok 2022-11-22 18:05:05 UTC
Scott, why are flake8 and pycodestyle required manually? Should that be fixed upstream?


Wayne, are you trying to install a rawhide package on non-rawhide?

Comment 5 Scott K Logan 2022-11-22 23:27:52 UTC
> Scott, why are flake8 and pycodestyle required manually? Should that be fixed upstream?

A case could be made upstream for either dependency to be listed explicitly, but it's not terribly clear-cut.

Though this package is pitched as a flake8 plugin, it has no runtime dependency on flake8 itself and could theoretically be used without flake8.
The package also requires either pycodestyle OR pep8, which can't be expressed as a python dependency AFAIK.

Comment 6 Miro Hrončok 2022-11-22 23:49:58 UTC
Got it. Should the manual dependency be done as OR then, considering that can be expressed as an RPM dependency?

Requires:       (%{py3_dist flake8} or %{py3_dist pycodestyle})
Suggests:       %{py3_dist flake8}

Comment 7 Scott K Logan 2022-11-23 00:00:47 UTC
> Should the manual dependency be done as OR then, considering that can be expressed as an RPM dependency?

The alternative is actually pep8, which hasn't been packaged in Fedora for some time now, so:

Requires: %{py3_dist pycodestyle}

...is the only thing we can do.

Comment 8 Wayne Sun 2022-11-23 09:16:56 UTC
(In reply to Miro Hrončok from comment #4)
> Scott, why are flake8 and pycodestyle required manually? Should that be
> fixed upstream?
> 
> 
> Wayne, are you trying to install a rawhide package on non-rawhide?

Yes, it's just for check the require info when install the package

Comment 9 Package Review 2024-02-23 00:45:23 UTC
This is an automatic check from review-stats script.

This review request ticket hasn't been updated for some time. We're sorry
it is taking so long. If you're still interested in packaging this software
into Fedora repositories, please respond to this comment clearing the
NEEDINFO flag.

You may want to update the specfile and the src.rpm to the latest version
available and to propose a review swap on Fedora devel mailing list to increase
chances to have your package reviewed. If this is your first package and you
need a sponsor, you may want to post some informal reviews. Read more at
https://fedoraproject.org/wiki/How_to_get_sponsored_into_the_packager_group.

Without any reply, this request will shortly be considered abandoned
and will be closed.
Thank you for your patience.


Note You need to log in before you can comment on or make changes to this bug.