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

Bug: Upper case change doesn't work with None license #55

Closed
3 tasks done
RaczeQ opened this issue Aug 7, 2023 · 1 comment
Closed
3 tasks done

Bug: Upper case change doesn't work with None license #55

RaczeQ opened this issue Aug 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@RaczeQ
Copy link
Contributor

RaczeQ commented Aug 7, 2023

Bug

  • I have read the comment above and have completed each step
  • I have filled out the system info
  • I have described the bug, filled in the expected outcome and the actual
    outcome including screenshots where appropriate

System info

  • OS: Ubuntu
  • Browser:
  • Version: 22.04.2

Describe the bug

Pre-commit update wanted to change LicenceCheck in my project from 2023.1.4 to 2023.3.
I have seen that a new uppercase string has been implemented. Additionally, the ModuleNotFound error has been raised, but I'm not sure if it's related.

Here is the log from the execution in the pre-commit hook (Python 3.11).
Execution: https://github.com/srai-lab/srai/actions/runs/5721376383/job/15502877608?pr=269

 During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 25, in getPackageInfoLocal
    pkgMetadata = metadata.metadata(requirement)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/importlib/metadata/__init__.py", line 998, in metadata
    return Distribution.from_name(distribution_name).metadata
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/importlib/metadata/__init__.py", line 565, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for mkdocs-jupyter

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 109, in getPackages
    packageinfo.add(getPackageInfoLocal(requirement))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 49, in getPackageInfoLocal
    raise ModuleNotFoundError from error
ModuleNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/bin/licensecheck", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/__init__.py", line 91, in cli
    myLice, depsWithLicenses = get_deps.getDepsWithLicenses(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/get_deps.py", line 161, in getDepsWithLicenses
    packages = packageinfo.getPackages(reqs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 112, in getPackages
    packageinfo.add(getPackageInfoPypi(requirement))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/packageinfo.py", line 71, in getPackageInfoPypi
    license=ucstr(licenseClassifier if licenseClassifier != UNKNOWN else info["license"]),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.cache/pre-commit/repovx3e8lm_/py_env-python3.11/lib/python3.11/site-packages/licensecheck/types.py", line 20, in __new__
    return super().__new__(cls, v.upper())
                                ^^^^^^^
AttributeError: 'NoneType' object has no attribute 'upper'

Expected outcome

Have a failure path for None licenses, maybe change the constructor for ucstr.

Actual outcome

__init__ function for ucstr fails with the None object.

@RaczeQ RaczeQ added the bug Something isn't working label Aug 7, 2023
@FredHappyface
Copy link
Member

Should be fixed in 2023.4.1 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants