restructure repo into bin, lib and macros

This commit is contained in:
Akshay 2021-09-11 21:18:09 +05:30
parent e6ee0c4246
commit 171a4fa4d1
9 changed files with 79 additions and 112 deletions

104
Cargo.lock generated
View File

@ -1,104 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anyhow"
version = "1.0.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28ae2b3dec75a406790005a200b1bd89785afc02517a00ca99ecfe093ee9e6cf"
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "cbitset"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29b6ad25ae296159fb0da12b970b2fe179b234584d7cd294c891e2bbb284466b"
dependencies = [
"num-traits",
]
[[package]]
name = "countme"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "328b822bdcba4d4e402be8d9adb6eebf269f969f8eadef977a553ff3c4fbcb58"
[[package]]
name = "hashbrown"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]]
name = "memoffset"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg",
]
[[package]]
name = "nix-analyzer"
version = "0.1.0"
dependencies = [
"anyhow",
"rnix",
]
[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
"autocfg",
]
[[package]]
name = "rnix"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b37f8af07a0354606141df076458660af7e22238e4117a041c21c548080addd"
dependencies = [
"cbitset",
"rowan",
"smol_str",
]
[[package]]
name = "rowan"
version = "0.12.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1b36e449f3702f3b0c821411db1cbdf30fb451726a9456dce5dabcd44420043"
dependencies = [
"countme",
"hashbrown",
"memoffset",
"rustc-hash",
"text-size",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "smol_str"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b203e79e90905594272c1c97c7af701533d42adaab0beb3859018e477d54a3b0"
[[package]]
name = "text-size"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "288cb548dbe72b652243ea797201f3d481a0609a967980fcc5b2315ea811560a"

View File

@ -1,10 +1,8 @@
[package]
name = "nix-analyzer"
version = "0.1.0"
edition = "2018"
[workspace]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
members = [
"bin",
"lib",
"macros"
]
[dependencies]
anyhow = "1.0"
rnix = "0.9.0"

8
bin/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "bin"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

8
lib/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "lib"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

7
lib/src/lib.rs Normal file
View File

@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

8
macros/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "macros"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

7
macros/src/lib.rs Normal file
View File

@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

35
readme.md Normal file
View File

@ -0,0 +1,35 @@
## nix-analyzer
`nix-analyzer` intends to be a static analysis tool for the
Nix programming language.
For the time-being, `nix-analyzer` works only with ASTs
produced by the `rnix-parser` crate and does not evaluate
any nix code.
## Architecture
`nix-analyzer` has the following components:
- `bin`: the CLI/entrypoint
- `lib`: library of lints and utilities to define these
lints
- `macros`: procedural macros to help define a lint
### `bin`
This is the main point of interaction between `nix-analyzer`
and the end user. It's output is human-readable and should
also support JSON/errorfmt outputs for external tools to
use.
### `lib`
A library of AST-based lints and utilities to help write
those lints. It should be easy for newcomers to write lints
without being familiar with the rest of the codebase.
### `macros`
This crate intends to be a helper layer to declare lints and
their metadata.