Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions conda_smithy/lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,10 @@ def lintify(meta, recipe_dir=None, conda_forge=False):
if set(parsed_exceptions) - expected_exceptions:
hints.append("License exception is not an SPDX exception.")

# 5: recommend license_family
if "license_family" not in about_section:
hints.append("license_family entry is missing, but is recommended.")

return lints, hints


Expand Down
25 changes: 25 additions & 0 deletions news/req-lic.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**Added:**

* Linter will now hint if the ``license_family`` fields in the about section
doesn't exist.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>

19 changes: 19 additions & 0 deletions tests/test_lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,25 @@ def test_build_sh_with_shellcheck_findings(self):
)
assert len(hints) < 100

def test_no_licenses(self):
meta = {"about": {"url": "http://example.com"}}
lints, hints = linter.lintify(meta)
self.assertIn(
"The license item is expected in the about section.", lints,
)
self.assertIn(
"license_family entry is missing, but is recommended.", hints
)

meta["about"]["license"] = "BSD-3-Clause"
lints, hints = linter.lintify(meta)
self.assertIn(
"license_file entry is missing, but is required.", lints,
)
self.assertIn(
"license_family entry is missing, but is recommended.", hints
)


@pytest.mark.cli
class TestCLI_recipe_lint(unittest.TestCase):
Expand Down