v, vet: move now obsolete vlib vet module to cmd vet (#21445)

This commit is contained in:
Turiiya 2024-05-06 17:29:11 +02:00 committed by GitHub
parent 920ae6d50f
commit f08b333b52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 16 deletions

View File

@ -1,7 +1,5 @@
// Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license that can be found in the LICENSE file.
module vet
import v.token
pub enum ErrorKind {
@ -24,7 +22,7 @@ pub enum ErrorType {
}
@[minify]
pub struct Error {
pub struct VetError {
pub mut:
kind ErrorKind @[required]
pub:

View File

@ -1,9 +1,8 @@
module main
import v.token
import v.vet
type FilteredLines = map[vet.ErrorType]map[int]bool
type FilteredLines = map[ErrorType]map[int]bool
fn (mut fl FilteredLines) comments(is_multi bool, pos token.Pos) {
if !is_multi {

View File

@ -4,7 +4,6 @@ module main
import os
import os.cmdline
import v.vet
import v.pref
import v.parser
import v.token
@ -15,9 +14,9 @@ import term
struct Vet {
mut:
opt Options
errors []vet.Error
warns []vet.Error
notices []vet.Error
errors []VetError
warns []VetError
notices []VetError
file string
filtered_lines FilteredLines
}
@ -326,7 +325,7 @@ fn (vt &Vet) vprintln(s string) {
println(s)
}
fn (vt &Vet) e2string(err vet.Error) string {
fn (vt &Vet) e2string(err VetError) string {
mut kind := '${err.kind}:'
mut location := '${err.file_path}:${err.pos.line_nr}:'
if vt.opt.use_color {
@ -351,11 +350,11 @@ fn (mut vt Vet) vet_in_condition(expr ast.InfixExpr) {
}
}
fn (mut vt Vet) error(msg string, line int, fix vet.FixKind) {
fn (mut vt Vet) error(msg string, line int, fix FixKind) {
pos := token.Pos{
line_nr: line + 1
}
vt.errors << vet.Error{
vt.errors << VetError{
message: msg
file_path: vt.file
pos: pos
@ -365,11 +364,11 @@ fn (mut vt Vet) error(msg string, line int, fix vet.FixKind) {
}
}
fn (mut vt Vet) warn(msg string, line int, fix vet.FixKind) {
fn (mut vt Vet) warn(msg string, line int, fix FixKind) {
pos := token.Pos{
line_nr: line + 1
}
mut w := vet.Error{
mut w := VetError{
message: msg
file_path: vt.file
pos: pos
@ -385,11 +384,11 @@ fn (mut vt Vet) warn(msg string, line int, fix vet.FixKind) {
}
}
fn (mut vt Vet) notice(msg string, line int, fix vet.FixKind) {
fn (mut vt Vet) notice(msg string, line int, fix FixKind) {
pos := token.Pos{
line_nr: line + 1
}
vt.notices << vet.Error{
vt.notices << VetError{
message: msg
file_path: vt.file
pos: pos