feat: Configurable docsbuilder port #20
No reviewers
Labels
No labels
effort
high
effort
low
effort
medium
good first issue
help wanted
meeting topic
needs changes
needs reporter feedback
needs review
priority
high
priority
low
priority
medium
priority
on hold
type/content
type/misc
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
docs/docs-template!20
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "docs_listen_port"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Since this is set as an environment variable, you can use tools such as direnv or mise to set per-directory values when you
cdinto them, ensuring that none of your local docs repos have port conflicts.I wasn't sure whether you'd prefer that I bump the script version in the PR or later on main
@mwinters wrote in #20 (comment):
I'm not entirely sure what you mean by that. I also notice, IIUC, that you created a branch for this PR directly in this repo without forking it first. Is that the recommended approach for contributing to this repo?
Also, the pattern
: "${DOCS_LISTEN_PORT:=8080}"is an unusual way to set a default. It's clearer to useDOCS_LISTEN_PORT=${DOCS_LISTEN_PORT:=8080}or a simple conditional check. Additionally, this breaks the script's naming convention. All other variables are lowercase (script_name,srcdir,buildir, etc.). Consider usingdocs_listen_portinstead.version="1.2.0"This is the general FOSS norm when one has maintainer privileges. Is that not the norm here? What value would be added by the extra process steps?
I suppose "unusual" depends on what scripts you've been looking at lately 🙂. I can change this to whatever is "usual" here. (Commit incoming.)
This variable is intended to come from the environment, where POSIX says variables should be all-caps:
Additionally, the Google Bash Style Guide, which is arguably one of the primary authoritative sources on style besides POSIX, says:
This matches my experience from bash around many other projects. So actually, this script does not conform to the recommended styles from several authoritative sources. Would you like me to update it?
@mwinters wrote in #20 (comment):
In the projects I participate in, everyone opens PRs from their forks, even those with write permissions do so. The only exception is when we're testing something in a non-production environment, like the Fedora Forge staging instance for example, which isn't the case here. Since I'm a new member of the team, I don't know what the norm is, so I'm asking.
@pbokoc Care to weigh in with a preference? Should members of the docs team still be required to use personal forks for PRs, or are branch PRs ok?
My $0.02: if I'm already a member of the team and presumably committing somewhat frequently, then I don't see what value we're adding by requiring the extra friction of a fork. We just need to delete branches when merging PRs. And if we're really worried, we could prefix PR branches like
mwinters/fooorfeature/bar.AIUI, the POSIX page applies to environment variables provided by the system or used by POSIX utilities, not user-defined script variables.
As you mentioned, this variable is intended to come from the environment. The Google Bash Style Guide states that anything exported to the environment should be capitalized. AIUI, this refers to variables you explicitly export with
exportordeclare -xto pass to child processes.DOCS_LISTEN_PORTis not exported to the environment. It's a user-defined script variable that accepts environment input via the${VAR:-default}syntax.It is also a constant, i.e. the value is never modified in the script after definition. Which, in every bash script I've ever read, is supposed to be in all-caps. And so we arrive back at the original variable name.
According to the Google Shell Style Guide, variables should be uppercase only if they are declared with
readonlyorexport. This variable is neither. Simply not modifying a variable doesn't make it a constant.If you declare it
readonly DOCS_LISTEN_PORT="${DOCS_LISTEN_PORT:=8080}", it technically works but is semantically confusing.Ok, the single-variable feature is added AND I've addressed several code consistency / best-practices issues across the entire script:
readonly UPPERCASElocalis applied to local variables[[ ]]is used where appropriateHmmm. So re: opening PRs from forks vs directly - I don't have a preference, I have to admit I never even thought of that. I've always used a fork, and I sometimes just push directly if it's something small.
I'll open a separate issue in
ticketsso we can maybe talk about it in the next team meeting. (Edit: docs/tickets#46)As for the rest of the PR - can we merge now or is there something still missing?
@pbokoc wrote in #20 (comment):
Not to my knowledge 🙂. Just a version bump after merge.
Alright, cool, thank you everyone!