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

A Conan badge as a proper listing in a registry #369

Merged
merged 2 commits into from
Oct 16, 2024
Merged
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
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ looks something like this:
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down Expand Up @@ -302,6 +303,7 @@ The manual override will be reflected in the output, as follows:
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down
6 changes: 6 additions & 0 deletions howfairis/mixins/registry_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def check_registry(self):
results = [
self.has_ascl_badge(),
self.has_bintray_badge(),
self.has_conan_badge(),
self.has_conda_badge(),
self.has_cran_badge(),
self.has_crates_badge(),
Expand Down Expand Up @@ -43,6 +44,11 @@ def has_bintray_badge(self):
r"https://img\.shields\.io/bintray/.*"]
return self._eval_regexes(regexes)

def has_conan_badge(self):
""" """
regexes = [r"https://img\.shields\.io/conan/.*"]
return self._eval_regexes(regexes)

def has_conda_badge(self):
""" """
regexes = [r"https://anaconda\.org/.*/.*/badges/downloads\.svg",
Expand Down
1 change: 1 addition & 0 deletions tests/case1/github/snippets/cli-no-args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Proceeding without it -- expect the compliance to suffer.
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down
1 change: 1 addition & 0 deletions tests/case1/github/snippets/cli-with-nonexistent-path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Proceeding without it -- expect the compliance to suffer.
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down
5 changes: 5 additions & 0 deletions tests/case1/github/test_checker_no_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is False

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is False

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is False

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is False

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is False

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is False

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
1 change: 1 addition & 0 deletions tests/case1/gitlab/snippets/cli-no-args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Proceeding without it -- expect the compliance to suffer.
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down
1 change: 1 addition & 0 deletions tests/case1/gitlab/snippets/cli-with-nonexistent-path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Proceeding without it -- expect the compliance to suffer.
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down
5 changes: 5 additions & 0 deletions tests/case1/gitlab/test_checker_no_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is False

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is False

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is False

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is False

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is False

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is False

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
1 change: 1 addition & 0 deletions tests/case2/github/snippets/cli-no-args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ url: https://github.com/fair-software/repo1
(3/5) registry
✓ has_ascl_badge
✓ has_bintray_badge
✓ has_conan_badge
✓ has_conda_badge
✓ has_cran_badge
✓ has_crates_badge
Expand Down
1 change: 1 addition & 0 deletions tests/case2/github/snippets/cli-with-nonexistent-path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Proceeding without it -- expect the compliance to suffer.
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down
5 changes: 5 additions & 0 deletions tests/case2/github/test_checker_no_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is True

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is True

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is True

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is True

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is True

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is True

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
1 change: 1 addition & 0 deletions tests/case2/gitlab/snippets/cli-no-args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ url: https://gitlab.com/fair-software/repo1
(3/5) registry
✓ has_ascl_badge
✓ has_bintray_badge
✓ has_conan_badge
✓ has_conda_badge
✓ has_cran_badge
✓ has_crates_badge
Expand Down
1 change: 1 addition & 0 deletions tests/case2/gitlab/snippets/cli-with-nonexistent-path.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Proceeding without it -- expect the compliance to suffer.
(3/5) registry
× has_ascl_badge
× has_bintray_badge
× has_conan_badge
× has_conda_badge
× has_cran_badge
× has_crates_badge
Expand Down
5 changes: 5 additions & 0 deletions tests/case2/gitlab/test_checker_no_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def test_has_codemeta_file(self, mocker):
checker = get_checker()
assert checker.has_codemeta_file() is True

def test_has_conan_badge(self, mocker):
with mocker:
checker = get_checker()
assert checker.has_conan_badge() is True

def test_has_conda_badge(self, mocker):
with mocker:
checker = get_checker()
Expand Down
2 changes: 2 additions & 0 deletions tests/case2/repo-files/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
:target: https://npmjs.org/package/cnpm
12. .. image:: https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green
:target: https://fair-software.eu
13. .. image:: https://img.shields.io/conan/v/vir-simd
:target: https://conan.io/center/recipes/vir-simd
4 changes: 4 additions & 0 deletions tests/contracts/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def test_has_citationcff_file(self, mocked_context: Mocker):
def test_has_codemeta_file(self, mocked_context: Mocker):
pass

@abstractmethod
def test_has_conan_badge(self, mocked_context: Mocker):
pass

@abstractmethod
def test_has_conda_badge(self, mocked_context: Mocker):
pass
Expand Down