From d8f8661567a1056efebcd9212ffe8b1703899ea7 Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Mon, 1 Aug 2022 10:16:59 +1000 Subject: [PATCH] Fixing from review --- pkg/yqlib/csv_test.go | 6 +++--- pkg/yqlib/doc/usage/csv-tsv.md | 8 ++++---- pkg/yqlib/doc/usage/headers/csv-tsv.md | 2 +- pkg/yqlib/doc/usage/headers/properties.md | 2 +- pkg/yqlib/doc/usage/properties.md | 2 +- pkg/yqlib/lexer_participle_test.go | 1 - pkg/yqlib/operators_test.go | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pkg/yqlib/csv_test.go b/pkg/yqlib/csv_test.go index 86e5cb4f..ff232ad0 100644 --- a/pkg/yqlib/csv_test.go +++ b/pkg/yqlib/csv_test.go @@ -105,21 +105,21 @@ var csvScenarios = []formatScenario{ }, { description: "Encode array of objects to csv - missing fields behaviour", - subdescription: "First entry is used to determine the headers, and it it missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank", + subdescription: "First entry is used to determine the headers, and it is missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank", input: expectedYamlFromCSVMissingData, expected: csvSimpleMissingData, scenarioType: "encode-csv", }, { description: "Parse CSV into an array of objects", - subdescription: "First row is assumed to define the fields", + subdescription: "First row is assumed to be the header row.", input: csvSimple, expected: expectedYamlFromCSV, scenarioType: "decode-csv-object", }, { description: "Parse TSV into an array of objects", - subdescription: "First row is assumed to define the fields", + subdescription: "First row is assumed to be the header row.", input: tsvSimple, expected: expectedYamlFromCSV, scenarioType: "decode-tsv-object", diff --git a/pkg/yqlib/doc/usage/csv-tsv.md b/pkg/yqlib/doc/usage/csv-tsv.md index eecf2645..03749ab6 100644 --- a/pkg/yqlib/doc/usage/csv-tsv.md +++ b/pkg/yqlib/doc/usage/csv-tsv.md @@ -1,5 +1,5 @@ # CSV -Encode/Decode to CSV or TSV. +Encode/Decode/Roundtrip CSV and TSV files. ## Encode Currently supports arrays of homogenous flat objects, that is: no nesting and it assumes the _first_ object has all the keys required: @@ -118,7 +118,7 @@ Samantha's Rabbit,2 ``` ## Encode array of objects to csv - missing fields behaviour -First entry is used to determine the headers, and it it missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank +First entry is used to determine the headers, and it is missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank Given a sample.yml file of: ```yaml @@ -142,7 +142,7 @@ Samantha's Rabbit,,-188.8 ``` ## Parse CSV into an array of objects -First row is assumed to define the fields +First row is assumed to be the header row. Given a sample.csv file of: ```csv @@ -168,7 +168,7 @@ will output ``` ## Parse TSV into an array of objects -First row is assumed to define the fields +First row is assumed to be the header row. Given a sample.tsv file of: ```tsv diff --git a/pkg/yqlib/doc/usage/headers/csv-tsv.md b/pkg/yqlib/doc/usage/headers/csv-tsv.md index 760ab4f6..0a7c7cac 100644 --- a/pkg/yqlib/doc/usage/headers/csv-tsv.md +++ b/pkg/yqlib/doc/usage/headers/csv-tsv.md @@ -1,5 +1,5 @@ # CSV -Encode/Decode to CSV or TSV. +Encode/Decode/Roundtrip CSV and TSV files. ## Encode Currently supports arrays of homogenous flat objects, that is: no nesting and it assumes the _first_ object has all the keys required: diff --git a/pkg/yqlib/doc/usage/headers/properties.md b/pkg/yqlib/doc/usage/headers/properties.md index b3407e2b..90164a6d 100644 --- a/pkg/yqlib/doc/usage/headers/properties.md +++ b/pkg/yqlib/doc/usage/headers/properties.md @@ -1,5 +1,5 @@ # Properties -Encode/Decode to/from a property file. Line comments on value nodes will be copied across. +Encode/Decode/Roundtrip to/from a property file. Line comments on value nodes will be copied across. By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these. diff --git a/pkg/yqlib/doc/usage/properties.md b/pkg/yqlib/doc/usage/properties.md index b7e8eb58..f80bba35 100644 --- a/pkg/yqlib/doc/usage/properties.md +++ b/pkg/yqlib/doc/usage/properties.md @@ -1,6 +1,6 @@ # Properties -Encode/Decode to/from a property file. Line comments on value nodes will be copied across. +Encode/Decode/Roundtrip to/from a property file. Line comments on value nodes will be copied across. By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these. diff --git a/pkg/yqlib/lexer_participle_test.go b/pkg/yqlib/lexer_participle_test.go index 7dfa0f60..3a8739ed 100644 --- a/pkg/yqlib/lexer_participle_test.go +++ b/pkg/yqlib/lexer_participle_test.go @@ -523,7 +523,6 @@ var participleLexerScenarios = []participleLexerScenario{ } func TestParticipleLexer(t *testing.T) { - log.Errorf("TestParticiple") lexer := newParticipleLexer() for _, scenario := range participleLexerScenarios { diff --git a/pkg/yqlib/operators_test.go b/pkg/yqlib/operators_test.go index 0f9fa49d..92b2caeb 100644 --- a/pkg/yqlib/operators_test.go +++ b/pkg/yqlib/operators_test.go @@ -31,7 +31,7 @@ type expressionScenario struct { } func TestMain(m *testing.M) { - logging.SetLevel(logging.DEBUG, "") + logging.SetLevel(logging.ERROR, "") Now = func() time.Time { return time.Date(2021, time.May, 19, 1, 2, 3, 4, time.UTC) }