Skip to content

Commit

Permalink
Merge pull request #63 from CloudCannon/fix/checks-ordering
Browse files Browse the repository at this point in the history
Use BTreeMap instead of HashMap for checks file to order the output
  • Loading branch information
bglw authored Aug 28, 2024
2 parents 5dfd1c7 + c737192 commit 5753b8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit 5753b8f

Please sign in to comment.