Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add style check for doc comments #2575

Merged
merged 2 commits into from
Dec 9, 2023

Conversation

Akmadan23
Copy link
Collaborator

Discussed in #2555 (comment)

@@ -0,0 +1,16 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always try to use /bin/sh after I caused a shell compatibility production incident 20 years ago.

However, we need bash features here and we know that CI provides bash so we are OK.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you insist on sh (it's fine either way):

#!/bin/sh

out=$(grep -nr "^--- @" lua)

if [ "$out" ]; then
	last_file=""
	printf %s "$out" | while read -r line; do
		file="$(echo "$line" | cut -d: -f1)"
		if [ "$file" != "$last_file" ]; then
			echo "$file:" >&2
			last_file="$file"
		fi
		echo "$line" | awk -F: '{ printf("  line %s: %s\n", $2, $3) }' >&2
	done
	exit 1
fi

Copy link
Member

@alex-courtis alex-courtis Dec 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely, shellcheck is happy.

TIL print pipe into while

Edit: let's just go with bash; I'm being finicky

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fails nicely.

shellcheck 👍

We're going to need to fix all these before we can merge: find lua -type f -exec sed -i 's/^--- @/---@/g' {} \;

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI all passing now

@alex-courtis alex-courtis merged commit 2fed5e1 into master Dec 9, 2023
@alex-courtis alex-courtis deleted the ci-check-doc-comments-style branch December 9, 2023 01:06
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