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

feat(kernel): add support for ConfigFile serialization #263

Merged
merged 12 commits into from
Mar 14, 2024

Conversation

robertohuertasm
Copy link
Member

@robertohuertasm robertohuertasm commented Mar 12, 2024

What problem are you trying to solve?

I was trying to serialize a ConfigFile instance and expected to get a valid YAML file. Unfortunately, the serialization for the rulesets was not implemented resulting in an invalid YAML according to the schema of our configuration file.

What is your solution?

This PR adds support for proper serialization, ignoring both Option::None and some default values. This helps to avoid having values showing null, {} or []

Alternatives considered

What the reviewer should know

Added a few tests for the new functionality and a vscode debug configuration to help debugging the tests, if needed.

Also, I added a new crate called indexmap, which was needed to keep the insertion order of the keys in the maps. This is critical for serialization purposes as the rulesets array has a weird convention where the first key must be the ruleset name with a null value.

@robertohuertasm robertohuertasm marked this pull request as ready for review March 12, 2024 19:55
@robertohuertasm robertohuertasm requested a review from a team as a code owner March 12, 2024 19:55
@robertohuertasm robertohuertasm marked this pull request as draft March 12, 2024 22:09
@robertohuertasm robertohuertasm marked this pull request as ready for review March 13, 2024 01:29
@robertohuertasm robertohuertasm marked this pull request as draft March 13, 2024 01:43
@robertohuertasm robertohuertasm marked this pull request as ready for review March 13, 2024 08:31
@juli1 juli1 requested a review from jasonforal March 13, 2024 10:47
crates/static-analysis-kernel/src/model/config_file.rs Outdated Show resolved Hide resolved
crates/static-analysis-kernel/Cargo.toml Outdated Show resolved Hide resolved
crates/static-analysis-kernel/src/config_file.rs Outdated Show resolved Hide resolved
crates/static-analysis-kernel/src/config_file.rs Outdated Show resolved Hide resolved
@robertohuertasm robertohuertasm merged commit 7a5d88b into main Mar 14, 2024
28 checks passed
@robertohuertasm robertohuertasm deleted the rob/feat/avoid-serializing-none branch March 14, 2024 16:03
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.

None yet

3 participants