Skip to content

Fix URI generation on Windows when linting#134

Merged
mvdbeek merged 1 commit intogalaxyproject:mainfrom
loichuder:fix-windows-uri
Mar 9, 2026
Merged

Fix URI generation on Windows when linting#134
mvdbeek merged 1 commit intogalaxyproject:mainfrom
loichuder:fix-windows-uri

Conversation

@loichuder
Copy link
Copy Markdown
Contributor

@loichuder loichuder commented Mar 9, 2026

When running gxwf-lint on Windows, I had the following error:

> gxwf-lint .\workflow.yaml
.. ERROR: Validation failed [Errno 2] No such file or directory: ''

I traced the error back to the URL parsing of schema_salad:
https://github.com/common-workflow-language/schema_salad/blob/2cd30d8d5519e178d9ad2be9e3c8c4b8cc5fc694/schema_salad/fetcher.py#L73.

This gives an empty path when running the above command on Windows.

The input url is actually generated at

load_document("file://" + os.path.abspath(path))

The simple concatenation of file:// gives a valid URI on Unix but not on Windows as the path gets parsed into netloc, giving an empty path:

>>> url = "file://" + os.path.abspath(path)
>>> url
'file://C:\\Users\\huder\\Projects\\gxformat2\\workflow.yaml'
>>> urllib.parse.urlsplit(url)
SplitResult(scheme='file', netloc='C:\\Users\\huder\\Projects\\gxformat2\\workflow.yaml', path='', query='', fragment='')

By using pathlib.Path.as_uri, we can build a URI that works both for Unix and Windows:

>>> url = Path(os.path.abspath(path)).as_uri()
>>> url
'file:///C:/Users/huder/Projects/gxformat2/workflow.yaml'
>>> urllib.parse.urlsplit(url)
SplitResult(scheme='file', netloc='', path='/C:/Users/huder/Projects/gxformat2/workflow.yaml', query='', fragment='')

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.03%. Comparing base (71dc898) to head (4b40080).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #134   +/-   ##
=======================================
  Coverage   41.03%   41.03%           
=======================================
  Files          51       51           
  Lines        1974     1974           
  Branches      441      441           
=======================================
  Hits          810      810           
  Misses       1047     1047           
  Partials      117      117           
Flag Coverage Δ
unittests 41.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mvdbeek
Copy link
Copy Markdown
Member

mvdbeek commented Mar 9, 2026

Looks good to me, can you fix the linting issue ?

  py310-lint: commands[0]> ruff check
  All checks passed!
  py310-lint: commands[1]> flake8
  ./gxformat2/lint.py:6:1: I100 Import statements are in the wrong order. 'import sys' should be before 'from pathlib import Path'
  py310-lint: exit 1 (0.79 seconds) /home/runner/work/gxformat2/gxformat2> flake8 pid=2588

@loichuder
Copy link
Copy Markdown
Contributor Author

Looks good to me, can you fix the linting issue ?

Done. Sorry for not going through the CONTRIBUTING thoroughly enough 😅

@mvdbeek
Copy link
Copy Markdown
Member

mvdbeek commented Mar 9, 2026

No worries, thank you!

@mvdbeek mvdbeek merged commit e9d5c7d into galaxyproject:main Mar 9, 2026
11 checks passed
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.

2 participants