Skip to content

Commit

Permalink
Add potentially_bad_ignore_run_exports
Browse files Browse the repository at this point in the history
  • Loading branch information
cbouss committed Oct 18, 2023
1 parent febd2da commit ae591b3
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Note: version releases in the 0.x.y range may introduce breaking changes.
- Add auto-fix for cbc_dep_in_run_missing_from_host, uses_setup_py, pip_install_args
- Update percy to >=0.1.0,<0.2.0
- Add wrong_output_script_key
- Add potentially_bad_ignore_run_exports

## 0.1.0
- Use percy as render backend
Expand Down
10 changes: 10 additions & 0 deletions anaconda_linter/lint/check_build_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ def fix(self, _message, _data):
return recipe.patch(op)


class potentially_bad_ignore_run_exports(LintCheck):
"""Ignoring run_export of a host dependency. In some cases it is more appropriate to remove the --error-overdepending flag of conda-build."""

def check_recipe(self, recipe):
for package in recipe.packages.values():
for dep in package.host:
if dep.pkg in package.ignore_run_exports:
self.message(section=_utils.get_dep_path(recipe, dep), severity=INFO)


class should_use_compilers(LintCheck):
"""The recipe requires a compiler directly
Expand Down
2 changes: 2 additions & 0 deletions anaconda_linter/lint_names.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,5 @@ missing_package_version
cbc_dep_in_run_missing_from_host

wrong_output_script_key

potentially_bad_ignore_run_exports
76 changes: 76 additions & 0 deletions tests/test_build_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -3078,3 +3078,79 @@ def test_cbc_dep_in_run_missing_from_host_bad_multi(base_yaml):
lint_check = "cbc_dep_in_run_missing_from_host"
messages = check(lint_check, yaml_str, "linux-64", {"hdf5": "1.2.3"})
assert len(messages) == 2


def test_potentially_bad_ignore_run_exports_good(base_yaml):
yaml_str = (
base_yaml
+ """
build:
ignore_run_exports:
- bb
requirements:
host:
- aa
"""
)
lint_check = "potentially_bad_ignore_run_exports"
messages = check(lint_check, yaml_str)
assert len(messages) == 0


def test_potentially_bad_ignore_run_exports_good_multi(base_yaml):
yaml_str = (
base_yaml
+ """
outputs:
- name: output1
build:
ignore_run_exports:
- bb
requirements:
host:
- aa
"""
)
lint_check = "potentially_bad_ignore_run_exports"
messages = check(lint_check, yaml_str)
assert len(messages) == 0


def test_potentially_bad_ignore_run_exports_bad(base_yaml):
yaml_str = (
base_yaml
+ """
build:
ignore_run_exports:
- aa
requirements:
host:
- aa
"""
)
lint_check = "potentially_bad_ignore_run_exports"
messages = check(lint_check, yaml_str)
assert len(messages) == 1


def test_potentially_bad_ignore_run_exports_bad_multi(base_yaml):
yaml_str = (
base_yaml
+ """
outputs:
- name: output1
build:
ignore_run_exports:
- aa
requirements:
host:
- aa
"""
)
lint_check = "potentially_bad_ignore_run_exports"
messages = check(lint_check, yaml_str)
assert len(messages) == 1

0 comments on commit ae591b3

Please sign in to comment.