diff options
author | Akshay <[email protected]> | 2022-08-02 12:27:04 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2022-08-02 12:27:04 +0100 |
commit | efd96e8df6805a45aaf5822141dee11c642b51ae (patch) | |
tree | 56cca3a780dd0753e21eb5e0dbda585ce6ff7f7b /readme |
init
Diffstat (limited to 'readme')
-rw-r--r-- | readme | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -0,0 +1,38 @@ | |||
1 | Accepts a list of files as args and returns pairs of duplicate files, one pair | ||
2 | per line. | ||
3 | |||
4 | Usage: | ||
5 | ----- | ||
6 | |||
7 | cargo run --release --quiet -- [FILES] | ||
8 | |||
9 | |||
10 | Example: | ||
11 | ------- | ||
12 | |||
13 | cargo run ---release --quiet -- js-files/*.js | ||
14 | |||
15 | |||
16 | Internals: | ||
17 | --------- | ||
18 | |||
19 | The tool uses tree-sitter to produce ASTs for the given files. It then lazily | ||
20 | traverses the trees of the two files to be compared and exits on encountering | ||
21 | the first structural difference in the ASTs. | ||
22 | |||
23 | |||
24 | Known issues: | ||
25 | ------------ | ||
26 | |||
27 | - A fully commented-out file is equivalent to every other fully commented-out | ||
28 | file and to empty files | ||
29 | |||
30 | - Does not account for equivalence of unordered children: | ||
31 | |||
32 | ==== file1.rs ==== ==== file2.rs ==== | ||
33 | fn bar(x, y, z) {} fn foo(a, b) {} | ||
34 | fn foo(a, b) {} fn bar(x, y, z) {} | ||
35 | |||
36 | Here, `function` nodes are "unordered" children, the files are structurally | ||
37 | equivalent because the order of `function` nodes is irrelevant. However, the | ||
38 | tool considers these files to be unique. | ||