Skip to content

Fix offline and --no-pull handling in component and pipeline linting - #4642

Open
rpinho wants to merge 3 commits into
nf-core:devfrom
rpinho:fix-offline-lint-create
Open

rpinho wants to merge 3 commits into
nf-core:devfrom
rpinho:fix-offline-lint-create

Conversation

@rpinho

@rpinho rpinho commented Nov 25, 2026

Copy link
Copy Markdown

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

Who hits this: nf-core users running modules lint --local, modules --no-pull create, or pipelines lint offline or behind a corporate VPN (#4613 and #4584).

Addresses #4613 and #4584.

On dev (181dff1), several lint and scaffold paths still require Git or HTTP access even when linting local components or passing --no-pull:

  • nf-core modules lint -d modules/local --local (and subworkflows lint --local) eagerly initializes ModulesRepo, attempts to clone/fetch nf-core/modules, prompts to delete the local cache on fetch failure, and reconciles modules.json.
  • nf-core modules --no-pull create (and subworkflows --no-pull create) omits no_pull, runs legacy migration and Prettier bootstrap, and calls gh api /user even when --author is given.
  • nf-core modules --no-pull lint (and subworkflows --no-pull lint) still crashes on a missing cache or fetches during version/change checks.
  • nf-core pipelines lint (actions_schema_validation) fetches https://www.schemastore.org/github-workflow even when there are no workflow files, has no timeout, and crashes on SSLError, ConnectionError, Timeout, or non-JSON/non-object proxy responses; unreachable component remotes also abort run_linting.

Changes:

  • Defer ModulesRepo setup in ComponentCommand / ComponentLint and pass local=local through modules lint and subworkflows lint, reading existing disk schemas when cached and warning when uncached without touching modules.json.
  • Wire no_pull through ModuleCreate and SubworkflowCreate; skip repo init, legacy migration, gh api /user, and Prettier when --no-pull is set (and skip gh whenever a valid --author is already supplied).
  • Add ModulesRepoUnavailableError and cache_only=self.no_pull for lint repo lookups so offline/uncached version and diff checks warn instead of crashing while real file mismatches and missing main.nf still fail.
  • Skip actions_schema_validation when no .github/workflows/*.y*ml files exist, add timeout=10, catch requests.RequestException, and warn on non-object JSON proxy responses while keeping online pass/fail validation intact.
  • Guard None responses from bio.tools and empty tools: keys in update_meta_yml_file.

This keeps the existing --no-pull flag placement so the broader --offline CLI design from #4613 / #4584 can be decided separately.

Tests: tests/test_offline.py (socket-blocked offline suite, 29 cases) has 26 failures and 3 passing online/control cases on dev (181dff1) and passes 29/29 here. mypy nf_core/ reports 0 new errors, ruff check and ruff format --check pass on all modified files, and the existing pipeline lint suite (93 tests) passes.

Found and written with AI agents; a separate AI referee reproduced the problem before this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

@rpinho
rpinho requested a review from a team as a code owner November 25, 2026 09:15
@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.96%. Comparing base (181dff1) to head (0ef9ace).

Files with missing lines Patch % Lines
nf_core/modules/modules_repo.py 66.66% 8 Missing ⚠️
nf_core/components/lint/__init__.py 89.47% 6 Missing ⚠️
nf_core/components/create.py 61.53% 5 Missing ⚠️
nf_core/subworkflows/lint/subworkflow_changes.py 58.33% 5 Missing ⚠️
nf_core/subworkflows/lint/subworkflow_version.py 69.23% 4 Missing ⚠️
nf_core/modules/modules_json.py 62.50% 3 Missing ⚠️
nf_core/modules/lint/module_version.py 92.85% 1 Missing ⚠️

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 29.21%

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
✅ 11 untouched benchmarks
⏩ 4 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_modules_update 1,215.8 ms 941 ms +29.21%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rpinho:fix-offline-lint-create (0ef9ace) with dev (181dff1)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Subclasses in tests (e.g. DummyLint in test_environment_yml.py) bypass
ComponentLint.__init__ and lack component_type / _remote_url; fall back
with getattr() in schema_path().

Co-Authored-By: Gemini 4 Neon <[email protected]>

This branch has not been deployed

No deployments
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.

1 participant