Rename dir: compiler -> crates

This commit is contained in:
Shunsuke Shibayama 2023-01-15 12:03:19 +09:00
parent e1004b538d
commit a127564b31
221 changed files with 17 additions and 19 deletions

View file

@ -0,0 +1,19 @@
# erg-linter (WIP)
erg-linter (can be used with `erg lint`) is a tool to check the erg file for errors.
## Features
The following codes are warned.
* Unreachable codes
* Wildcard import
* Unused variables
* Shadowing of built-in variables
* Unused objects that are not `NoneLike`
* Procedures without side-effects
* Variables that can be defined as constants
* Unnecessary `.clone`
* Mutable objects that do not change
* Hardcoded well-known constants (e.g. `3.14`)
* Defining a subroutine with too many parameters

19
crates/erg_linter/lint.rs Normal file
View file

@ -0,0 +1,19 @@
use erg_common::Str;
use crate::error::CompileWarnings;
use crate::hir::HIR;
#[derive(Debug, Default)]
pub struct Linter {
_used: Vec<Str>,
}
impl Linter {
pub fn new() -> Self {
Self { _used: Vec::new() }
}
pub fn lint(&mut self, _hir: &HIR) -> CompileWarnings {
CompileWarnings::empty()
}
}

3
crates/erg_linter/mod.rs Normal file
View file

@ -0,0 +1,3 @@
mod lint;
pub use lint::Linter;

View file