Skip to content

Add --doi and --conda_requirements to shed_lint - #1729

Draft
jmchilton wants to merge 1 commit into
galaxyproject:masterfrom
jmchilton:issue-667-shed-lint-options
Draft

jmchilton wants to merge 1 commit into
galaxyproject:masterfrom
jmchilton:issue-667-shed-lint-options

Conversation

@jmchilton

Copy link
Copy Markdown
Member

Adds --doi and --conda_requirements to planemo shed_lint, closing an eight-year-old gap
between it and planemo lint.

The gap

peterjc reported in #667 that shed_lint was missing options lint has, so checking a repository
meant running both commands. --biocontainer was added independently in 2023 (2c1bbff), without
reference to the issue; the other two were still missing on master:

flag lint shed_lint (before)
--urls yes yes
--biocontainer yes yes
--doi yes no
--conda_requirements yes no

planemo shed_lint --tools --doi . failed with Error: No such option '--doi'.

Why it was only ever a plumbing gap

The 2017 diagnosis on the issue was that only the click options were missing. That still held:

  • shed_lint.lint_repository already calls build_tool_lint_args(ctx, **kwds) (shed_lint.py:72)
    and forwards extra_modules into lint_tool_source_with (shed_lint.py:143) - the same path
    lint uses.
  • _lint_extra_modules keys off kwds["doi"] and kwds["conda_requirements"]
    (tool_lint.py:60-73).

Since the click endpoint never put those keys in kwds, the linters silently never loaded. No
downstream change was needed.

Change

Rather than a third copy of each @click.option block, both are extracted into options.py
factories beside the existing lint_biocontainers_option(), and used from both commands.
docs/commands/lint.rst regenerates byte-identical, confirming lint's interface is untouched.

Tests

Two tests in tests/test_shed_lint.py, both reusing existing fixtures (single_tool_required_files,
tests/data/tools/bwa_without_requirements.xml) - no new test data.

  • test_tool_linting_doi - asserts the DOI diagnostic is absent without the flag and present with
    it. Offline and deterministic: doi.org and the Tool Shed repositories API are stubbed with
    responses, as tests/test_trs_id.py already does. Worth noting doi.org currently answers 403
    to an unauthenticated requests GET, so an unmocked version of this test would be flaky.
  • test_tool_linting_conda_requirements - marked slow, matching the equivalents in test_lint.py.
    It pins the linter's own message as well as the exit code, since a usage error is also non-zero
    and would otherwise pass.

Verified red-to-green: with only the planemo/ changes reverted, both fail (No such option '--doi'); restored, the full tests/test_shed_lint.py passes (9 tests), as does
tests/test_lint.py (8 passed, 5 skipped). flake8, black and mypy clean on the changed files.

Note

--urls is still defined inline and identically in both commands. Folding it into a factory too
would be a one-line change each, but it is outside this issue - happy to include it if preferred.

Fixes #667

🤖 Generated with Claude Code

shed_lint already routes tools through build_tool_lint_args, so the
linters were reachable - only the click options were missing, leaving
`shed_lint --tools` unable to run checks `lint` has had for years.
Extract both options into options.py factories next to the existing
lint_biocontainers_option so the two commands share one definition.

Fixes galaxyproject#667

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

shed_lint is missing options in lint

1 participant