Skip to content

Commit

Permalink
v, vet: move now obsolete vlib vet module to cmd vet
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed May 6, 2024
1 parent 4885b81 commit 4e53435
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
4 changes: 1 addition & 3 deletions vlib/v/vet/vet.v → cmd/tools/vvet/errors.v
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -24,7 +22,7 @@ pub enum ErrorType {
}

@[minify]
pub struct Error {
pub struct VetError {
pub mut:
kind ErrorKind @[required]
pub:
Expand Down
3 changes: 1 addition & 2 deletions cmd/tools/vvet/filter.v
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
21 changes: 10 additions & 11 deletions cmd/tools/vvet/vvet.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module main

import os
import os.cmdline
import v.vet
import v.pref
import v.parser
import v.token
Expand All @@ -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
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4e53435

Please sign in to comment.