Skip to content

Conversation

@amery
Copy link
Contributor

@amery amery commented Jul 8, 2025

Summary

  • Enhances the build system with automated linting and quality checking tools
  • Adds comprehensive coverage reporting with dedicated CI/CD workflows
  • Improves code quality through spell checking, grammar checking, and Markdown linting
  • Implements separate CI workflows for build, test, and coverage concerns

Changes

Build System Enhancements

  • Coverage Reporting: New make coverage target that runs tests with coverage flags and generates reports
  • CSpell Integration: Spell checking for both Markdown and Go source files via make check-spelling
  • LanguageTool Integration: Grammar and style checking for documentation via make check-grammar
  • Markdownlint Integration: Automatic Markdown formatting and linting via make fmt
  • Whitespace Cleanup: New fix_whitespace.sh script that removes trailing whitespace and ensures proper EOF

CI/CD Integration

  • Codecov Workflow: Dedicated GitHub Actions workflow for coverage collection and reporting to Codecov
  • Test Workflow: Separate workflow for race detection and multi-Go version compatibility testing
  • Build Workflow: Streamlined workflow focused on compilation verification across Go versions
  • Proper separation of concerns: Resolves -race/-coverprofile incompatibility by using dedicated workflows

Configuration Files

  • internal/build/cspell.json: British English spell checking configuration with project-specific dictionary
  • internal/build/languagetool.cfg: Grammar checking rules for missing articles, punctuation, and hyphenation
  • internal/build/markdownlint.json: Markdown formatting rules with 80-character line limits and additional consistency rules

Documentation Updates

  • Enhanced AGENT.md with detailed build system documentation and pre-commit checklist
  • Updated README.md with new build targets and features
  • Fixed existing Markdown formatting issues

Test Plan

  • Verify make coverage generates coverage reports correctly
  • Test make check-spelling detects spelling errors
  • Test make check-grammar detects grammar issues
  • Verify make fmt fixes whitespace and Markdown formatting
  • Confirm all new tools integrate properly with make tidy
  • Ensure CI/CD workflows run successfully with proper separation of concerns
  • Verify race detection works independently of coverage collection

Summary by CodeRabbit

New Features

  • Introduced automated grammar, spelling, and markdown style checks integrated into the build process.
  • Added comprehensive test coverage support, including scripts for generating and merging coverage reports.
  • Implemented separate GitHub Actions workflows for build, test, and coverage reporting with proper separation of concerns.

Documentation

  • Expanded documentation with detailed instructions for new build tools, coverage workflow, and pre-commit checklist.
  • Improved formatting and readability in documentation files.

Chores

  • Added configuration files for spell checking, grammar checking, and markdown linting.
  • Updated .gitignore to exclude coverage and test artefacts.
  • Enhanced Makefile with new targets for coverage, grammar, and spelling checks.
  • Added scripts for whitespace clean-up and coverage aggregation.
  • Minor formatting improvements and newline consistency in configuration files.
  • Configured static analysis exclusions and shell dialect settings for POSIX shell scripts.

@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Walkthrough

This update introduces automated style, grammar, and spelling checks to the build process, adds test coverage tooling and reporting, and enhances documentation to explain these workflows. New scripts and configuration files support markdown linting, spell checking, grammar validation, and Go coverage aggregation. The Makefile and documentation are updated to integrate and describe these features.

Changes

File(s) Change Summary
.github/workflows/codecov.yml Added a GitHub Actions workflow to run Go tests with coverage and upload results to Codecov on pushes and PRs to main.
.github/workflows/build.yml Removed the test step from the build workflow.
.github/workflows/test.yml Added a new GitHub Actions workflow for running tests with race detection and multi-version Go testing on push and PR events, excluding WIP branches.
.gitignore Updated to ignore coverage output files (coverage.out, coverage.html) and .test files.
.deepsource.toml Added global exclusion patterns for test files and .tmp directories; excluded a specific DeepSource shell script issue; specified shell dialect as "sh"; added newline at end of file.
AGENT.md Expanded documentation on build system features, added sections for automated whitespace, grammar, spelling, markdown linting, and coverage integration. Updated pre-commit checklist.
README.md Improved formatting and line breaks for clarity in several documentation sections.
Makefile Added new phony targets for grammar and spelling checks, and coverage. Integrated markdown linting, whitespace fixing, and conditional checks. Enhanced fmt and tidy targets. Added variables for tool commands and flags.
internal/build/cspell.json Added cspell configuration with British English, custom dictionary, and ignored paths for spell checking.
internal/build/languagetool.cfg Added LanguageTool configuration disabling conflicting rules and enabling grammar/style checks for British English.
internal/build/markdownlint.json Added markdownlint configuration with custom line length limits and allowed HTML tags.
internal/build/fix_whitespace.sh Added a new script to fix trailing whitespace and ensure EOF newlines in files, supporting both explicit and find modes.
internal/build/gen_mk.sh Modified to allow passing extra flags (GOTEST_FLAGS) to the Go test command for dynamic test configuration.
internal/build/make_coverage.sh Added a script to automate running Go test coverage across modules, aggregate results, and generate summary and HTML reports.
.vscode/settings.json Added "MORFOLOGIK" to the custom spell checker words list.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Make as Makefile
    participant Lint as Lint/Check Tools
    participant Test as Go Test & Coverage Scripts
    participant CI as GitHub Actions

    Dev->>Make: make tidy
    Make->>Lint: Run whitespace, markdown, grammar, spelling checks
    Lint-->>Make: Return results
    Dev->>Make: make coverage
    Make->>Test: Run make_coverage.sh (per-module)
    Test->>Test: Aggregate coverage profiles
    Test->>Make: Output coverage.out and coverage.html
    CI->>Make: Trigger on push/PR
    Make->>Test: Run tests and coverage
    Test->>CI: Upload coverage to Codecov
Loading

Suggested reviewers

  • karasz

Poem

In the warren where code is neat,
Linting tools now hop on fleet.
Spelling, grammar, whitespace too,
All get checked before we're through.
Coverage bunnies leap and bound,
Reports and scripts are all around—
Our codebase shines, so safe and sound! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pr-amery-buildsys

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@deepsource-io
Copy link

deepsource-io bot commented Jul 8, 2025

Here's the code health analysis summary for commits c4a1c11..18b920f. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource Shell LogoShell✅ SuccessView Check ↗
DeepSource Go LogoGo✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@amery amery requested a review from karasz July 8, 2025 17:33
@amery amery added the enhancement New feature or request label Jul 8, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (12)
internal/build/cspell.json (2)

5-50: Deduplicate mixed-case entries to cut down noise in reports

PNPX/pnpx and Strs/strs are listed twice, only differing by capitalisation.
Unless you intentionally want both cases whitelisted, keep a single, lower-case variant – cspell treats the list case-sensitively, so the second entry is redundant.

-    "PNPX",
-    "pnpm",
-    "pnpx",
+    "pnpm",
+    "pnpx",-    "Strs",
-    "strs",
+    "strs",

51-58: Consider ignoring generated coverage artefacts here as well

coverage.out / coverage.html are now produced by make coverage; adding them to ignorePaths prevents cspell from scanning large blobs of data when the developer forgets to clean the working tree.

     "vendor"
+    ,"coverage.out"
+    ,"coverage.html"
internal/build/languagetool.cfg (1)

5-15: Rule list is hard to maintain – format one-per-line

A comma-separated list makes future diffs painful. Place each rule on its own line; LanguageTool accepts multi-line TOML/INI values.

-disabledRules = COMMA_PARENTHESIS_WHITESPACE,ARROWS,EN_QUOTES,MORFOLOGIK_RULE_EN_GB,UPPERCASE_SENTENCE_START
+disabledRules = \
+  COMMA_PARENTHESIS_WHITESPACE, \
+  ARROWS, \
+  EN_QUOTES, \
+  MORFOLOGIK_RULE_EN_GB, \
+  UPPERCASE_SENTENCE_START
internal/build/markdownlint.json (1)

15-26: Add commonly-recommended rules to catch list / heading quirks

Rules such as MD007 (indentation of nested lists) and MD046 (code-block style) help keep docs consistent and are inexpensive to adopt.

   "MD041": true,
-  "MD047": true
+  "MD046": true,
+  "MD047": true,
+  "MD007": { "indent": 2 }
 }
.deepsource.toml (1)

9-11: Nit: quote the import root to avoid accidental interpretation

Although TOML allows bare strings, wrapping the module path in quotes avoids issues if a future ref adds dots or dashes.

-import_root = "github.com/darvaza-proxy/core"
+import_root = "github.com/darvaza-proxy/core"
.github/workflows/codecov.yml (1)

20-24: Race detector + atomic cover mode doubles instrumentation

Running -race together with -covermode=atomic increases compile times and
memory; if you only need coverage for Codecov consider dropping -race here
and keep it in a separate fast-fail job.

internal/build/fix_whitespace.sh (2)

32-33: Sub-shell assigns + multiple stat variants – quote and split safely

The combined command substitution masks errors and fails Shellcheck. Simplify
and quote to avoid word-splitting.

-    size=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file" 2>/dev/null)
+    if size=$(stat -c%s -- "$file" 2>/dev/null); then :; \
+    elif size=$(stat -f%z -- "$file" 2>/dev/null); then :; \
+    else size=0; fi

40-42: xxd is not guaranteed present

Minimal containers often lack xxd. Use od or fallback to printf.

-    if [ "$(tail -c 1 "$file" | xxd -p)" != "0a" ]; then
+    last_byte=$(tail -c 1 "$file" | od -An -tx1 | tr -d ' \n')
+    if [ "$last_byte" != "0a" ]; then
AGENT.md (1)

162-168: Minor style inconsistency

Bullets after line 167 mix sentence-ending periods with none. For the strict
Markdownlint rule added, end every list item with a period.

internal/build/make_coverage.sh (1)

23-25: Unused loop fields trigger Shellcheck warnings

dir, mod, and deps are parsed but never referenced, producing SC2034. Either prefix with an underscore or omit them.

-while IFS=: read -r name dir mod deps; do
+while IFS=: read -r name _dir _mod _deps; do
Makefile (2)

136-138: Coverage artefacts are written to repo root

make_coverage.sh always emits coverage.out (and optionally coverage.html) in the working directory, but we invoke it with $(TMPDIR)/coverage as the output folder.
The mixed locations complicate cleanup and the .gitignore already ignores coverage.out at the root level, which now becomes stale for local runs.

Pass an explicit output file path or push coverage.out into $(TMPDIR)/coverage to keep artefacts together.


80-85: Unnecessary subshell for file lists

$(shell find …) is executed every make invocation and slows the graph even for unrelated targets. Consider computing the lists lazily or caching them in .tmp, similar to the index generation.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4a1c11 and 9b8dc38.

📒 Files selected for processing (12)
  • .deepsource.toml (1 hunks)
  • .github/workflows/codecov.yml (1 hunks)
  • .gitignore (1 hunks)
  • AGENT.md (5 hunks)
  • Makefile (4 hunks)
  • README.md (3 hunks)
  • internal/build/cspell.json (1 hunks)
  • internal/build/fix_whitespace.sh (1 hunks)
  • internal/build/gen_mk.sh (1 hunks)
  • internal/build/languagetool.cfg (1 hunks)
  • internal/build/make_coverage.sh (1 hunks)
  • internal/build/markdownlint.json (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
README.md (2)
Learnt from: amery
PR: darvaza-proxy/core#105
File: sync.go:11-12
Timestamp: 2025-04-17T20:14:08.093Z
Learning: In the darvaza.org/core module, the SpinLock type is being deprecated in favor of darvaza.org/x/sync/spinlock. The implementation must remain in place (not an alias) to avoid circular dependencies, as the new package likely imports from core.
Learnt from: amery
PR: darvaza-proxy/core#82
File: errors.go:22-23
Timestamp: 2024-10-11T13:59:15.993Z
Learning: `ErrNilReceiver`, defined in `errors.go`, is intended for use by other packages even if it's not used within the current codebase.
internal/build/gen_mk.sh (2)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
internal/build/fix_whitespace.sh (1)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
AGENT.md (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
internal/build/make_coverage.sh (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
🧬 Code Graph Analysis (1)
internal/build/make_coverage.sh (1)
internal/build/gen_index.sh (1)
  • mod (10-13)
🪛 Shellcheck (0.10.0)
internal/build/fix_whitespace.sh

[warning] 18-18: In POSIX sh, 'local' is undefined.

(SC3043)


[warning] 32-32: In POSIX sh, 'local' is undefined.

(SC3043)


[warning] 32-32: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 32-32: Quote this to prevent word splitting.

(SC2046)


[warning] 35-35: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).

(SC2188)

internal/build/make_coverage.sh

[warning] 23-23: dir appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 23-23: mod appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 23-23: deps appears unused. Verify use (or export if used externally).

(SC2034)

🔇 Additional comments (9)
internal/build/markdownlint.json (1)

4-14: 80-column hard limit may be too aggressive for code blocks

"strict": true combined with an 80-char limit will fail on Go import lines and long URLs. If the intention is to enforce 80 for prose only, disable code_blocks or raise the code_block_line_length.

.gitignore (1)

1-5: *.test may hide non-Go artefacts – double-check

The pattern will ignore every file ending in .test, not just Go test binaries.
If that breadth is unintended, prefer *.test.exe (Windows) / *.test produced by go test -c inside specific directories.

README.md (3)

181-182: Formatting-only change – looks good

Line break inserted around the Panic* helpers improves readability without altering semantics.


220-221: Consistent formatting retained

Bullet wraps cleanly at 80 chars; nothing further to flag.


272-273: Minor doc tweak OK

British-English spelling of “favour” retained; link renders fine.

internal/build/gen_mk.sh (1)

135-136: GOTEST_FLAGS injection is fine but quote to avoid word-splitting

If GOTEST_FLAGS ever contains multiple values with inner spaces (e.g.
"-coverpkg=./... -run TestFoo"), Make will expand them correctly, but the
shell re-parses the variable causing additional word-splitting. Wrap the
variable in double quotes to keep each flag group intact.

-        call="$(GO) $cmd $(GOTEST_FLAGS) ./..."
+        call="$(GO) $cmd $(GOTEST_FLAGS) ./..."
+        #                ^^^^^^^^^^^^^^^
+# alternatively, honour internal spaces
+# call="$(GO) $cmd $(strip $(GOTEST_FLAGS)) ./..."
⛔ Skipped due to learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
.github/workflows/codecov.yml (1)

15-19: Targeting unreleased Go 1.23 may break CI

actions/setup-go@v5 will fall back to the latest stable version it can find,
but pinning to 1.23 makes the workflow fragile until 1.23 is actually on the
download servers. Prefer the latest released minor or a version matrix.

-        go-version: '1.23'
+        # Use latest stable or test against several versions
+        go-version: '1.22.x'
+#     matrix:
+#       go-version: [ '1.21.x', '1.22.x' ]
internal/build/fix_whitespace.sh (1)

16-24: local is not POSIX; script breaks on /bin/sh (dash, busybox, …)

#!/bin/sh promises POSIX; local is a bash/ksh extension. On systems where
sh is dash the function exits with “local: not found”.

-fix_file() {
-    local file="$1"
+fix_file() {
+    file=$1
⛔ Skipped due to learnings
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-08T15:33:35.792Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-01T15:48:48.786Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
internal/build/make_coverage.sh (1)

42-46: Command-line length may explode on many modules

gocovmerge $coverage_files expands the entire list into one argument vector; with hundreds of modules you risk “Argument list too long”. Use xargs (supported by gocovmerge) to stream the list.

-    gocovmerge $coverage_files > coverage.out
+    printf '%s\n' $coverage_files | xargs gocovmerge > coverage.out

@amery amery force-pushed the pr-amery-buildsys branch 2 times, most recently from 305031b to bbf9ddc Compare July 8, 2025 18:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

♻️ Duplicate comments (2)
internal/build/fix_whitespace.sh (1)

28-30: Repeat: sed -i without backup suffix is not portable
BSD sed (macOS) rejects -i with no argument. Earlier review already pointed this out.

internal/build/make_coverage.sh (1)

64-64: set -o pipefail not portable – see first comment
Secondary reminder that this line explodes under dash.

🧹 Nitpick comments (3)
internal/build/fix_whitespace.sh (1)

39-42: tail -c 1 is non-standard; rely on POSIX dd instead

- if [ -n "$(tail -c 1 "$file" 2>/dev/null)" ]; then
+ if dd if="$file" bs=1 skip=$((size-1)) count=1 2>/dev/null | grep -q '[^
]'; then

This keeps the script strictly POSIX.

internal/build/make_coverage.sh (1)

24-27: Word-splitting risk when reading module list
for name in $(cut …) splits on IFS; a module path containing spaces (rare but legal) would explode. Safer:

while IFS=: read -r name _; do
    [ -z "$name" ] && continuedone <"$INDEX"
Makefile (1)

107-112: Whitespace fixer will also touch generated artefacts
$(FIX_WHITESPACE_ARGS) defaults to . so it traverses $(TMPDIR) and .coverage, rewriting large auto-generated files and wasting CI time. Exclude build/output dirs:

-FIX_WHITESPACE_ARGS ?= . \! \( $(FIX_WHITESPACE_EXCLUDE) \)
+FIX_WHITESPACE_ARGS ?= . \( -path $(TMPDIR) -o -path .coverage \) -prune -o \! \( $(FIX_WHITESPACE_EXCLUDE) \)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 305031b and bbf9ddc.

📒 Files selected for processing (9)
  • .github/workflows/codecov.yml (1 hunks)
  • .gitignore (1 hunks)
  • AGENT.md (5 hunks)
  • Makefile (4 hunks)
  • internal/build/cspell.json (1 hunks)
  • internal/build/fix_whitespace.sh (1 hunks)
  • internal/build/languagetool.cfg (1 hunks)
  • internal/build/make_coverage.sh (1 hunks)
  • internal/build/markdownlint.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • .gitignore
  • internal/build/languagetool.cfg
  • .github/workflows/codecov.yml
  • internal/build/cspell.json
  • internal/build/markdownlint.json
  • AGENT.md
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Makefile (2)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
internal/build/fix_whitespace.sh (3)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
internal/build/make_coverage.sh (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
🪛 GitHub Actions: Test and Coverage
Makefile

[error] 137-137: Makefile target 'coverage' failed with exit code 2 due to shell script error.

internal/build/make_coverage.sh

[error] 64-64: Shell script error: 'set: Illegal option -o pipefail' causing coverage step failure.

🪛 Shellcheck (0.10.0)
internal/build/fix_whitespace.sh

[warning] 18-18: In POSIX sh, 'local' is undefined.

(SC3043)


[warning] 32-32: In POSIX sh, 'local' is undefined.

(SC3043)


[warning] 32-32: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 32-32: Quote this to prevent word splitting.

(SC2046)


[warning] 33-33: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.

(SC2166)


[warning] 35-35: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).

(SC2188)

internal/build/make_coverage.sh

[warning] 64-64: In POSIX sh, set option pipefail is undefined.

(SC3040)

🔇 Additional comments (2)
internal/build/fix_whitespace.sh (1)

16-22: local is non-POSIX – either switch to bash or drop it
#!/bin/sh promises a POSIX shell, yet local is a bash/ksh extension. On Debian/Ubuntu /bin/sh is dash, which will abort here.

-fix_file() {
-	local file="$1"
+fix_file() {
+file=$1      # POSIX-portable; no 'local'
⛔ Skipped due to learnings
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-08T15:33:35.792Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-01T15:48:48.786Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Makefile (1)

136-138: Coverage target fails because underlying script exits non-zero
Once make_coverage.sh is fixed (pipefail), CI should go green. No Makefile changes required.

@amery amery force-pushed the pr-amery-buildsys branch from bbf9ddc to de003c9 Compare July 8, 2025 18:36
@codecov
Copy link

codecov bot commented Jul 8, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
internal/build/fix_whitespace.sh (1)

26-28: sed -i is still non-portable on BSD/macOS
Previous reviews already flagged this. Please switch to a temp-file strategy or add the zero-length backup suffix to keep the script cross-platform.

-	sed -i 's/[[:space:]]*$//' "$file"
+	# Portable in-place edit (works with GNU and BSD sed)
+	sed -e 's/[[:space:]]*$//' "$file" >"$file.tmp" && mv "$file.tmp" "$file"
🧹 Nitpick comments (3)
internal/build/fix_whitespace.sh (2)

29-35: ShellCheck SC2188: redirect without command
Pure redirection is legal, but a no-op command (:) suppresses the warning and is self-documenting.

-		> "$file"
+		: > "$file"

14-15: Add pipefail for safer pipelines
set -euo pipefail prevents silent failures inside pipelines, especially important because the script pipes find | while ….

-set -eu
+set -euo pipefail
Makefile (1)

112-116: echo … | tr ' ' '\n' loses files containing spaces
Use NUL-delimited lists to be robust.

-	$Q echo "$(GO_FILES)" | tr ' ' '\n' | xargs -r $(GOFMT) $(GOFMT_FLAGS)
+	$Q printf '%s\0' $(GO_FILES) | xargs -r -0 $(GOFMT) $(GOFMT_FLAGS)-	$Q echo "$(MARKDOWN_FILES)" | tr ' ' '\n' | xargs -r $(MARKDOWNLINT) $(MARKDOWNLINT_FLAGS)
+	$Q printf '%s\0' $(MARKDOWN_FILES) | xargs -r -0 $(MARKDOWNLINT) $(MARKDOWNLINT_FLAGS)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bbf9ddc and de003c9.

📒 Files selected for processing (9)
  • .github/workflows/codecov.yml (1 hunks)
  • .gitignore (1 hunks)
  • AGENT.md (5 hunks)
  • Makefile (4 hunks)
  • internal/build/cspell.json (1 hunks)
  • internal/build/fix_whitespace.sh (1 hunks)
  • internal/build/languagetool.cfg (1 hunks)
  • internal/build/make_coverage.sh (1 hunks)
  • internal/build/markdownlint.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • .gitignore
  • .github/workflows/codecov.yml
  • internal/build/cspell.json
  • internal/build/markdownlint.json
  • internal/build/languagetool.cfg
  • AGENT.md
  • internal/build/make_coverage.sh
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Makefile (1)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
internal/build/fix_whitespace.sh (5)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-08T15:33:35.792Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-01T15:48:48.786Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
🪛 Shellcheck (0.10.0)
internal/build/fix_whitespace.sh

[warning] 18-18: In POSIX sh, 'local' is undefined.

(SC3043)


[warning] 33-33: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).

(SC2188)

🔇 Additional comments (1)
Makefile (1)

81-86: find outputs captured at parse-time may go stale
Because MARKDOWN_FILES and GO_FILES are expanded when make parses the file, newly-created files during the same run (e.g. by code-generation) will be missed. Consider computing the lists inside the recipe instead of with $(shell …) or add dependencies forcing a second pass.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de003c9 and a9867cf.

📒 Files selected for processing (1)
  • .deepsource.toml (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
.deepsource.toml (1)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
🔇 Additional comments (2)
.deepsource.toml (2)

3-8: exclude_patterns entry may miss the most common Go test files

The glob **/*.test excludes files literally ending with .test, but Go unit-test sources are named *_test.go.
If the intent is to keep Go tests out of static analysis you probably need an additional pattern, e.g.

 exclude_patterns = [
   "**/*.test",
+  "**/*_test.go",
   ".tmp/**",
 ]

Otherwise Go test files will still be inspected by DeepSource.


18-21: Dialect tag is useful but redundant for .sh extensions

Shell files already default to POSIX-sh dialect when the extension is .sh.
Keeping the explicit dialect = "sh" is harmless, but if you maintain mixed dialects (bash, dash, busybox) consider directory-specific overrides rather than a single global setting.

@amery amery force-pushed the pr-amery-buildsys branch 2 times, most recently from b5e15f3 to 65c0def Compare July 8, 2025 19:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (6)
AGENT.md (3)

17-20: Conflicting minimum-Go version requirements
The prerequisites section lists “Go 1.22 or later” while the “Important Notes” section says “Go 1.23 is the minimum required version.” Please settle on a single version to avoid confusing contributors (and CI images).

- - Go 1.22 or later installed (check with `go version`).
+ - Go 1.23 or later installed (check with `go version`).- - Go 1.23 is the minimum required version.
+ - Go 1.23 is the minimum required version.   <!-- keep only one statement -->

Also applies to: 152-154


31-42: Mention GOTEST_FLAGS explicitly
The examples show make test GOTEST_FLAGS="-cover"/-v, which is great, but AGENT.md never explains what GOTEST_FLAGS is or where it is honoured. Add a short one-liner so users know this is a passthrough to go test.


195-200: Bullet-list formatting is inconsistent with the documented standards
Here the Markdown bullets end without periods, whereas earlier you state that list items must end with a full stop. Either remove that rule or add the missing punctuation for self-consistency.

Makefile (3)

32-39: Version detection for markdownlint may fail on “v0.” output**
grep -q '^[0-9]' matches “0.35.0” but not the more common “v0.35.0”. Consider stripping a leading “v” or loosening the regex to avoid false negatives that silently disable linting.

-ifeq ($(shell $(PNPX) markdownlint-cli --version 2>&1 | grep -q '^[0-9]' && echo yes),yes)
+ifeq ($(shell $(PNPX) markdownlint-cli --version 2>&1 | sed 's/^v//' | grep -q '^[0-9]' && echo yes),yes)

81-86: find expression will not skip nested vendor/ paths
-name vendor -prune only matches a directory literally called “vendor” at the current depth; a nested path like internal/vendor slips through. Using -path '*/vendor' is safer.

-MARKDOWN_FILES = $(shell find . \( -name vendor -o -name .git \) -prune -o -name '*.md' -print)
-GO_FILES       = $(shell find . \( -name vendor -o -name .git \) -prune -o -name '*.go' -print)
+MARKDOWN_FILES = $(shell find . \( -path '*/vendor' -o -path '*/.git' \) -prune -o -name '*.md' -print)
+GO_FILES       = $(shell find . \( -path '*/vendor' -o -path '*/.git' \) -prune -o -name '*.go' -print)

112-116: fmt target will mis-format if GO_FILES is empty
echo "$(GO_FILES)" | tr ' ' '\n' emits a blank line, causing xargs to invoke gofmt with an empty argument list (error = 1). Guard with a test or use printf '%s\0' + xargs -0.

-	$Q echo "$(GO_FILES)" | tr ' ' '\n' | xargs -r $(GOFMT) $(GOFMT_FLAGS)
+	$Q printf '%s\0' $(GO_FILES) | xargs -0 -r $(GOFMT) $(GOFMT_FLAGS)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5e15f3 and 65c0def.

📒 Files selected for processing (8)
  • .deepsource.toml (1 hunks)
  • .github/workflows/codecov.yml (1 hunks)
  • .gitignore (1 hunks)
  • AGENT.md (5 hunks)
  • Makefile (4 hunks)
  • internal/build/cspell.json (1 hunks)
  • internal/build/languagetool.cfg (1 hunks)
  • internal/build/make_coverage.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • .gitignore
  • .deepsource.toml
  • internal/build/languagetool.cfg
  • .github/workflows/codecov.yml
  • internal/build/cspell.json
  • internal/build/make_coverage.sh
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
AGENT.md (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Makefile (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
🪛 LanguageTool
AGENT.md

[style] ~246-~246: Consider using a different verb for a more formal wording.
Context: ...markdownlint - If make tidy fails, fix the issues and run it again until it pa...

(FIX_RESOLVE)


[uncategorized] ~263-~263: Possible missing comma found.
Context: .... DeepSource shell issues: - Use ShellCheck disable comments for specific lines. ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~263-~263: Possible missing preposition found.
Context: ...rce shell issues**: - Use ShellCheck disable comments for specific lines. - Updat...

(AI_HYDRA_LEO_MISSING_TO)

🔇 Additional comments (1)
Makefile (1)

10-10: GOTEST_FLAGS declared but never used in this Makefile
The variable is defined yet nothing in this file references it; usage presumably lives in gen.mk. If that’s intentional, add a comment here; otherwise wire it into the top-level test/coverage targets to avoid a dead configuration knob.

amery added 4 commits July 8, 2025 21:06
…eyword

- Set shell dialect to 'sh' for POSIX compliance
- Add exclusion for SH-1091 (local keyword in POSIX sh)
- Exclude .tmp/** and test files from analysis

This reduces false positives while maintaining code quality checks for
the shell scripts that use common but non-POSIX extensions like the
'local' keyword.

Signed-off-by: Alejandro Mery <amery@apptly.co>
Update AGENT.md and README.md to comply with 80-character line length
limit enforced by the improved markdownlint configuration.

Signed-off-by: Alejandro Mery <amery@apptly.co>
Signed-off-by: Alejandro Mery <amery@apptly.co>
Add GOTEST_FLAGS variable to enable coverage testing, verbose output,
and test binary building. Update gen_mk.sh to pass flags to go test
command and document usage in AGENT.md.

Also add *.test to .gitignore to exclude test binaries from version
control.

Signed-off-by: Alejandro Mery <amery@apptly.co>
@amery amery force-pushed the pr-amery-buildsys branch from 65c0def to 712f916 Compare July 8, 2025 21:07
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
internal/build/fix_whitespace.sh (1)

27-27: Non-portable sed -i usage remains
GNU sed -i without a backup suffix breaks on BSD/macOS. The earlier review already highlighted this; the command is still unchanged.

-	sed -i 's/[[:space:]]*$//' "$file"
+	# Portable in-place edit
+	sed -e 's/[[:space:]]*$//' "$file" >"$file.tmp" && mv "$file.tmp" "$file"
🧹 Nitpick comments (4)
internal/build/fix_whitespace.sh (1)

30-35: ShellCheck SC2188 – redirect with no command
> "$file" works, but triggers SC2188. A tiny no-op keeps linters quiet and is clearer.

-		> "$file"
+		: >"$file"   # truncate file
Makefile (2)

30-38: Tool-detection shell calls fail hard when pnpx is absent
If pnpx is missing, $(shell $(PNPX)… ) prints “pnpx: command not found” to stderr during the parse phase, polluting CI logs. Wrap the test to silence the error:

-ifeq ($(shell $(PNPX) markdownlint-cli --version 2>&1 | grep -q '^[0-9]' && echo yes),yes)
+ifeq ($(shell command -v $(PNPX) >/dev/null 2>&1 && $(PNPX) markdownlint-cli --version 2>/dev/null | grep -q '^[0-9]' && echo yes),yes)

112-116: xargs without -0 may mis-handle unusual filenames
Follow-up to the previous point: switch to null-terminated streams.

-	$Q echo "$(GO_FILES)" | tr ' ' '\n' | xargs -r $(GOFMT) $(GOFMT_FLAGS)
+	$Q printf '%s\0' $(GO_FILES) | xargs -0 -r $(GOFMT) $(GOFMT_FLAGS)

Same for the markdownlint invocation.

AGENT.md (1)

304-307: Minor style: imperative mood for checklist
Use imperative verbs consistently (e.g., “Run make tidy”, “Fix all issues”) to match other checklist items.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65c0def and 712f916.

📒 Files selected for processing (12)
  • .deepsource.toml (1 hunks)
  • .github/workflows/codecov.yml (1 hunks)
  • .gitignore (1 hunks)
  • AGENT.md (5 hunks)
  • Makefile (4 hunks)
  • README.md (3 hunks)
  • internal/build/cspell.json (1 hunks)
  • internal/build/fix_whitespace.sh (1 hunks)
  • internal/build/gen_mk.sh (1 hunks)
  • internal/build/languagetool.cfg (1 hunks)
  • internal/build/make_coverage.sh (1 hunks)
  • internal/build/markdownlint.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • .gitignore
  • .deepsource.toml
  • internal/build/cspell.json
  • internal/build/languagetool.cfg
  • .github/workflows/codecov.yml
  • internal/build/gen_mk.sh
  • internal/build/markdownlint.json
  • internal/build/make_coverage.sh
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
AGENT.md (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Makefile (3)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
internal/build/fix_whitespace.sh (5)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-08T15:33:35.792Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-01T15:48:48.786Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
🪛 LanguageTool
AGENT.md

[style] ~306-~306: Consider using a different verb for a more formal wording.
Context: ...markdownlint - If make tidy fails, fix the issues and run it again until it pa...

(FIX_RESOLVE)


[uncategorized] ~323-~323: Possible missing comma found.
Context: .... DeepSource shell issues: - Use ShellCheck disable comments for specific lines. ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~323-~323: Possible missing preposition found.
Context: ...rce shell issues**: - Use ShellCheck disable comments for specific lines. - Updat...

(AI_HYDRA_LEO_MISSING_TO)

🪛 Shellcheck (0.10.0)
internal/build/fix_whitespace.sh

[warning] 18-18: In POSIX sh, 'local' is undefined.

(SC3043)


[warning] 33-33: This redirection doesn't have a command. Move to its command (or use 'true' as no-op).

(SC2188)

🔇 Additional comments (2)
internal/build/fix_whitespace.sh (1)

38-40: tail -c 1 portability check
tail -c is POSIX, yet older BusyBox builds lack it. If Alpine images are part of CI, add a fallback:

if ! tail -c 1 "$file" >/dev/null 2>&1; then
    [ -n "$(dd if="$file" bs=1 count=1 2>/dev/null)" ] && printf '\n' >>"$file"
fi
Makefile (1)

105-108: Hard dependency on jq without guard
If jq is missing locally, make tidy fails early. Emit a clearer message and hint:

$(JQ):
	$(error "jq not found – install it or set JQ to an alternative JSON parser")

or switch to POSIX grep/sed pipeline for simple extraction.

@amery
Copy link
Contributor Author

amery commented Jul 8, 2025

Tool-detection shell calls fail hard when pnpx is absent\nIf pnpx is missing, $(shell $(PNPX)… ) prints “pnpx: command not found” to stderr during the parse phase, polluting CI logs. Wrap the test to silence the error:

wouldn't the 2>&1 | grep take care of that noise? @coderabbitai

@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Examine the Makefile to understand how pnpx is used for tool detection
cat Makefile | grep -A 5 -B 5 "pnpx\|PNPX\|shell.*markdownlint\|shell.*languagetool\|shell.*cspell"

Length of output: 1121


@amery You're absolutely right! Looking at the current implementation in the Makefile, the 2>&1 | grep pattern does indeed handle that stderr noise effectively.

The current tool detection pattern:

ifeq ($(shell $(PNPX) markdownlint-cli --version 2>&1 | grep -q '^[0-9]' && echo yes),yes)

Works as follows when pnpx is missing:

  1. $(PNPX) markdownlint-cli --version outputs "pnpx: command not found" to stderr
  2. 2>&1 redirects stderr to stdout, so the error message becomes part of the pipeline
  3. | grep -q '^[0-9]' searches for a version number pattern but finds the error message instead
  4. grep fails to match, so && echo yes doesn't execute
  5. The $(shell ...) returns empty string, making the ifeq condition false
  6. The tool gets set to true (no-op command)

The grep -q is particularly effective here because:

  • It's quiet (no output regardless of match/no-match)
  • It consumes and discards the stderr content that was redirected
  • It provides a clean boolean-like result for the conditional

So the stderr pollution is effectively silenced, and the build system gracefully degrades to using true as a no-op when the tools aren't available. The current implementation should work cleanly in CI environments even when pnpx is absent.


🧠 Learnings used
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.

@amery amery changed the title feat(build): enhance build system with linting and coverage tools feat(build): enhance build system with linting, coverage, and CI workflows Jul 9, 2025
@amery amery force-pushed the pr-amery-buildsys branch from 712f916 to 34146ed Compare July 9, 2025 17:42
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
internal/build/fix_whitespace.sh (1)

24-24: sed -i is still GNU-specific – portability issue already raised
Using sed -i without an explicit backup suffix breaks on BSD/macOS sed. Please adopt a portable inplace edit (e.g. sed -e … >"$file.tmp" && mv "$file.tmp" "$file" or sed -i '' …) to keep the script cross-platform.

🧹 Nitpick comments (3)
internal/build/fix_whitespace.sh (2)

18-18: Unused variable size – remove to avoid dead-code noise
size is declared but never read. Shell-check already flags this (SC2034).

-local file="$1" last_byte size
+local file="$1" last_byte

37-37: Quote arithmetic operand to silence SC2046
Wrap the command substitution so word-splitting can’t occur (tiny but keeps static analysis clean).

-elif [ $(wc -c < "$file") -eq 1 ]; then
+elif [ "$(wc -c <"$file")" -eq 1 ]; then
AGENT.md (1)

254-259: Inconsistent bullet-point punctuation
For consistency with earlier bullets, end each item with a full stop:

-When editing Markdown files, ensure compliance with:
+When editing Markdown files, ensure compliance with:

…and add periods to the sub-bullets if missing.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 712f916 and 34146ed.

📒 Files selected for processing (12)
  • .github/workflows/build.yml (0 hunks)
  • .github/workflows/codecov.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • .gitignore (1 hunks)
  • .vscode/settings.json (1 hunks)
  • AGENT.md (5 hunks)
  • Makefile (4 hunks)
  • internal/build/cspell.json (1 hunks)
  • internal/build/fix_whitespace.sh (1 hunks)
  • internal/build/languagetool.cfg (1 hunks)
  • internal/build/make_coverage.sh (1 hunks)
  • internal/build/markdownlint.json (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/build.yml
✅ Files skipped from review due to trivial changes (2)
  • .vscode/settings.json
  • .github/workflows/test.yml
🚧 Files skipped from review as they are similar to previous changes (6)
  • .gitignore
  • .github/workflows/codecov.yml
  • internal/build/languagetool.cfg
  • internal/build/cspell.json
  • internal/build/markdownlint.json
  • internal/build/make_coverage.sh
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
AGENT.md (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Makefile (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
internal/build/fix_whitespace.sh (5)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-08T15:33:35.792Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-01T15:48:48.786Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
🪛 LanguageTool
AGENT.md

[style] ~306-~306: Consider using a different verb for a more formal wording.
Context: ...markdownlint - If make tidy fails, fix the issues and run it again until it pa...

(FIX_RESOLVE)


[uncategorized] ~323-~323: Possible missing comma found.
Context: .... DeepSource shell issues: - Use ShellCheck disable comments for specific lines. ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~323-~323: Possible missing preposition found.
Context: ...rce shell issues**: - Use ShellCheck disable comments for specific lines. - Updat...

(AI_HYDRA_LEO_MISSING_TO)

🪛 Shellcheck (0.10.0)
internal/build/fix_whitespace.sh

[warning] 18-18: In POSIX sh, 'local' is undefined.

(SC3043)


[warning] 18-18: size appears unused. Verify use (or export if used externally).

(SC2034)


[warning] 37-37: Quote this to prevent word splitting.

(SC2046)

🔇 Additional comments (1)
Makefile (1)

59-76: FIX_WHITESPACE_EXCLUDE yields an initial -o, breaking the find expression
When the first exclusion list expands empty ($(FIX_WHITESPACE_EXCLUDE_GO) can be blank), the generated expression starts with -o, making find fail. Guard with $(strip …) or prepend a dummy always-false test.

@amery amery force-pushed the pr-amery-buildsys branch 2 times, most recently from 86b2cbf to d0aba20 Compare July 9, 2025 18:12
amery added 2 commits July 9, 2025 18:13
…ndling

Add a new build tool that automatically removes trailing whitespace and
ensures files end with a newline. The script supports both find-based
searching and explicit file arguments, with automatic exclusion of
binary files and version control directories.

Integrated into the make fmt target to handle all non-Go text files,
while Go files continue to be processed by gofmt.

Signed-off-by: Alejandro Mery <amery@apptly.co>
Add markdownlint-cli support with comprehensive configuration for
enforcing consistent markdown formatting. The configuration includes:
- 80 character line length limits
- Strict formatting rules for headings, lists, and code blocks
- Selective HTML element allowlist for necessary formatting
- Automatic fixes during make fmt

Integration features:
- Automatic detection of markdownlint-cli via pnpx
- File discovery with vendor/git exclusion
- Conditional execution only when tool is available

Signed-off-by: Alejandro Mery <amery@apptly.co>
amery added 7 commits July 9, 2025 18:13
Add CSpell integration for automated spell checking of both Markdown
documentation and Go source code comments. Configuration includes:
- British English language checking
- Custom word list for project-specific terminology
- Integration with make tidy for automated checking
- Support for checking both .md and .go files

The check-spelling target runs conditionally when CSpell is available
via pnpx, providing comprehensive spell checking without requiring
tool installation.

Signed-off-by: Alejandro Mery <amery@apptly.co>
Add LanguageTool integration for automated grammar and style checking
of both markdown documentation and Go code comments. Configuration
includes:
- British English language checking
- Disabled rules that conflict with technical documentation
- Enabled rules for common grammar issues
- Integration with make tidy for automated checking

The check-grammar target runs conditionally when LanguageTool is
available via pnpx, providing non-intrusive quality checks without
requiring tool installation.

Signed-off-by: Alejandro Mery <amery@apptly.co>
- Add make_coverage.sh script that runs tests with coverage flags
- Add 'make coverage' target to generate coverage reports
- Update .gitignore to exclude coverage artifacts
- Update clean target to remove coverage files

Signed-off-by: Alejandro Mery <amery@apptly.co>
- Add dedicated test.yml workflow for race detection and multi-Go testing
- Remove test step from build.yml to avoid duplication
- Apply same branch restrictions and PR conditions as build workflow

This resolves the -race and -coverprofile incompatibility by separating
concerns: build workflow focuses on compilation, test workflow handles
race detection and compatibility testing across Go versions.

Signed-off-by: Alejandro Mery <amery@apptly.co>
Add GitHub Actions workflow to run tests with coverage and upload
results to Codecov. The workflow:
- Runs on push to main and pull requests
- Uses Go 1.23
- Executes make coverage with atomic coverage mode
- Uploads coverage.out to Codecov for tracking

Coverage collection uses -covermode=atomic without race detection
to avoid incompatibility between -race and -coverprofile flags.

Signed-off-by: Alejandro Mery <amery@apptly.co>
- Add DeepSource configuration troubleshooting section
- Add GitHub Actions and build tools documentation
- Emphasize running 'make tidy' before commits
- Add common issues and solutions for linting tools

Signed-off-by: Alejandro Mery <amery@apptly.co>
…mples

- Add benchmarking, short tests, and CPU count examples
- Document integration with make coverage target
- Provide targeted coverage analysis examples
- Clarify GOTEST_FLAGS as alternative to make coverage for fine control
- Add HTML coverage generation example

The enhanced documentation helps developers understand when to use
GOTEST_FLAGS versus make coverage and provides more practical examples
for common testing scenarios.

Signed-off-by: Alejandro Mery <amery@apptly.co>
@amery amery force-pushed the pr-amery-buildsys branch from d0aba20 to 18b920f Compare July 9, 2025 18:13
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
internal/build/fix_whitespace.sh (1)

23-25: sed -i still not portable

Previous review (see history) flagged this GNU-only invocation. BSD sed (macOS) requires a backup suffix: sed -i ''. Please switch to a portable temp-file pattern or vendor gsed.

🧹 Nitpick comments (1)
AGENT.md (1)

254-259: Minor consistency nit – bullet list wording

Line 256 starts with “LanguageTool” while the following bullets use an en-dash and lower-case verbs; consider aligning all three bullets for uniform style.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34146ed and 18b920f.

📒 Files selected for processing (12)
  • .github/workflows/build.yml (0 hunks)
  • .github/workflows/codecov.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • .gitignore (1 hunks)
  • .vscode/settings.json (1 hunks)
  • AGENT.md (5 hunks)
  • Makefile (4 hunks)
  • internal/build/cspell.json (1 hunks)
  • internal/build/fix_whitespace.sh (1 hunks)
  • internal/build/languagetool.cfg (1 hunks)
  • internal/build/make_coverage.sh (1 hunks)
  • internal/build/markdownlint.json (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/build.yml
🚧 Files skipped from review as they are similar to previous changes (9)
  • .vscode/settings.json
  • .gitignore
  • internal/build/cspell.json
  • internal/build/languagetool.cfg
  • .github/workflows/test.yml
  • internal/build/markdownlint.json
  • .github/workflows/codecov.yml
  • internal/build/make_coverage.sh
  • Makefile
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
AGENT.md (3)
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
internal/build/fix_whitespace.sh (5)
Learnt from: karasz
PR: darvaza-proxy/core#74
File: internal/build/get_version.sh:21-30
Timestamp: 2024-10-01T08:39:29.235Z
Learning: In `get_version.sh`, focus on addressing necessary changes, such as Shellcheck warnings, and avoid suggesting optional readability improvements or stylistic changes unless they address critical issues.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-08T15:33:35.792Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#79
File: internal/build/gen_mk.sh:161-169
Timestamp: 2024-10-01T19:43:25.764Z
Learning: When suggesting refactoring of build scripts, consider the possibility of nested `go.mod` files within subdirectories like `./cmd/`, and ensure that the proposed changes handle nested modules correctly.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-08T15:33:35.792Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
Learnt from: amery
PR: darvaza-proxy/core#75
File: internal/build/get_version.sh:0-0
Timestamp: 2024-10-01T15:48:48.786Z
Learning: In this project, the use of the `local` keyword and `-a` in the `test` command is acceptable in shell scripts, and POSIX compliance is not a concern.
🪛 LanguageTool
AGENT.md

[style] ~306-~306: Consider using a different verb for a more formal wording.
Context: ...markdownlint - If make tidy fails, fix the issues and run it again until it pa...

(FIX_RESOLVE)


[uncategorized] ~323-~323: Possible missing comma found.
Context: .... DeepSource shell issues: - Use ShellCheck disable comments for specific lines. ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~323-~323: Possible missing preposition found.
Context: ...rce shell issues**: - Use ShellCheck disable comments for specific lines. - Updat...

(AI_HYDRA_LEO_MISSING_TO)

🪛 Shellcheck (0.10.0)
internal/build/fix_whitespace.sh

[warning] 18-18: In POSIX sh, 'local' is undefined.

(SC3043)

Copy link
Contributor

@karasz karasz left a comment

Choose a reason for hiding this comment

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

LGTM, ads a lot of polish to core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants