Skip to content

docs: API review - step 1#255

Open
lread wants to merge 1 commit intomasterfrom
lread/api-review-step1
Open

docs: API review - step 1#255
lread wants to merge 1 commit intomasterfrom
lread/api-review-step1

Conversation

@lread
Copy link
Copy Markdown
Contributor

@lread lread commented Apr 14, 2026

Step 1 for #197: Initial docstring & arg names review.

Args lists naming review, now using:

  • path (or -path suffix) for a file or dir (which might be a string, Path, or File)
  • dir or -dir suffix means always directory
  • file or -file suffix means always a file (not to be confused with File)
  • target (was using dest sometimes)
  • source (was using src sometimes)

Note: I added private babashka.fs/path* to be used when there would otherwise be a collision between path arg and path fn.

Consistent language for docstrings.
I.e., now consistently "Returns ... "

Consistently describe opts under Options:, and as keywords.

Get much less wordy for xdg-* and reworded some other fns.

As requested, now vague on return values.
We now only explicitly state Path for fs/path, and File for fs/file.

Vaguely documented return types of fns that are simple pass-thrus to JDK. Tests mostly already covered these, but filled missing gaps.

Added "Coercions and Returns" and "Argument Naming Conventions" sections to README.

Please answer the following questions and leave the below in as part of your PR.

Step 1 for #197: Initial docstring & arg names review.

Args lists naming review, now using:
- `path` (or `-path` suffix) for a file or dir (which might be a string, Path, or File)
- `dir` or `-dir` suffix means always directory
- `file` or `-file` suffix means always a file (not to be confused with File)
- `target` (was using `dest` sometimes)
- `source` (was using `src` sometimes)

Note: I added private `babashka.fs/path*` to be used when there would otherwise be a collision between `path` arg and `path` fn.

Consistent language for docstrings.
I.e., now consistently "Returns ... "

Consistently describe `opts` under Options:, and as keywords.

Get much less wordy for xdg-* and reworded some other fns.

As requested, now vague on return values.
We now only explicitly state `Path` for fs/path, and `File` for fs/file.

Vaguely documented return types of fns that are simple pass-thrus to JDK.
Tests mostly already covered these, but filled missing gaps.

Added "Coercions and Returns" and "Argument Naming Conventions" sections to README.
@NoahTheDuke
Copy link
Copy Markdown

damn, this is stellar work, lee!

@borkdude
Copy link
Copy Markdown
Contributor

borkdude commented Apr 15, 2026

I took a brief look but I found this more confusing than it was before:

  • Returns path(s), ...

I think this sentence gives the initial impression that multiple paths are returned. Therefore I think starting with Returns <ret>, coerced from <args> reads slightly better?

@borkdude
Copy link
Copy Markdown
Contributor

Sorry for my brief response, in a hurry today. Will reply more carefully later.

@lread
Copy link
Copy Markdown
Contributor Author

lread commented Apr 15, 2026

Thanks @NoahTheDuke!

@borkdude, thanks for initial peek.

One example:

before:
Converts f into an absolute Path via Path#toAbsolutePath.

After:
Returns absolute path for path via Path#toAbsolutePath.

Is it the "path for path" you might be finding awkward? Anyway, looking forward to hearing more about your thoughts when you find some time.

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.

3 participants