diff options
author | Akshay <[email protected]> | 2021-09-11 16:48:09 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-09-11 16:48:09 +0100 |
commit | 171a4fa4d15c4be14d63fdc5d258610bb26bd162 (patch) | |
tree | 3a8c105edb03481fe11e1486a23d165a686aecd5 | |
parent | e6ee0c4246c95d48dc7a63565ccb6f022f67dbec (diff) |
restructure repo into bin, lib and macros
-rw-r--r-- | Cargo.lock | 104 | ||||
-rw-r--r-- | Cargo.toml | 14 | ||||
-rw-r--r-- | bin/Cargo.toml | 8 | ||||
-rw-r--r-- | bin/src/main.rs (renamed from src/main.rs) | 0 | ||||
-rw-r--r-- | lib/Cargo.toml | 8 | ||||
-rw-r--r-- | lib/src/lib.rs | 7 | ||||
-rw-r--r-- | macros/Cargo.toml | 8 | ||||
-rw-r--r-- | macros/src/lib.rs | 7 | ||||
-rw-r--r-- | readme.md | 35 |
9 files changed, 79 insertions, 112 deletions
diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index f09d0c9..0000000 --- a/Cargo.lock +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | # This file is automatically @generated by Cargo. | ||
2 | # It is not intended for manual editing. | ||
3 | version = 3 | ||
4 | |||
5 | [[package]] | ||
6 | name = "anyhow" | ||
7 | version = "1.0.43" | ||
8 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
9 | checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf" | ||
10 | |||
11 | [[package]] | ||
12 | name = "autocfg" | ||
13 | version = "1.0.1" | ||
14 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
15 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" | ||
16 | |||
17 | [[package]] | ||
18 | name = "cbitset" | ||
19 | version = "0.2.0" | ||
20 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
21 | checksum = "29b6ad25ae296159fb0da12b970b2fe179b234584d7cd294c891e2bbb284466b" | ||
22 | dependencies = [ | ||
23 | "num-traits", | ||
24 | ] | ||
25 | |||
26 | [[package]] | ||
27 | name = "countme" | ||
28 | version = "2.0.4" | ||
29 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
30 | checksum = "328b822bdcba4d4e402be8d9adb6eebf269f969f8eadef977a553ff3c4fbcb58" | ||
31 | |||
32 | [[package]] | ||
33 | name = "hashbrown" | ||
34 | version = "0.9.1" | ||
35 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
36 | checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" | ||
37 | |||
38 | [[package]] | ||
39 | name = "memoffset" | ||
40 | version = "0.6.4" | ||
41 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
42 | checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" | ||
43 | dependencies = [ | ||
44 | "autocfg", | ||
45 | ] | ||
46 | |||
47 | [[package]] | ||
48 | name = "nix-analyzer" | ||
49 | version = "0.1.0" | ||
50 | dependencies = [ | ||
51 | "anyhow", | ||
52 | "rnix", | ||
53 | ] | ||
54 | |||
55 | [[package]] | ||
56 | name = "num-traits" | ||
57 | version = "0.2.14" | ||
58 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
59 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" | ||
60 | dependencies = [ | ||
61 | "autocfg", | ||
62 | ] | ||
63 | |||
64 | [[package]] | ||
65 | name = "rnix" | ||
66 | version = "0.9.0" | ||
67 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
68 | checksum = "1b37f8af07a0354606141df076458660af7e22238e4117a041c21c548080addd" | ||
69 | dependencies = [ | ||
70 | "cbitset", | ||
71 | "rowan", | ||
72 | "smol_str", | ||
73 | ] | ||
74 | |||
75 | [[package]] | ||
76 | name = "rowan" | ||
77 | version = "0.12.6" | ||
78 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
79 | checksum = "a1b36e449f3702f3b0c821411db1cbdf30fb451726a9456dce5dabcd44420043" | ||
80 | dependencies = [ | ||
81 | "countme", | ||
82 | "hashbrown", | ||
83 | "memoffset", | ||
84 | "rustc-hash", | ||
85 | "text-size", | ||
86 | ] | ||
87 | |||
88 | [[package]] | ||
89 | name = "rustc-hash" | ||
90 | version = "1.1.0" | ||
91 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
92 | checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" | ||
93 | |||
94 | [[package]] | ||
95 | name = "smol_str" | ||
96 | version = "0.1.18" | ||
97 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
98 | checksum = "b203e79e90905594272c1c97c7af701533d42adaab0beb3859018e477d54a3b0" | ||
99 | |||
100 | [[package]] | ||
101 | name = "text-size" | ||
102 | version = "1.1.0" | ||
103 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
104 | checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a" | ||
@@ -1,10 +1,8 @@ | |||
1 | [package] | 1 | [workspace] |
2 | name = "nix-analyzer" | ||
3 | version = "0.1.0" | ||
4 | edition = "2018" | ||
5 | 2 | ||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | 3 | members = [ |
4 | "bin", | ||
5 | "lib", | ||
6 | "macros" | ||
7 | ] | ||
7 | 8 | ||
8 | [dependencies] | ||
9 | anyhow = "1.0" | ||
10 | rnix = "0.9.0" | ||
diff --git a/bin/Cargo.toml b/bin/Cargo.toml new file mode 100644 index 0000000..57cff11 --- /dev/null +++ b/bin/Cargo.toml | |||
@@ -0,0 +1,8 @@ | |||
1 | [package] | ||
2 | name = "bin" | ||
3 | version = "0.1.0" | ||
4 | edition = "2018" | ||
5 | |||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
7 | |||
8 | [dependencies] | ||
diff --git a/src/main.rs b/bin/src/main.rs index e7a11a9..e7a11a9 100644 --- a/src/main.rs +++ b/bin/src/main.rs | |||
diff --git a/lib/Cargo.toml b/lib/Cargo.toml new file mode 100644 index 0000000..49e2e49 --- /dev/null +++ b/lib/Cargo.toml | |||
@@ -0,0 +1,8 @@ | |||
1 | [package] | ||
2 | name = "lib" | ||
3 | version = "0.1.0" | ||
4 | edition = "2018" | ||
5 | |||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
7 | |||
8 | [dependencies] | ||
diff --git a/lib/src/lib.rs b/lib/src/lib.rs new file mode 100644 index 0000000..31e1bb2 --- /dev/null +++ b/lib/src/lib.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | #[cfg(test)] | ||
2 | mod tests { | ||
3 | #[test] | ||
4 | fn it_works() { | ||
5 | assert_eq!(2 + 2, 4); | ||
6 | } | ||
7 | } | ||
diff --git a/macros/Cargo.toml b/macros/Cargo.toml new file mode 100644 index 0000000..6a47e03 --- /dev/null +++ b/macros/Cargo.toml | |||
@@ -0,0 +1,8 @@ | |||
1 | [package] | ||
2 | name = "macros" | ||
3 | version = "0.1.0" | ||
4 | edition = "2018" | ||
5 | |||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
7 | |||
8 | [dependencies] | ||
diff --git a/macros/src/lib.rs b/macros/src/lib.rs new file mode 100644 index 0000000..31e1bb2 --- /dev/null +++ b/macros/src/lib.rs | |||
@@ -0,0 +1,7 @@ | |||
1 | #[cfg(test)] | ||
2 | mod tests { | ||
3 | #[test] | ||
4 | fn it_works() { | ||
5 | assert_eq!(2 + 2, 4); | ||
6 | } | ||
7 | } | ||
diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..9a9e0ca --- /dev/null +++ b/readme.md | |||
@@ -0,0 +1,35 @@ | |||
1 | ## nix-analyzer | ||
2 | |||
3 | `nix-analyzer` intends to be a static analysis tool for the | ||
4 | Nix programming language. | ||
5 | |||
6 | For the time-being, `nix-analyzer` works only with ASTs | ||
7 | produced by the `rnix-parser` crate and does not evaluate | ||
8 | any nix code. | ||
9 | |||
10 | ## Architecture | ||
11 | |||
12 | `nix-analyzer` has the following components: | ||
13 | |||
14 | - `bin`: the CLI/entrypoint | ||
15 | - `lib`: library of lints and utilities to define these | ||
16 | lints | ||
17 | - `macros`: procedural macros to help define a lint | ||
18 | |||
19 | ### `bin` | ||
20 | |||
21 | This is the main point of interaction between `nix-analyzer` | ||
22 | and the end user. It's output is human-readable and should | ||
23 | also support JSON/errorfmt outputs for external tools to | ||
24 | use. | ||
25 | |||
26 | ### `lib` | ||
27 | |||
28 | A library of AST-based lints and utilities to help write | ||
29 | those lints. It should be easy for newcomers to write lints | ||
30 | without being familiar with the rest of the codebase. | ||
31 | |||
32 | ### `macros` | ||
33 | |||
34 | This crate intends to be a helper layer to declare lints and | ||
35 | their metadata. | ||