1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ci: run v vet over cmd/tools and cmd/v too

This commit is contained in:
Delyan Angelov 2020-10-21 15:24:45 +03:00
parent 9322e91d1b
commit d67e177733
6 changed files with 58 additions and 57 deletions

View File

@ -25,6 +25,8 @@ jobs:
run: |
./v vet vlib/sqlite
./v vet vlib/v
./v vet cmd/v
./v vet cmd/tools
- name: v fmt -verify
run: |
./v fmt -verify vlib/builtin/array.v

View File

@ -1,7 +1,6 @@
// Copyright (c) 2019-2020 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
import os
import time
@ -30,7 +29,6 @@ fn main() {
}
commit_hash = last_commit.trim_space()
}
if !os.exists('table.html') {
os.create('table.html') ?
}
@ -72,9 +70,8 @@ fn main() {
date := time.unix(commit_date.int())
mut out := os.create('table.html') ?
// Place the new row on top
table =
'<tr>
<td>${date.format()}</td>
table = '<tr>
<td>$date.format()</td>
<td><a target=_blank href="https://github.com/vlang/v/commit/$commit">$commit</a></td>
<td>$message</td>
<td>${diff1}ms</td>
@ -99,12 +96,14 @@ fn main() {
}
fn exec(s string) string {
e := os.exec(s) or { panic(err) }
e := os.exec(s) or {
panic(err)
}
return e.output.trim_right('\r\n')
}
// returns milliseconds
fn measure(cmd, description string) int {
fn measure(cmd string, description string) int {
println(' Measuring $description')
println(' Warming up...')
for _ in 0 .. 3 {

View File

@ -6,25 +6,25 @@ import vgit
const (
tool_version = '0.0.3'
tool_description = ' Checkout an old V and compile it as it was on specific commit.
This tool is useful, when you want to discover when something broke.
It is also useful, when you just want to experiment with an older historic V.
The VCOMMIT argument can be a git commitish like HEAD or master and so on.
When oldv is used with git bisect, you probably want to give HEAD. For example:
git bisect start
git bisect bad
git checkout known_good_commit
git bisect good
## Now git will automatically checkout a middle commit between the bad and the good
cmd/tools/oldv HEAD --command="run commands in oldv folder, to verify if the commit is good or bad"
## See what the result is, and either do: ...
git bisect good
## ... or do:
git bisect bad
## Now you just repeat the above steps, each time running oldv with the same command, then mark the result as good or bad,
## until you find the commit, where the problem first occurred.
## When you finish, do not forget to do:
git bisect reset'
| This tool is useful, when you want to discover when something broke.
| It is also useful, when you just want to experiment with an older historic V.
|
| The VCOMMIT argument can be a git commitish like HEAD or master and so on.
| When oldv is used with git bisect, you probably want to give HEAD. For example:
| git bisect start
| git bisect bad
| git checkout known_good_commit
| git bisect good
| ## Now git will automatically checkout a middle commit between the bad and the good
| cmd/tools/oldv HEAD --command="run commands in oldv folder, to verify if the commit is good or bad"
| ## See what the result is, and either do: ...
| git bisect good
| ## ... or do:
| git bisect bad
| ## Now you just repeat the above steps, each time running oldv with the same command, then mark the result as good or bad,
| ## until you find the commit, where the problem first occurred.
| ## When you finish, do not forget to do:
| git bisect reset'.strip_margin()
)
struct Context {

View File

@ -6,9 +6,9 @@ import vgit
const (
tool_version = '0.0.5'
tool_description = " Compares V executable size and performance,
between 2 commits from V\'s local git history.
When only one commit is given, it is compared to master.
"
| between 2 commits from V\'s local git history.
| When only one commit is given, it is compared to master.
| ".strip_margin()
)
struct Context {

View File

@ -87,12 +87,12 @@ fn (r &Repl) current_source_code(should_add_temp_lines bool) string {
fn repl_help() {
println(util.full_v_version(false))
println('
help Displays this information.
list Show the program so far.
reset Clears the accumulated program, so you can start a fresh.
Ctrl-C, Ctrl-D, exit Exits the REPL.
clear Clears the screen.
')
|help Displays this information.
|list Show the program so far.
|reset Clears the accumulated program, so you can start a fresh.
|Ctrl-C, Ctrl-D, exit Exits the REPL.
|clear Clears the screen.
'.strip_margin())
}
fn run_repl(workdir string, vrepl_prefix string) {

View File

@ -11,7 +11,6 @@ import os
#include <termios.h>
#include <sys/ioctl.h>
// Defines actions to execute
enum Action {
eof
@ -181,8 +180,7 @@ fn (r Readline) analyse(c int) Action {
Action.insert_character
} else {
Action.nothing
}
}
} }
}
}
@ -286,7 +284,7 @@ fn get_screen_columns() int {
return cols
}
fn shift_cursor(xpos, yoffset int) {
fn shift_cursor(xpos int, yoffset int) {
if yoffset != 0 {
if yoffset > 0 {
term.cursor_down(yoffset)
@ -298,7 +296,7 @@ fn shift_cursor(xpos, yoffset int) {
print('\x1b[${xpos + 1}G')
}
fn calculate_screen_position(x_in, y_in, screen_columns, char_count int, inp []int) []int {
fn calculate_screen_position(x_in int, y_in int, screen_columns int, char_count int, inp []int) []int {
mut out := inp
mut x := x_in
mut y := y_in
@ -451,7 +449,10 @@ fn (mut r Readline) switch_overwrite() {
}
fn (mut r Readline) clear_screen() {
term.set_cursor_position(x:1, y:1)
term.set_cursor_position({
x: 1
y: 1
})
term.erase_clear()
r.refresh_line()
}
@ -481,7 +482,6 @@ fn (mut r Readline) history_next() {
fn (mut r Readline) suspend() {
is_standalone := os.getenv('VCHILD') != 'true'
r.disable_raw_mode()
if !is_standalone {
// We have to SIGSTOP the parent v process