mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 04:24:43 +00:00
Create .pre-commit-config.yml
This commit is contained in:
parent
fa6979fed2
commit
fa33a2003b
5 changed files with 18 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
||||||
# These are backup files generated by rustfmt
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
*.pyc
|
*.pyc
|
||||||
|
*.pyz
|
||||||
/.vscode/
|
/.vscode/
|
||||||
/.VSCodeCounter/
|
/.VSCodeCounter/
|
||||||
/.vs/
|
/.vs/
|
||||||
|
|
9
.pre-commit-config.yaml
Normal file
9
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
repos:
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: rustfmt
|
||||||
|
name: rustfmt
|
||||||
|
description: Check if all files follow the rustfmt style
|
||||||
|
entry: cargo fmt --all
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
|
@ -4,7 +4,7 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
// use std::env::consts::{ARCH, OS};
|
// use std::env::consts::{ARCH, OS};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufRead, BufReader, Read, stdin};
|
use std::io::{stdin, BufRead, BufReader, Read};
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
// use crate::lazy::Lazy;
|
// use crate::lazy::Lazy;
|
||||||
|
|
|
@ -9,7 +9,7 @@ use std::slice::{Iter, IterMut};
|
||||||
use std::vec::IntoIter;
|
use std::vec::IntoIter;
|
||||||
|
|
||||||
use crate::color::{GREEN, RESET};
|
use crate::color::{GREEN, RESET};
|
||||||
use crate::config::{ErgConfig, Input, SEMVER, GIT_HASH_SHORT, BUILD_DATE};
|
use crate::config::{ErgConfig, Input, BUILD_DATE, GIT_HASH_SHORT, SEMVER};
|
||||||
use crate::error::{ErrorDisplay, Location, MultiErrorDisplay};
|
use crate::error::{ErrorDisplay, Location, MultiErrorDisplay};
|
||||||
use crate::ty::Type;
|
use crate::ty::Type;
|
||||||
use crate::Str;
|
use crate::Str;
|
||||||
|
@ -311,7 +311,10 @@ pub trait Runnable: Sized {
|
||||||
fn new(cfg: ErgConfig) -> Self;
|
fn new(cfg: ErgConfig) -> Self;
|
||||||
fn input(&self) -> &Input;
|
fn input(&self) -> &Input;
|
||||||
fn start_message(&self) -> String {
|
fn start_message(&self) -> String {
|
||||||
format!("{} {SEMVER} (tags/?:{GIT_HASH_SHORT}, {BUILD_DATE}) on {ARCH}/{OS}\n", Self::NAME)
|
format!(
|
||||||
|
"{} {SEMVER} (tags/?:{GIT_HASH_SHORT}, {BUILD_DATE}) on {ARCH}/{OS}\n",
|
||||||
|
Self::NAME
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fn finish(&mut self); // called when the :exit command is received.
|
fn finish(&mut self); // called when the :exit command is received.
|
||||||
fn clear(&mut self);
|
fn clear(&mut self);
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::mem;
|
||||||
|
|
||||||
use erg_common::color::{GREEN, RED, RESET};
|
use erg_common::color::{GREEN, RED, RESET};
|
||||||
use erg_common::config::ErgConfig;
|
use erg_common::config::ErgConfig;
|
||||||
use erg_common::config::{Input};
|
use erg_common::config::Input;
|
||||||
use erg_common::error::Location;
|
use erg_common::error::Location;
|
||||||
use erg_common::set::Set;
|
use erg_common::set::Set;
|
||||||
use erg_common::traits::Runnable;
|
use erg_common::traits::Runnable;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue