Skip to content

Commit c4f6a50

Browse files
committed
fix: resolve formatting issue with generated readme
1 parent a9c9f64 commit c4f6a50

File tree

8 files changed

+113
-101
lines changed

8 files changed

+113
-101
lines changed

.github/workflows/coverage.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/lint.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/test.yaml renamed to .github/workflows/pull_request.yaml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
name: Test
1+
name: Pull Requests
22
on:
3-
push:
4-
branches:
5-
- main
6-
- develop
7-
paths:
8-
- '**.go'
9-
- 'go.mod'
103
pull_request:
114
branches:
125
- main
@@ -35,3 +28,23 @@ jobs:
3528
- name: Run Test
3629
run: |
3730
go test -v -count=10 ./...
31+
lint:
32+
strategy:
33+
matrix:
34+
go-version: [1.17.x]
35+
os: [ubuntu-latest, macos-latest, windows-latest]
36+
runs-on: ${{ matrix.os }}
37+
steps:
38+
- name: Install Go
39+
uses: actions/setup-go@v2
40+
with:
41+
go-version: ${{ matrix.go-version }}
42+
- name: Checkout code
43+
uses: actions/checkout@v2
44+
- name: Install dependencies
45+
run: |
46+
go install golang.org/x/lint/golint@latest
47+
go mod download
48+
- name: Run Lint
49+
run: |
50+
golint -set_exit_status=1 ./...

.github/workflows/push_main.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Push Main
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- '**.go'
8+
- 'go.mod'
9+
jobs:
10+
test:
11+
strategy:
12+
matrix:
13+
go-version: ['1.17']
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- name: Install Go
18+
uses: actions/setup-go@v2
19+
with:
20+
go-version: ${{ matrix.go-version }}
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
- name: Install dependencies
24+
run: |
25+
go version
26+
go mod download
27+
- name: Run Test
28+
run: |
29+
go test -v -count=10 ./...
30+
lint:
31+
strategy:
32+
matrix:
33+
go-version: ['1.17']
34+
os: [ubuntu-latest, macos-latest, windows-latest]
35+
runs-on: ${{ matrix.os }}
36+
steps:
37+
- name: Install Go
38+
uses: actions/setup-go@v2
39+
with:
40+
go-version: ${{ matrix.go-version }}
41+
- name: Checkout code
42+
uses: actions/checkout@v2
43+
- name: Install dependencies
44+
run: |
45+
go install golang.org/x/lint/golint@latest
46+
go mod download
47+
- name: Run Lint
48+
run: |
49+
golint -set_exit_status=1 ./...
50+
coverage:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v2
54+
- uses: actions/setup-go@v2
55+
with:
56+
go-version: '1.17'
57+
- name: Install dependencies
58+
run: |
59+
go install golang.org/x/lint/golint@latest
60+
go mod download
61+
- name: Run Test
62+
run: |
63+
go test -v -coverprofile=coverage.txt -covermode=atomic -count=10 ./...
64+
- name: Upload coverage to Codecov
65+
uses: codecov/codecov-action@v2
66+
with:
67+
token: ${{ secrets.CODECOV_TOKEN }}
68+
files: ./coverage.txt
69+
fail_ci_if_error: true
70+
verbose: true
71+
release:
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@master
75+
- uses: go-semantic-release/action@v1
76+
with:
77+
github-token: ${{ secrets.GITHUB_TOKEN }}
78+
allow-initial-development-versions: true
79+
force-bump-patch-version: true

.github/workflows/release.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![codecov](https://codecov.io/gh/evilmonkeyinc/jsonpath/branch/main/graph/badge.svg?token=4PU85I7J2R)](https://codecov.io/gh/evilmonkeyinc/jsonpath)
22
[![main](https://github.com/evilmonkeyinc/jsonpath/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/evilmonkeyinc/jsonpath/actions/workflows/test.yaml)
3-
[![develop](https://github.com/evilmonkeyinc/jsonpath/actions/workflows/test.yaml/badge.svg?branch=develop)](https://github.com/evilmonkeyinc/jsonpath/actions/workflows/test.yaml)
43
[![Go Reference](https://pkg.go.dev/badge/github.com/evilmonkeyinc/jsonpath.svg)](https://pkg.go.dev/github.com/evilmonkeyinc/jsonpath)
54

65
> This library is on the unstable version v0.X.X, which means there is a chance that any minor update may introduce a breaking change. Where I will endeavor to avoid this, care should be taken updating your dependency on this library until the first stable release v1.0.0 at which point any future breaking changes will result in a new major release.

test/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,17 @@ This implementation would be closer to the 'Scalar consensus' as it does not alw
171171
|`$[?(@.key>42 && @.key<44)]`|`[ {"key": 42}, {"key": 43}, {"key": 44} ]`|`[{"key":43}]`|`[{"key":43}]`|:white_check_mark:|
172172
|`$[?(@.key>0 && false)]`|`[ {"key": 1}, {"key": 3}, {"key": "nice"}, {"key": true}, {"key": null}, {"key": false}, {"key": {}}, {"key": []}, {"key": -1}, {"key": 0}, {"key": ""} ]`|none|`[]`|:question:|
173173
|`$[?(@.key>0 && true)]`|`[ {"key": 1}, {"key": 3}, {"key": "nice"}, {"key": true}, {"key": null}, {"key": false}, {"key": {}}, {"key": []}, {"key": -1}, {"key": 0}, {"key": ""} ]`|none|`[{"key":1},{"key":3}]`|:question:|
174-
|`$[?(@.key>43 || @.key<43)]`|`[ {"key": 42}, {"key": 43}, {"key": 44} ]`|`[{"key":42},{"key":44}]`|`[{"key":42},{"key":44}]`|:white_check_mark:|
175-
|`$[?(@.key>0 || false)]`|`[ {"key": 1}, {"key": 3}, {"key": "nice"}, {"key": true}, {"key": null}, {"key": false}, {"key": {}}, {"key": []}, {"key": -1}, {"key": 0}, {"key": ""} ]`|none|`[{"key":1},{"key":3}]`|:question:|
176-
|`$[?(@.key>0 || true)]`|`[ {"key": 1}, {"key": 3}, {"key": "nice"}, {"key": true}, {"key": null}, {"key": false}, {"key": {}}, {"key": []}, {"key": -1}, {"key": 0}, {"key": ""} ]`|none|`[{"key":1},{"key":3},{"key":-1},{"key":0}]`|:question:|
174+
|`$[?(@.key>43 \|\| @.key<43)]`|`[ {"key": 42}, {"key": 43}, {"key": 44} ]`|`[{"key":42},{"key":44}]`|`[{"key":42},{"key":44}]`|:white_check_mark:|
175+
|`$[?(@.key>0 \|\| false)]`|`[ {"key": 1}, {"key": 3}, {"key": "nice"}, {"key": true}, {"key": null}, {"key": false}, {"key": {}}, {"key": []}, {"key": -1}, {"key": 0}, {"key": ""} ]`|none|`[{"key":1},{"key":3}]`|:question:|
176+
|`$[?(@.key>0 \|\| true)]`|`[ {"key": 1}, {"key": 3}, {"key": "nice"}, {"key": true}, {"key": null}, {"key": false}, {"key": {}}, {"key": []}, {"key": -1}, {"key": 0}, {"key": ""} ]`|none|`[{"key":1},{"key":3},{"key":-1},{"key":0}]`|:question:|
177177
|`$[?(@['key']==42)]`|`[ {"key": 0}, {"key": 42}, {"key": -1}, {"key": 41}, {"key": 43}, {"key": 42.0001}, {"key": 41.9999}, {"key": 100}, {"some": "value"} ]`|`[{"key":42}]`|`[{"key":42}]`|:white_check_mark:|
178178
|`$[?(@['@key']==42)]`|`[ {"@key": 0}, {"@key": 42}, {"key": 42}, {"@key": 43}, {"some": "value"} ]`|`[{"@key":42}]`|`[{"@key":42}]`|:white_check_mark:|
179179
|`$[?(@[-1]==2)]`|`[[2, 3], ["a"], [0, 2], [2]]`|none|`[[0,2],[2]]`|:question:|
180180
|`$[?(@[1]=='b')]`|`[["a", "b"], ["x", "y"]]`|`[["a","b"]]`|`[["a","b"]]`|:white_check_mark:|
181181
|`$[?(@[1]=='b')]`|`{"1": ["a", "b"], "2": ["x", "y"]}`|none|`[["a","b"]]`|:question:|
182182
|`$[?(@)]`|`[ "some value", null, "value", 0, 1, -1, "", [], {}, false, true ]`|none|`["some value","value",0,1,-1,true]`|:question:|
183-
|`$[?(@.a && (@.b || @.c))]`|`[ { "a": true }, { "a": true, "b": true }, { "a": true, "b": true, "c": true }, { "b": true, "c": true }, { "a": true, "c": true }, { "c": true }, { "b": true } ]`|none|`[]`|:question:|
184-
|`[?(@.a && @.b || @.c)]`|`[ { "a": true, "b": true }, { "a": true, "b": true, "c": true }, { "b": true, "c": true }, { "a": true, "c": true }, { "a": true }, { "b": true }, { "c": true }, { "d": true }, {} ]`|none|`null`|:question:|
183+
|`$[?(@.a && (@.b \|\| @.c))]`|`[ { "a": true }, { "a": true, "b": true }, { "a": true, "b": true, "c": true }, { "b": true, "c": true }, { "a": true, "c": true }, { "c": true }, { "b": true } ]`|none|`[]`|:question:|
184+
|`[?(@.a && @.b \|\| @.c)]`|`[ { "a": true, "b": true }, { "a": true, "b": true, "c": true }, { "b": true, "c": true }, { "a": true, "c": true }, { "a": true }, { "b": true }, { "c": true }, { "d": true }, {} ]`|none|`null`|:question:|
185185
|`$[?(@.key/10==5)]`|`[{"key": 60}, {"key": 50}, {"key": 10}, {"key": -50}, {"key/10": 5}]`|none|`[{"key":50}]`|:question:|
186186
|`$[?(@.key-dash == 'value')]`|`[ { "key-dash": "value" } ]`|none|`[]`|:question:|
187187
|`$[?(@.2 == 'second')]`|`[{"a": "first", "2": "second", "b": "third"}]`|none|`[{"2":"second","a":"first","b":"third"}]`|:question:|

test/helper_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"io"
1010
"os"
1111
"reflect"
12+
"strings"
1213
"testing"
1314

1415
"github.com/evilmonkeyinc/jsonpath"
@@ -110,6 +111,11 @@ func printConsensusMatrix(writer io.Writer, tests []testData) {
110111
fmt.Fprintf(writer, "|query|data|consensus|actual|match|\n")
111112
fmt.Fprintf(writer, "|---|---|---|---|---|\n")
112113
for _, test := range tests {
114+
115+
query := test.query
116+
// escape | so format doesnt break
117+
query = strings.ReplaceAll(query, "|", "\\|")
118+
113119
expected := test.expected
114120
if expected == nil {
115121
expected = "null"
@@ -119,7 +125,7 @@ func printConsensusMatrix(writer io.Writer, tests []testData) {
119125
}
120126

121127
if test.consensus == consensusNone {
122-
fmt.Fprintf(writer, "|`%s`|`%v`|%s|`%v`|%s|\n", test.query, test.data, "none", expected, ":question:")
128+
fmt.Fprintf(writer, "|`%s`|`%v`|%s|`%v`|%s|\n", query, test.data, "none", expected, ":question:")
123129
continue
124130
}
125131

@@ -136,6 +142,6 @@ func printConsensusMatrix(writer io.Writer, tests []testData) {
136142
symbol = ":white_check_mark:"
137143
}
138144

139-
fmt.Fprintf(writer, "|`%s`|`%v`|`%v`|`%v`|%s|\n", test.query, test.data, consensus, expected, symbol)
145+
fmt.Fprintf(writer, "|`%s`|`%v`|`%v`|`%v`|%s|\n", query, test.data, consensus, expected, symbol)
140146
}
141147
}

0 commit comments

Comments
 (0)