rename to statix, skip self env arg

This commit is contained in:
Akshay 2021-10-02 10:50:15 +05:30
parent 7953d8cc93
commit 2dacf12a3d
2 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,5 @@
[package]
name = "bin"
name = "statix"
version = "0.1.0"
edition = "2018"

View File

@ -6,13 +6,13 @@ use std::{
use anyhow::{Context, Result};
use ariadne::{
CharSet, Color, Config as CliConfig, Label, Report as CliReport,
ReportKind as CliReportKind, Source,
ReportKind as CliReportKind, Source, LabelAttach
};
use lib::{Report, LINTS};
use rnix::{TextRange, WalkEvent};
fn analyze(file: &str) -> Result<Vec<Report>> {
let parsed = rnix::parse(file).as_result()?;
fn analyze(source: &str) -> Result<Vec<Report>> {
let parsed = rnix::parse(source).as_result()?;
Ok(parsed
.node()
@ -47,9 +47,12 @@ fn print_report(report: Report, file_src: &str, file_path: &Path) -> Result<()>
.with_config(
CliConfig::default()
.with_cross_gap(true)
.with_char_set(CharSet::ExtendedAscii),
.with_multiline_arrows(false)
.with_label_attach(LabelAttach::Middle)
.with_char_set(CharSet::Unicode),
)
.with_message(report.note),
.with_message(report.note)
.with_code(report.code),
|cli_report, diagnostic| {
let cli_report = cli_report.with_label(
Label::new((src_id, range(diagnostic.at)))
@ -74,8 +77,10 @@ fn print_report(report: Report, file_src: &str, file_path: &Path) -> Result<()>
}
fn _main() -> Result<()> {
// TODO: accept cli args, construct a CLI config with a list of files to analyze
let args = env::args();
for (file_src, file_path, reports) in args
.skip(1)
.map(|s| PathBuf::from(&s))
.filter(|p| p.is_file())
.filter_map(|path| {