Skip to content

Commit

Permalink
Revert "Merge pull request #100 from thehale/master"
Browse files Browse the repository at this point in the history
This reverts commit 11bae51, reversing
changes made to d16e5ef.
  • Loading branch information
Olivier Chédru committed Jan 5, 2023
1 parent da7917a commit 607d58e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
18 changes: 5 additions & 13 deletions liccheck/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,16 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):

at_least_one_unauthorized = False
count_authorized = 0
licenses = get_license_names(pkg["licenses"])
for license in licenses:
for license in pkg["licenses"]:
lower = license.lower()
if check_one(
license,
lower,
license_rule="UNAUTHORIZED",
as_regex=as_regex,
):
at_least_one_unauthorized = True
if check_one(
license,
lower,
license_rule="AUTHORIZED",
as_regex=as_regex,
):
Expand All @@ -247,7 +247,7 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):
)
or (
count_authorized
and count_authorized == len(licenses)
and count_authorized == len(pkg["licenses"])
and level is Level.PARANOID
)
):
Expand All @@ -259,14 +259,6 @@ def check_one(license_str, license_rule="AUTHORIZED", as_regex=False):

return Reason.UNKNOWN

def get_license_names(licenses):
names = []
for license in licenses:
license = license.lower()
options = license.split(" or ")
for option in options:
names.append(option)
return names

def find_parents(package, all, seen):
if package in seen:
Expand Down
1 change: 0 additions & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ pytest-cov
python-openid;python_version<="2.7"
python3-openid;python_version>="3.0"
pytest-mock>=1.10
tox
11 changes: 3 additions & 8 deletions tests/test_check_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ def packages():
"version": "1",
"licenses": ["authorized 1", "unauthorized 1"],
},
{
"name": "auth_one_or_unauth_one",
"version": "2",
"licenses": ["authorized 1 or unauthorized 1"],
},
{
"name": "unauth_one",
"version": "2",
Expand Down Expand Up @@ -82,9 +77,9 @@ def packages():
@pytest.mark.parametrize(
("level", "reasons"),
[
(Level.STANDARD, [OK, OK, OK, OK, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
(Level.CAUTIOUS, [OK, OK, UNAUTH, UNAUTH, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
(Level.PARANOID, [OK, OK, UNAUTH, UNAUTH, UNAUTH, OK, UNAUTH, UNKNOWN, UNKNOWN]),
(Level.STANDARD, [OK, OK, OK, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
(Level.CAUTIOUS, [OK, OK, UNAUTH, UNAUTH, OK, UNAUTH, OK, UNKNOWN]),
(Level.PARANOID, [OK, OK, UNAUTH, UNAUTH, OK, UNAUTH, UNKNOWN, UNKNOWN]),
],
ids=[level.name for level in Level],
)
Expand Down

0 comments on commit 607d58e

Please sign in to comment.