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

Use BTreeMap instead of HashMap for checks file to order the output #63

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

## Unreleased

* Ensures the JSON output of the check command is sorted to avoid changes in git between runs

## v2.2.0 (August 15, 2024)

* Adds the ability to build the default language to the root path, rather than placing it under a language code.
Expand Down
8 changes: 4 additions & 4 deletions rosey/src/runners/checker.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize};
use std::{
collections::{BTreeMap, HashMap},
collections::BTreeMap,
fs::{create_dir_all, read_to_string, File},
io::{BufWriter, Write},
str::FromStr,
Expand All @@ -10,7 +10,7 @@ use globwalk::DirEntry;

use crate::{RoseyLocale, RoseyOptions, RoseyTranslation};

#[derive(Serialize, Deserialize, Hash, PartialEq, Eq)]
#[derive(Serialize, Deserialize, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[serde(rename_all = "camelCase")]
enum RoseyCheckStates {
Current,
Expand All @@ -25,8 +25,8 @@ struct RoseyCheck {
current: bool,
base_total: i32,
total: i32,
states: HashMap<RoseyCheckStates, i32>,
keys: HashMap<String, RoseyCheckStates>,
states: BTreeMap<RoseyCheckStates, i32>,
keys: BTreeMap<String, RoseyCheckStates>,
}

pub struct RoseyChecker {
Expand Down
Loading