aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-10-28 12:57:16 +0100
committerAkshay <[email protected]>2021-10-28 13:04:59 +0100
commitc3cede18c9440d05385f0a7fd7ae2ef628ce74aa (patch)
tree1bc616ab9e81636bfb3863ab79e5fb0740d472b4
parent6e8dd004ea6fab9be73f0c7999774b3140733ff0 (diff)
improve json output for suggestions, bump to v0.2.5v0.2.5
-rw-r--r--Cargo.lock2
-rw-r--r--bin/Cargo.toml2
-rw-r--r--bin/src/traits.rs14
-rw-r--r--flake.nix2
4 files changed, 14 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock
index cb4a625..1a75d27 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -388,7 +388,7 @@ checksum = "b203e79e90905594272c1c97c7af701533d42adaab0beb3859018e477d54a3b0"
388 388
389[[package]] 389[[package]]
390name = "statix" 390name = "statix"
391version = "0.2.4" 391version = "0.2.5"
392dependencies = [ 392dependencies = [
393 "ariadne", 393 "ariadne",
394 "clap", 394 "clap",
diff --git a/bin/Cargo.toml b/bin/Cargo.toml
index 3bbc532..cc15c23 100644
--- a/bin/Cargo.toml
+++ b/bin/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "statix" 2name = "statix"
3version = "0.2.4" 3version = "0.2.5"
4edition = "2018" 4edition = "2018"
5license = "MIT" 5license = "MIT"
6authors = [ "Akshay <[email protected]>" ] 6authors = [ "Akshay <[email protected]>" ]
diff --git a/bin/src/traits.rs b/bin/src/traits.rs
index 5068764..465abe4 100644
--- a/bin/src/traits.rs
+++ b/bin/src/traits.rs
@@ -118,7 +118,6 @@ mod json {
118 118
119 use std::io::{self, Write}; 119 use std::io::{self, Write};
120 120
121 use lib::Suggestion;
122 use rnix::TextRange; 121 use rnix::TextRange;
123 use serde::Serialize; 122 use serde::Serialize;
124 use serde_json; 123 use serde_json;
@@ -142,7 +141,13 @@ mod json {
142 struct JsonDiagnostic<'μ> { 141 struct JsonDiagnostic<'μ> {
143 at: JsonSpan, 142 at: JsonSpan,
144 message: &'μ String, 143 message: &'μ String,
145 suggestion: &'μ Option<Suggestion>, 144 suggestion: Option<JsonSuggestion>,
145 }
146
147 #[derive(Serialize)]
148 struct JsonSuggestion {
149 at: JsonSpan,
150 fix: String,
146 } 151 }
147 152
148 #[derive(Serialize)] 153 #[derive(Serialize)]
@@ -193,7 +198,10 @@ mod json {
193 .map(|d| JsonDiagnostic { 198 .map(|d| JsonDiagnostic {
194 at: JsonSpan::from_textrange(d.at, src), 199 at: JsonSpan::from_textrange(d.at, src),
195 message: &d.message, 200 message: &d.message,
196 suggestion: &d.suggestion, 201 suggestion: d.suggestion.as_ref().map(|s| JsonSuggestion {
202 at: JsonSpan::from_textrange(s.at, src),
203 fix: s.fix.to_string(),
204 }),
197 }) 205 })
198 .collect::<Vec<_>>(); 206 .collect::<Vec<_>>();
199 JsonReport { 207 JsonReport {
diff --git a/flake.nix b/flake.nix
index bb28517..765bea3 100644
--- a/flake.nix
+++ b/flake.nix
@@ -49,7 +49,7 @@
49 49
50 statix = with final; pkgs.stdenv.mkDerivation { 50 statix = with final; pkgs.stdenv.mkDerivation {
51 pname = "statix"; 51 pname = "statix";
52 version = "v0.2.4"; 52 version = "v0.2.5";
53 src = builtins.path { 53 src = builtins.path {
54 path = ./.; 54 path = ./.;
55 name = "statix"; 55 name = "statix";