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 DUMB License (#4058) #4143

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

alok1304
Copy link
Contributor

Fixes #4058
github repo of DUMB: https://github.com/kode54/dumb?tab=License-1-ov-file

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

Signed-off-by: Alok Kumar alokkumarjipura9973@gmail.com

@alok1304 alok1304 force-pushed the new_dumb_license branch 6 times, most recently from 7f62878 to e84d4b1 Compare February 17, 2025 04:58
@alok1304
Copy link
Contributor Author

@pombredanne This test case is failing.


tests\licensedcode\test_detect.py F                                                                                             [100%]

============================================================== FAILURES ============================================================== 
_____________________ TestMatchAccuracyWithFullIndex.test_match_has_correct_line_positions_in_automake_perl_file _____________________ 

self = <test_detect.TestMatchAccuracyWithFullIndex testMethod=test_match_has_correct_line_positions_in_automake_perl_file>

    def test_match_has_correct_line_positions_in_automake_perl_file(self):
        # Reported as https://github.com/nexB/scancode-toolkit/issues/88
        # Note that this test is very sensitive to changes in the licenses data
        # set on purpose. Adding new license and/or frequent tokens will likely
        # make it fail In this case, review the new not-frequent tokens that
        # could be involved, eventually update the rule-side Span offset if this
        # looks acceptable below. Most cases just need to fix the test.
        expected = [
            # detected, match.lines(), match.qspan,
            ('gpl-2.0-plus', (12, 25), Span(48, 157)),
            ('fsf-unlimited-no-warranty', (231, 238), Span(964, 1027)),
            ('warranty-disclaimer', (306, 307), Span(1335, 1357)),
        ]
>       self.check_position('positions/automake.pl', expected)

tests\licensedcode\test_detect.py:1067:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

self = <test_detect.TestMatchAccuracyWithFullIndex testMethod=test_match_has_correct_line_positions_in_automake_perl_file>
test_path = 'positions/automake.pl'
expected = [('gpl-2.0-plus', (12, 25), Span(48, 157)), ('fsf-unlimited-no-warranty', (231, 238), Span(964, 1027)), ('warranty-disclaimer', (306, 307), Span(1335, 1357))]
with_span = True

    def check_position(self, test_path, expected, with_span=True):
        """
        Check license detection in file or folder against expected result.
        Expected is a list of (license, lines span, qspan span) tuples.
        """
        test_location = self.get_test_loc(test_path)
        results = []
        # FULL INDEX!!
        idx = cache.get_index()
        matches = idx.match(test_location)
        for match in matches:
            for detected in match.rule.license_keys():
                results.append((detected, match.lines(), with_span and match.qspan or None))
>       assert results == expected
E       AssertionError: assert [('gpl-2.0-pl...(1349, 1371))] == [('gpl-2.0-pl...(1335, 1357))]
E
E         At index 0 diff: ('gpl-2.0-plus', (12, 25), Span(51, 160)) != ('gpl-2.0-plus', (12, 25), Span(48, 157))
E         Use -v to get more diff

tests\licensedcode\test_detect.py:922: AssertionError

Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Choose a reason for hiding this comment

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

Thanks ++ @alok1304, see comments for your consideration.

@alok1304 alok1304 force-pushed the new_dumb_license branch 2 times, most recently from 0608029 to 91d2498 Compare April 5, 2025 18:31
Reference: aboutcode-org#4058
Signed-off-by: Alok Kumar <alokkumarjipura9973@gmail.com>
@alok1304
Copy link
Contributor Author

alok1304 commented Apr 5, 2025

@AyanSinhaMahapatra Now, previous failing test cases are passed. :)

@alok1304 alok1304 changed the title Add DUMB License and Detection Rule (#4058) Add DUMB License (#4058) Apr 5, 2025
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.

Consider adding new "dumb" license (or adding a rule)
2 participants