check_please 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +21 -27
- data/{bin → exe}/check_please +1 -1
- data/lib/check_please/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4433e70c9c7da92bbc95c1bfb2f22a947be4e3d30c9fa5b1d735826cc45dde1
|
4
|
+
data.tar.gz: 249804476d1b19c1f9add240b20f5e05b9258d4a70f992b5bc8a3654339e7f5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be7a4320ecb7bf5836ed62ed629e3445b20e2e847e497847a5cdbab856694b46b7f039e8c423622b0b35f5d098398c1f060655e9f4f11aacc2b15adeeb1dda61
|
7
|
+
data.tar.gz: e15695cfa60a8c2cf29b54b32c33ce76a5758fe76cd8ac92cb90b362d1597060de469b99c4a2e182a5b35b28b4d1757508b6e8b058a6371fd7455ad2a30d7ae3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -19,11 +19,10 @@ Or install it yourself as:
|
|
19
19
|
|
20
20
|
$ gem install check_please
|
21
21
|
|
22
|
-
##
|
23
|
-
|
24
|
-
### Terminology
|
22
|
+
## Terminology
|
25
23
|
|
26
|
-
|
24
|
+
I know, you just want to see how to use this thing. Feel free to scroll down,
|
25
|
+
but be aware that CheckPlease uses a few words in a jargony way:
|
27
26
|
|
28
27
|
* **Reference** is always used to refer to the "target" or "source of truth."
|
29
28
|
We assume you're comparing two things because you want one of them to be like
|
@@ -36,7 +35,9 @@ CheckPlease uses a few words in a jargony way:
|
|
36
35
|
**reference** and the **candidate**. More on this in "Understanding the Output",
|
37
36
|
below.
|
38
37
|
|
39
|
-
|
38
|
+
## Usage
|
39
|
+
|
40
|
+
### From the Terminal
|
40
41
|
|
41
42
|
Use the `bin/check_please` executable. (To get started, run it with the '-h' flag.)
|
42
43
|
|
@@ -47,19 +48,16 @@ of giving it a second filename as the argument. (This is especially useful if
|
|
47
48
|
you're copying an XHR response out of a web browser's dev tools and have a tool
|
48
49
|
like MacOS's `pbpaste` utility.)
|
49
50
|
|
50
|
-
### RSpec
|
51
|
+
### From RSpec
|
51
52
|
|
52
53
|
See [check_please_rspec_matcher](https://github.com/RealGeeks/check_please_rspec_matcher).
|
53
54
|
|
54
|
-
### From
|
55
|
-
|
56
|
-
Create two JSON strings and pass them to `CheckPlease.render_diff`. You'll get
|
57
|
-
back a third string containing a nicely formatted report of all the differences
|
58
|
-
CheckPlease found in the two JSON strings. (See also: [./usage_examples.rb](usage_examples.rb).)
|
55
|
+
### From Ruby
|
59
56
|
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
Create two strings, each containing a JSON or YAML document, and pass them to
|
58
|
+
`CheckPlease.render_diff`. You'll get back a third string containing a report
|
59
|
+
of all the differences CheckPlease found in the two JSON strings. (See also:
|
60
|
+
[./usage_examples.rb](usage_examples.rb).)
|
63
61
|
|
64
62
|
### Understanding the Output
|
65
63
|
|
@@ -71,9 +69,7 @@ tool because you want a human-friendly summary of all the places that your
|
|
71
69
|
**candidate** fell short.
|
72
70
|
|
73
71
|
When CheckPlease compares your two samples, it generates a list of diffs to
|
74
|
-
describe any discrepancies it encounters.
|
75
|
-
tabular format, but if you want to incorporate this into another toolchain,
|
76
|
-
CheckPlease can also print these diffs as JSON to facilitate parsing.)
|
72
|
+
describe any discrepancies it encounters.
|
77
73
|
|
78
74
|
An example would probably help here.
|
79
75
|
|
@@ -125,23 +121,22 @@ CheckPlease defines:
|
|
125
121
|
* **type_mismatch** means that both the **reference** and the **candidate** had
|
126
122
|
a value at the given path, but one value was an Array or a Hash and the other
|
127
123
|
was not. **When CheckPlease encounters a type mismatch, it does not compare
|
128
|
-
anything "below" the given path.**
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
Also, the way these get displayed is likely to change.)_
|
124
|
+
anything "below" the given path.** _(Technical note: CheckPlease uses a
|
125
|
+
"recursive descent" strategy to traverse the **reference** data structure,
|
126
|
+
and it stops when it encounters a type mismatch in order to avoid producing a
|
127
|
+
lot of "garbage" diff output.)_
|
133
128
|
* **mismatch** means that both the **reference** and the **candidate** had a
|
134
129
|
value at the given path, and neither value was an Array or a Hash.
|
135
|
-
* **extra** means that, inside an Array or a Hash, the **candidate**
|
136
|
-
|
130
|
+
* **extra** means that, inside an Array or a Hash, the **candidate** contained
|
131
|
+
values that were not found in the **reference**.
|
137
132
|
* **missing** is the opposite of **extra**: inside an Array or a Hash, the
|
138
133
|
**reference** contained values that were not found in the **candidate**.
|
139
134
|
|
140
135
|
#### Paths
|
141
136
|
|
142
|
-
The second column contains a path expression. This is extremely
|
137
|
+
The second column contains a path expression. This is extremely lo-fi:
|
143
138
|
|
144
|
-
* The
|
139
|
+
* The root of the data structure is defined as "/".
|
145
140
|
* If an element in the data structure is an array, its child elements will have
|
146
141
|
a **one-based** index appended to their parent's path.
|
147
142
|
* If an element in the data structure is an object ("Hash" in Ruby), the key
|
@@ -165,7 +160,6 @@ print diffs as JSON to facilitate parsing. In Ruby, pass `format: :json` to
|
|
165
160
|
|
166
161
|
* command line flags for :allthethings:!
|
167
162
|
* sort by path?
|
168
|
-
* max depth (for iterative refinement?)
|
169
163
|
* detect timestamps and compare after parsing?
|
170
164
|
* ignore sub-second precision (option / CLI flag)?
|
171
165
|
* possibly support plugins for other folks to add custom coercions?
|
data/{bin → exe}/check_please
RENAMED
data/lib/check_please/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: check_please
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Livingston-Gray
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: table_print
|
@@ -56,7 +56,8 @@ description: Check for differences between two JSON strings (or Ruby data struct
|
|
56
56
|
parsed from them)
|
57
57
|
email:
|
58
58
|
- geeksam@gmail.com
|
59
|
-
executables:
|
59
|
+
executables:
|
60
|
+
- check_please
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -69,10 +70,10 @@ files:
|
|
69
70
|
- LICENSE.txt
|
70
71
|
- README.md
|
71
72
|
- Rakefile
|
72
|
-
- bin/check_please
|
73
73
|
- bin/console
|
74
74
|
- bin/setup
|
75
75
|
- check_please.gemspec
|
76
|
+
- exe/check_please
|
76
77
|
- lib/check_please.rb
|
77
78
|
- lib/check_please/cli.rb
|
78
79
|
- lib/check_please/cli/flag.rb
|