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

error for repos with empty description #6

Open
issamansur opened this issue Sep 26, 2023 · 0 comments
Open

error for repos with empty description #6

issamansur opened this issue Sep 26, 2023 · 0 comments

Comments

@issamansur
Copy link

issamansur commented Sep 26, 2023

History

Hello, I work on one of issues, where one error/bug was found in ur library.

Description

If we try to calculate score of repo without description - it raise error.

Example of code:

    ...
    # calculate score
    innersource_repo["score"] = repo_activity.score.calculate(
        innersource_repo
    )

Error:

Traceback (most recent call last):
  File "/Users/zkoppert/repos/innersource-crawler/./crawler.py", line 87, in <module>
    innersource_repo["score"] = repo_activity.score.calculate(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/repo_activity/score.py", line 54, in calculate
    len(repo["description"]) > 30
    ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()

Possible solution:

Check also is description exist or no?
For example, add condition repo["description"] is not None:

    # give projects with a meaningful description a static boost of 50
    if (
        # add there
        repo["description"] is not None and
        len(repo["description"]) > 30
        and repo["_InnerSourceMetadata"]
        or (
            "motivation" in repo["_InnerSourceMetadata"]
            and repo["_InnerSourceMetadata"]["motivation"].length > 30
        )
    ):
        iScore += 50
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

No branches or pull requests

1 participant