mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
Rename dir: compiler
-> crates
This commit is contained in:
parent
e1004b538d
commit
a127564b31
221 changed files with 17 additions and 19 deletions
19
crates/erg_linter/README.md
Normal file
19
crates/erg_linter/README.md
Normal 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
19
crates/erg_linter/lint.rs
Normal 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
3
crates/erg_linter/mod.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
mod lint;
|
||||
|
||||
pub use lint::Linter;
|
0
crates/erg_linter/warning.rs
Normal file
0
crates/erg_linter/warning.rs
Normal file
Loading…
Add table
Add a link
Reference in a new issue