Skip to content

Conversation

@vanlueckn
Copy link

@vanlueckn vanlueckn commented Jan 24, 2026

This resolves issue #146

The toml parser uses the aleady existing indirect dependency and promotes it to a direct depencency.

The logic reuses the json parser logic.

I added it because i need toml parsing for some games.

Summary by CodeRabbit

  • New Features
    • Added TOML configuration file support, allowing the application to parse, modify, and persist configuration data in TOML format alongside existing formats.

✏️ Tip: You can customize this high-level summary in your review settings.

@vanlueckn vanlueckn requested a review from a team as a code owner January 24, 2026 22:42
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

The pull request adds TOML configuration file support by promoting the go-toml library from an indirect to a direct dependency and implementing TOML parsing logic that reads TOML files, converts them to JSON for processing, and writes results back to TOML format.

Changes

Cohort / File(s) Summary
Dependency Management
go.mod
Converts pelletier/go-toml/v2 and golang.org/x/time from indirect to direct dependencies by removing // indirect annotations
TOML Parser Implementation
parser/parser.go
Adds TOML parsing support: new Toml constant, imports go-toml library, introduces parseTomlFile method for TOML read-convert-process-write flow, and updates Parse switch statement to route TOML files to the new parser

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A TOML file hops into the parser's den,
Donning JSON robes, then back again!
The go-toml library now claims its place,
Direct dependencies race with grace.
Configuration files dance—quite the feat! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change—adding TOML file parsing functionality—which is the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e20c4d and f2c0348.

📒 Files selected for processing (2)
  • go.mod
  • parser/parser.go
🧰 Additional context used
🧬 Code graph analysis (1)
parser/parser.go (1)
internal/ufs/file.go (1)
  • File (17-83)
🔇 Additional comments (6)
parser/parser.go (4)

17-17: LGTM!

The TOML library import follows the existing import pattern and uses a well-maintained library.


33-33: LGTM!

The constant follows the existing naming pattern for parser types.


232-233: LGTM!

The switch case correctly dispatches to the TOML parser, consistent with other parser type handlers.


476-517: Implementation follows established patterns correctly.

The function mirrors the YAML parser approach and correctly reuses IterateOverJson for value replacement. The error message on line 514 is properly updated for TOML context.

Note: The JSON round-trip conversion may affect TOML-specific data types (e.g., native datetime values become strings). This is acceptable given the parsing use case, but worth documenting if users encounter unexpected type coercion in configuration files with datetime fields.

go.mod (2)

164-164: The review comment is incorrect. golang.org/x/time is directly imported in the codebase:

  • router/websocket/limiter.go imports golang.org/x/time/rate
  • router/router_server_ws.go imports golang.org/x/time/rate

Since the module has direct imports, removing the // indirect marker is correct and necessary. Running go mod tidy should not re-add the marker.

Likely an incorrect or invalid review comment.


134-134: LGTM - Direct dependency correctly added for TOML support.

The pelletier/go-toml/v2 library is directly imported and used in parser/parser.go, so promoting it from indirect to direct dependency is correct.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@parkervcp parkervcp left a comment

Choose a reason for hiding this comment

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

LGTM. I can appreciate some code reuse.

@parkervcp
Copy link
Contributor

@vanlueckn If you want to make sure the build in the action for this works. I don't have anything that uses toml to est with.

if @Kotori0629 could also validate that would be good.

@vanlueckn
Copy link
Author

@vanlueckn If you want to make sure the build in the action for this works. I don't have anything that uses toml to est with.

if @Kotori0629 could also validate that would be good.

I will check the build and toml parsing in a few minutes. I have a rust based software running which uses toml config files.

@vanlueckn
Copy link
Author

Does work for me

@QuintenQVD0
Copy link
Contributor

This looks fine to me but just a question can you try it with the applied changes from #161 as json and yaml parsing can do strange things. If not that is also fine

@Kotori0629
Copy link

It's working normally! thx!

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.

4 participants