mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
tools: fix typos (#19546)
This commit is contained in:
parent
491b5f7614
commit
2332c17bea
14 changed files with 38 additions and 38 deletions
|
@ -207,7 +207,7 @@ fn (mut gen_vc GenVC) generate() {
|
||||||
if !os.is_dir(gen_vc.options.work_dir) {
|
if !os.is_dir(gen_vc.options.work_dir) {
|
||||||
// try create
|
// try create
|
||||||
os.mkdir(gen_vc.options.work_dir) or { panic(err) }
|
os.mkdir(gen_vc.options.work_dir) or { panic(err) }
|
||||||
// still dosen't exist... we have a problem
|
// still doesn't exist... we have a problem
|
||||||
if !os.is_dir(gen_vc.options.work_dir) {
|
if !os.is_dir(gen_vc.options.work_dir) {
|
||||||
gen_vc.logger.error('error creating directory: ${gen_vc.options.work_dir}')
|
gen_vc.logger.error('error creating directory: ${gen_vc.options.work_dir}')
|
||||||
gen_vc.gen_error = true
|
gen_vc.gen_error = true
|
||||||
|
@ -219,7 +219,7 @@ fn (mut gen_vc GenVC) generate() {
|
||||||
// if we are not running with the --serve flag (webhook server)
|
// if we are not running with the --serve flag (webhook server)
|
||||||
// rather than deleting and re-downloading the repo each time
|
// rather than deleting and re-downloading the repo each time
|
||||||
// first check to see if the local v repo is behind master
|
// first check to see if the local v repo is behind master
|
||||||
// if it isn't behind theres no point continuing further
|
// if it isn't behind there's no point continuing further
|
||||||
if !gen_vc.options.serve && os.is_dir(git_repo_dir_v) {
|
if !gen_vc.options.serve && os.is_dir(git_repo_dir_v) {
|
||||||
gen_vc.cmd_exec('git -C ${git_repo_dir_v} checkout master')
|
gen_vc.cmd_exec('git -C ${git_repo_dir_v} checkout master')
|
||||||
// fetch the remote repo just in case there are newer commits there
|
// fetch the remote repo just in case there are newer commits there
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
import os
|
import os
|
||||||
import term
|
import term
|
||||||
|
|
||||||
// This script can be used to ensure that all commited V files are vfmt-ed automatically.
|
// This script can be used to ensure that all committed V files are vfmt-ed automatically.
|
||||||
// By default, once setup, it will run `v fmt -w` on them, before commiting them.
|
// By default, once setup, it will run `v fmt -w` on them, before committing them.
|
||||||
|
|
||||||
// To use the script in your V project, you need to be in the main folder
|
// To use the script in your V project, you need to be in the main folder
|
||||||
// of your project, then do the equivalent of:
|
// of your project, then do the equivalent of:
|
||||||
|
@ -15,8 +15,8 @@ import term
|
||||||
//
|
//
|
||||||
// Note: you can use this command:
|
// Note: you can use this command:
|
||||||
// `git config --bool --add hooks.stopCommitOfNonVfmtedVFiles true`
|
// `git config --bool --add hooks.stopCommitOfNonVfmtedVFiles true`
|
||||||
// ... to make it just *prevent* the commiting of unformatted .v files,
|
// ... to make it just *prevent* the committing of unformatted .v files,
|
||||||
// i.e. stop the commiting, if they are not, but *without modifying them*
|
// i.e. stop the committing, if they are not, but *without modifying them*
|
||||||
// automatically (you will then need to run `v fmt -w` on them manually).
|
// automatically (you will then need to run `v fmt -w` on them manually).
|
||||||
//
|
//
|
||||||
// Note 2: Git supports skipping the hooks, by passing the `--no-verify` option.
|
// Note 2: Git supports skipping the hooks, by passing the `--no-verify` option.
|
||||||
|
@ -24,7 +24,7 @@ import term
|
||||||
// the hook.
|
// the hook.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// This hook cares only about the changed V files, that will be commited, as reported by git itself:
|
// This hook cares only about the changed V files, that will be committed, as reported by git itself:
|
||||||
changed := os.execute('git diff --cached --name-only --diff-filter=ACMR -- "*.v" "*.vsh" "*.vv"')
|
changed := os.execute('git diff --cached --name-only --diff-filter=ACMR -- "*.v" "*.vsh" "*.vv"')
|
||||||
|
|
||||||
all_changed_vfiles := changed.output.trim_space().split('\n')
|
all_changed_vfiles := changed.output.trim_space().split('\n')
|
||||||
|
@ -43,8 +43,8 @@ fn main() {
|
||||||
eprintln('>>> 0 changed V files, that may need formatting found.')
|
eprintln('>>> 0 changed V files, that may need formatting found.')
|
||||||
exit(0)
|
exit(0)
|
||||||
}
|
}
|
||||||
configured_stop_commiting := os.execute('git config --bool hooks.stopCommitOfNonVfmtedVFiles')
|
configured_stop_committing := os.execute('git config --bool hooks.stopCommitOfNonVfmtedVFiles')
|
||||||
if configured_stop_commiting.output.trim_space().bool() {
|
if configured_stop_committing.output.trim_space().bool() {
|
||||||
verify_result := os.execute('v fmt -verify ${vfiles.join(' ')}')
|
verify_result := os.execute('v fmt -verify ${vfiles.join(' ')}')
|
||||||
if verify_result.exit_code != 0 {
|
if verify_result.exit_code != 0 {
|
||||||
eprintln(verify_result.output)
|
eprintln(verify_result.output)
|
||||||
|
|
|
@ -723,7 +723,7 @@ pub fn setup_new_vtmp_folder() string {
|
||||||
pub struct TestDetails {
|
pub struct TestDetails {
|
||||||
pub mut:
|
pub mut:
|
||||||
retry int
|
retry int
|
||||||
flaky bool // when flaky tests fail, the whole run is still considered successfull, unless VTEST_FAIL_FLAKY is 1
|
flaky bool // when flaky tests fail, the whole run is still considered successful, unless VTEST_FAIL_FLAKY is 1
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_test_details(file string) TestDetails {
|
pub fn get_test_details(file string) TestDetails {
|
||||||
|
|
|
@ -276,9 +276,9 @@ fn (mut context Context) run() {
|
||||||
eprintln('${i:10} non 0 exit code for cmd: ${cmd}')
|
eprintln('${i:10} non 0 exit code for cmd: ${cmd}')
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
trimed_output := res.output.trim_right('\r\n')
|
trimmed_output := res.output.trim_right('\r\n')
|
||||||
trimed_normalized := trimed_output.replace('\r\n', '\n')
|
trimmed_normalized := trimmed_output.replace('\r\n', '\n')
|
||||||
lines := trimed_normalized.split('\n')
|
lines := trimmed_normalized.split('\n')
|
||||||
for line in lines {
|
for line in lines {
|
||||||
context.results[icmd].outputs << line
|
context.results[icmd].outputs << line
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ interface Myinterfacer {
|
||||||
sub(int, int) int
|
sub(int, int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
// main funciton
|
// main function
|
||||||
fn main() {
|
fn main() {
|
||||||
add(1, 3)
|
add(1, 3)
|
||||||
println(add(1, 2))
|
println(add(1, 2))
|
||||||
|
|
|
@ -16,7 +16,7 @@ fn get_vdoctor_output(is_verbose bool) string {
|
||||||
return result.output
|
return result.output
|
||||||
}
|
}
|
||||||
|
|
||||||
// get ouput from `v -g -o vdbg cmd/v && vdbg file.v`
|
// get output from `v -g -o vdbg cmd/v && vdbg file.v`
|
||||||
fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
|
fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
|
||||||
mut vexe := os.getenv('VEXE')
|
mut vexe := os.getenv('VEXE')
|
||||||
// prepare a V compiler with -g to have better backtraces if possible
|
// prepare a V compiler with -g to have better backtraces if possible
|
||||||
|
|
|
@ -265,7 +265,7 @@ fn (mut f MDFile) parse_line(lnumber int, line string) {
|
||||||
|
|
||||||
struct Headline {
|
struct Headline {
|
||||||
line int
|
line int
|
||||||
lable string
|
label string
|
||||||
level int
|
level int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ type AnchorTarget = Anchor | Headline
|
||||||
|
|
||||||
struct AnchorLink {
|
struct AnchorLink {
|
||||||
line int
|
line int
|
||||||
lable string
|
label string
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AnchorData {
|
struct AnchorData {
|
||||||
|
@ -287,7 +287,7 @@ mut:
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut ad AnchorData) add_links(line_number int, line string) {
|
fn (mut ad AnchorData) add_links(line_number int, line string) {
|
||||||
query := r'\[(?P<lable>[^\]]+)\]\(\s*#(?P<link>[a-z0-9\-\_\x7f-\uffff]+)\)'
|
query := r'\[(?P<label>[^\]]+)\]\(\s*#(?P<link>[a-z0-9\-\_\x7f-\uffff]+)\)'
|
||||||
mut re := regex.regex_opt(query) or { panic(err) }
|
mut re := regex.regex_opt(query) or { panic(err) }
|
||||||
res := re.find_all_str(line)
|
res := re.find_all_str(line)
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ fn (mut ad AnchorData) add_links(line_number int, line string) {
|
||||||
link := re.get_group_by_name(elem, 'link')
|
link := re.get_group_by_name(elem, 'link')
|
||||||
ad.links[link] << AnchorLink{
|
ad.links[link] << AnchorLink{
|
||||||
line: line_number
|
line: line_number
|
||||||
lable: re.get_group_by_name(elem, 'lable')
|
label: re.get_group_by_name(elem, 'label')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ fn (mut ad AnchorData) add_link_targets(line_number int, line string) {
|
||||||
link := create_ref_link(headline)
|
link := create_ref_link(headline)
|
||||||
ad.anchors[link] << Headline{
|
ad.anchors[link] << Headline{
|
||||||
line: line_number
|
line: line_number
|
||||||
lable: headline
|
label: headline
|
||||||
level: headline_start_pos
|
level: headline_start_pos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ fn (mut ad AnchorData) check_link_target_match(fpath string, mut res CheckResult
|
||||||
found_error_warning = true
|
found_error_warning = true
|
||||||
res.errors++
|
res.errors++
|
||||||
for brokenlink in linkdata {
|
for brokenlink in linkdata {
|
||||||
eprintln(eline(fpath, brokenlink.line, 0, 'no link target found for existing link [${brokenlink.lable}](#${link})'))
|
eprintln(eline(fpath, brokenlink.line, 0, 'no link target found for existing link [${brokenlink.label}](#${link})'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -651,7 +651,7 @@ fn (mut f MDFile) report_not_formatted_example_if_needed(e VCodeExample, fmt_res
|
||||||
}
|
}
|
||||||
f.autofix_example(e, vfile) or {
|
f.autofix_example(e, vfile) or {
|
||||||
if err is ExampleWasRewritten {
|
if err is ExampleWasRewritten {
|
||||||
eprintln('>> f.path: ${f.path} | example from ${e.sline} to ${e.eline} was re-formated by vfmt')
|
eprintln('>> f.path: ${f.path} | example from ${e.sline} to ${e.eline} was re-formatted by vfmt')
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
eprintln('>> f.path: ${f.path} | encountered error while autofixing the example: ${err}')
|
eprintln('>> f.path: ${f.path} | encountered error while autofixing the example: ${err}')
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
# Reasons for ex- or inclusion:
|
# Reasons for ex- or inclusion:
|
||||||
#
|
#
|
||||||
# 'examples/snek/snek.v' // Inacurrate captures
|
# 'examples/snek/snek.v' // Inaccurate captures
|
||||||
# 'examples/game_of_life/life_gg.v' // OK
|
# 'examples/game_of_life/life_gg.v' // OK
|
||||||
# 'examples/tetris/tetris.v' // Uses random start block
|
# 'examples/tetris/tetris.v' // Uses random start block
|
||||||
# 'examples/fireworks/fireworks.v' // Uses rand for placement
|
# 'examples/fireworks/fireworks.v' // Uses rand for placement
|
||||||
|
@ -63,12 +63,12 @@
|
||||||
# 'examples/2048/2048.v' // Random start tiles
|
# 'examples/2048/2048.v' // Random start tiles
|
||||||
# 'examples/clock/clock.v' // Can only be tested on exact points in time :)
|
# 'examples/clock/clock.v' // Can only be tested on exact points in time :)
|
||||||
# 'examples/flappylearning/game.v' // Random movement
|
# 'examples/flappylearning/game.v' // Random movement
|
||||||
# 'examples/hot_reload/bounce.v' // Inacurrate captures
|
# 'examples/hot_reload/bounce.v' // Inaccurate captures
|
||||||
# 'examples/hot_reload/graph.v' // Inacurrate captures
|
# 'examples/hot_reload/graph.v' // Inaccurate captures
|
||||||
# 'examples/ttf_font/example_ttf.v', // OK
|
# 'examples/ttf_font/example_ttf.v', // OK
|
||||||
# 'examples/sokol/01_cubes/cube.v', // Can pass with a warning and diff at around 1.2%
|
# 'examples/sokol/01_cubes/cube.v', // Can pass with a warning and diff at around 1.2%
|
||||||
# 'examples/sokol/02_cubes_glsl/cube_glsl.v', // Inacurrate captures
|
# 'examples/sokol/02_cubes_glsl/cube_glsl.v', // Inaccurate captures
|
||||||
# 'examples/sokol/03_march_tracing_glsl/rt_glsl.v', // Inacurrate captures
|
# 'examples/sokol/03_march_tracing_glsl/rt_glsl.v', // Inaccurate captures
|
||||||
# 'examples/sokol/04_multi_shader_glsl/rt_glsl.v', // Inacurrate captures
|
# 'examples/sokol/04_multi_shader_glsl/rt_glsl.v', // Inaccurate captures
|
||||||
# 'examples/sokol/05_instancing_glsl/rt_glsl.v', // Inacurrate captures
|
# 'examples/sokol/05_instancing_glsl/rt_glsl.v', // Inaccurate captures
|
||||||
# 'examples/sokol/06_obj_viewer/show_obj.v', // Inacurrate captures
|
# 'examples/sokol/06_obj_viewer/show_obj.v', // Inaccurate captures
|
||||||
|
|
|
@ -321,7 +321,7 @@ fn vpm_install_from_vcs(module_names []string, vcs_key string) {
|
||||||
if final_module_path != minfo.final_module_path {
|
if final_module_path != minfo.final_module_path {
|
||||||
println('Relocating module from "${name}" to "${vmod_.name}" ( "${minfo.final_module_path}" ) ...')
|
println('Relocating module from "${name}" to "${vmod_.name}" ( "${minfo.final_module_path}" ) ...')
|
||||||
if os.exists(minfo.final_module_path) {
|
if os.exists(minfo.final_module_path) {
|
||||||
eprintln('Warning module "${minfo.final_module_path}" already exsits!')
|
eprintln('Warning module "${minfo.final_module_path}" already exists!')
|
||||||
eprintln('Removing module "${minfo.final_module_path}" ...')
|
eprintln('Removing module "${minfo.final_module_path}" ...')
|
||||||
os.rmdir_all(minfo.final_module_path) or {
|
os.rmdir_all(minfo.final_module_path) or {
|
||||||
errors++
|
errors++
|
||||||
|
|
|
@ -181,7 +181,7 @@ fn compile_shaders(opt Options, input_path string) ! {
|
||||||
// compile_shader compiles `shader_file` to a C header file.
|
// compile_shader compiles `shader_file` to a C header file.
|
||||||
fn compile_shader(opt CompileOptions, shader_file string) ! {
|
fn compile_shader(opt CompileOptions, shader_file string) ! {
|
||||||
path := opt.invoke_path
|
path := opt.invoke_path
|
||||||
// The output convetion, for now, is to use the name of the .glsl file
|
// The output convention, for now, is to use the name of the .glsl file
|
||||||
mut out_file := os.file_name(shader_file).all_before_last('.') + '.h'
|
mut out_file := os.file_name(shader_file).all_before_last('.') + '.h'
|
||||||
out_file = os.join_path(path, out_file)
|
out_file = os.join_path(path, out_file)
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ fn get_all_commands() []Command {
|
||||||
line: '${vexe} run examples/v_script.vsh > /dev/null'
|
line: '${vexe} run examples/v_script.vsh > /dev/null'
|
||||||
okmsg: 'V can run the .VSH script file examples/v_script.vsh'
|
okmsg: 'V can run the .VSH script file examples/v_script.vsh'
|
||||||
}
|
}
|
||||||
// Note: -experimental is used here, just to suppress the warningss,
|
// Note: -experimental is used here, just to suppress the warnings,
|
||||||
// that are otherwise printed by the native backend,
|
// that are otherwise printed by the native backend,
|
||||||
// until globals and hash statements *are implemented*:
|
// until globals and hash statements *are implemented*:
|
||||||
$if linux {
|
$if linux {
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
// read_response is a carefully constructed comment.
|
// read_response is a carefully constructed comment.
|
||||||
// read_response_body. <-- this would earlier trigger a false
|
// read_response_body. <-- this would earlier trigger a false
|
||||||
// postive.
|
// positive.
|
||||||
pub fn read_response() ?(string, string) {}
|
pub fn read_response() ?(string, string) {}
|
||||||
|
|
|
@ -41,13 +41,13 @@ fn (mut fdr Finder) configure_from_arguments(args []string) {
|
||||||
}
|
}
|
||||||
fdr.visib.set_from_str(cmdline.option(args, '-vis', '${Visibility.all}'))
|
fdr.visib.set_from_str(cmdline.option(args, '-vis', '${Visibility.all}'))
|
||||||
if fdr.symbol == .var && fdr.visib != .all {
|
if fdr.symbol == .var && fdr.visib != .all {
|
||||||
make_and_print_error('-vis ${fdr.visib} just can be setted with symbol_type:',
|
make_and_print_error('-vis ${fdr.visib} just can be set with symbol_type:',
|
||||||
['fn', 'method', 'const', 'struct', 'enum', 'interface', 'regexp'],
|
['fn', 'method', 'const', 'struct', 'enum', 'interface', 'regexp'],
|
||||||
'${fdr.symbol}')
|
'${fdr.symbol}')
|
||||||
}
|
}
|
||||||
fdr.mutab.set_from_str(cmdline.option(args, '-mut', '${Mutability.any}'))
|
fdr.mutab.set_from_str(cmdline.option(args, '-mut', '${Mutability.any}'))
|
||||||
if fdr.symbol != .var && fdr.mutab != .any {
|
if fdr.symbol != .var && fdr.mutab != .any {
|
||||||
make_and_print_error('-mut ${fdr.mutab} just can be setted with symbol_type:',
|
make_and_print_error('-mut ${fdr.mutab} just can be set with symbol_type:',
|
||||||
['var'], '${fdr.symbol}')
|
['var'], '${fdr.symbol}')
|
||||||
}
|
}
|
||||||
fdr.modul = cmdline.option(args, '-mod', '')
|
fdr.modul = cmdline.option(args, '-mod', '')
|
||||||
|
@ -89,7 +89,7 @@ fn (mut fdr Finder) search_for_matches() {
|
||||||
// println(f)
|
// println(f)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Auxiliar rgx
|
// Auxiliary rgx
|
||||||
sp := r'\s*'
|
sp := r'\s*'
|
||||||
op := r'\('
|
op := r'\('
|
||||||
cp := r'\)'
|
cp := r'\)'
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub enum Public {
|
||||||
|
|
||||||
enum Private {
|
enum Private {
|
||||||
storable
|
storable
|
||||||
donwloadable
|
downloadable
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Drinker {
|
interface Drinker {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue