Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt: fix alignment of struct fields init #22000

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions cmd/tools/gen_vc.v
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn new_gen_vc(flag_options FlagOptions) &GenVC {
}
return &GenVC{
options: flag_options
logger: logger
logger : logger
}
}

Expand Down Expand Up @@ -171,14 +171,14 @@ pub fn (ws &WebhookServer) reset() {
// parse flags to FlagOptions struct
fn parse_flags(mut fp flag.FlagParser) FlagOptions {
return FlagOptions{
serve: fp.bool('serve', 0, false, 'run in webhook server mode')
serve : fp.bool('serve', 0, false, 'run in webhook server mode')
work_dir: fp.string('work-dir', 0, work_dir, 'gen_vc working directory')
purge: fp.bool('purge', 0, false, 'force purge the local repositories')
port: fp.int('port', 0, server_port, 'port for web server to listen on')
log_to: fp.string('log-to', 0, log_to, "log to is 'file' or 'terminal'")
purge : fp.bool('purge', 0, false, 'force purge the local repositories')
port : fp.int('port', 0, server_port, 'port for web server to listen on')
log_to : fp.string('log-to', 0, log_to, "log to is 'file' or 'terminal'")
log_file: fp.string('log-file', 0, log_file, "log file to use when log-to is 'file'")
dry_run: fp.bool('dry-run', 0, dry_run, 'when specified dont push anything to remote repo')
force: fp.bool('force', 0, false, 'force update even if already up to date')
dry_run : fp.bool('dry-run', 0, dry_run, 'when specified dont push anything to remote repo')
force : fp.bool('force', 0, false, 'force update even if already up to date')
}
}

Expand Down
10 changes: 5 additions & 5 deletions cmd/tools/measure/fmt_speed.v
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ fn process_files(files []string) ! {
fn new_parser(path string, comments_mode scanner.CommentsMode, table &ast.Table, pref_ &pref.Preferences) &parser.Parser {
mut p := &parser.Parser{
scanner: scanner.new_scanner_file(path, comments_mode, pref_) or { panic(err) }
table: table
pref: pref_
scope: &ast.Scope{
table : table
pref : pref_
scope : &ast.Scope{
start_pos: 0
parent: table.global_scope
parent : table.global_scope
}
errors: []errors.Error{}
errors : []errors.Error{}
warnings: []errors.Warning{}
}
p.set_path(path)
Expand Down
10 changes: 5 additions & 5 deletions cmd/tools/measure/parser_speed.v
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ fn process_files(files []string) ! {
fn new_parser(path string, comments_mode scanner.CommentsMode, table &ast.Table, pref_ &pref.Preferences) &parser.Parser {
mut p := &parser.Parser{
scanner: scanner.new_scanner_file(path, comments_mode, pref_) or { panic(err) }
table: table
pref: pref_
scope: &ast.Scope{
table : table
pref : pref_
scope : &ast.Scope{
start_pos: 0
parent: table.global_scope
parent : table.global_scope
}
errors: []errors.Error{}
errors : []errors.Error{}
warnings: []errors.Warning{}
}
p.set_path(path)
Expand Down
36 changes: 18 additions & 18 deletions cmd/tools/modules/testing/common.v
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@ mut:

fn (mut ts TestSession) append_message(kind MessageKind, msg string, mtc MessageThreadContext) {
ts.nmessages <- LogMessage{
file: mtc.file
file : mtc.file
flow_id: mtc.flow_id
message: msg
kind: kind
when: time.now()
kind : kind
when : time.now()
}
}

fn (mut ts TestSession) append_message_with_duration(kind MessageKind, msg string, d time.Duration, mtc MessageThreadContext) {
ts.nmessages <- LogMessage{
file: mtc.file
file : mtc.file
flow_id: mtc.flow_id
message: msg
kind: kind
when: time.now()
took: d
kind : kind
when : time.now()
took : d
}
}

Expand Down Expand Up @@ -310,16 +310,16 @@ pub fn new_test_session(_vargs string, will_compile bool) TestSession {
os.setenv('VCOLORS', 'always', true)
}
mut ts := TestSession{
vexe: vexe
vroot: vroot
skip_files: skip_files
fail_fast: testing.fail_fast
show_stats: '-stats' in vargs.split(' ')
show_asserts: '-show-asserts' in vargs.split(' ')
vargs: vargs
vtmp_dir: new_vtmp_dir
hash: hash
silent_mode: _vargs.contains('-silent')
vexe : vexe
vroot : vroot
skip_files : skip_files
fail_fast : testing.fail_fast
show_stats : '-stats' in vargs.split(' ')
show_asserts : '-show-asserts' in vargs.split(' ')
vargs : vargs
vtmp_dir : new_vtmp_dir
hash : hash
silent_mode : _vargs.contains('-silent')
progress_mode: _vargs.contains('-progress')
}
ts.handle_test_runner_option()
Expand Down Expand Up @@ -493,7 +493,7 @@ fn worker_trunner(mut p pool.PoolProcessor, idx int, thread_id int) voidptr {
}
file := os.real_path(relative_file)
mtc := MessageThreadContext{
file: file
file : file
flow_id: thread_id.str()
}
normalised_relative_file := relative_file.replace('\\', '/')
Expand Down
16 changes: 8 additions & 8 deletions cmd/tools/oldv.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ mut:

fn (mut c Context) compile_oldv_if_needed() {
c.vgcontext = vgit.VGitContext{
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
vc_repo_url: c.vgo.vc_repo_url
cc: c.cc
commit_v: c.commit_v
path_v: c.path_v
path_vc: c.path_vc
workdir : c.vgo.workdir
v_repo_url : c.vgo.v_repo_url
vc_repo_url : c.vgo.vc_repo_url
cc : c.cc
commit_v : c.commit_v
path_v : c.path_v
path_vc : c.path_vc
make_fresh_tcc: c.fresh_tcc
show_vccommit: c.show_vccommit
show_vccommit : c.show_vccommit
}
c.vgcontext.compile_oldv_if_needed()
c.commit_v_hash = c.vgcontext.commit_v__hash
Expand Down
16 changes: 8 additions & 8 deletions cmd/tools/performance_compare.v
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ mut:

fn new_context() Context {
return Context{
cwd: os.getwd()
cwd : os.getwd()
commit_after: 'master'
warmups: 4
warmups : 4
}
}

Expand Down Expand Up @@ -80,12 +80,12 @@ fn (c &Context) prepare_v(cdir string, commit string) {
cc = 'cc'
}
mut vgit_context := vgit.VGitContext{
cc: cc
commit_v: commit
path_v: cdir
path_vc: c.vc
workdir: c.vgo.workdir
v_repo_url: c.vgo.v_repo_url
cc : cc
commit_v : commit
path_v : cdir
path_vc : c.vc
workdir : c.vgo.workdir
v_repo_url : c.vgo.v_repo_url
vc_repo_url: c.vgo.vc_repo_url
}
vgit_context.compile_oldv_if_needed()
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vast/vast.v
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ fn json(file string) string {
pref_.is_fmt = true
//
mut t := Tree{
root: new_object()
root : new_object()
table: ast.new_table()
pref: pref_
pref : pref_
}
// parse file with comment
ast_file := parser.parse_file(file, mut t.table, .parse_comments, t.pref)
Expand Down
8 changes: 4 additions & 4 deletions cmd/tools/vbump.v
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ Try ${tool_name} -h for more help...')

options := Options{
show_help: fp.bool('help', `h`, false, 'Show this help text.')
patch: fp.bool('patch', `p`, false, 'Bump the patch version.')
minor: fp.bool('minor', `n`, false, 'Bump the minor version.')
major: fp.bool('major', `m`, false, 'Bump the major version.')
skip: fp.string('skip', `s`, '', 'Skip lines matching this substring.').trim_space()
patch : fp.bool('patch', `p`, false, 'Bump the patch version.')
minor : fp.bool('minor', `n`, false, 'Bump the minor version.')
major : fp.bool('major', `m`, false, 'Bump the major version.')
skip : fp.string('skip', `s`, '', 'Skip lines matching this substring.').trim_space()
}

remaining := fp.finalize() or {
Expand Down
18 changes: 9 additions & 9 deletions cmd/tools/vbump_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct BumpTestCase {
const test_cases = [
BumpTestCase{
file_name: 'v.mod'
contents: "Module {
contents : "Module {
name: 'Sample'
description: 'Sample project'
version: '1.2.6'
Expand All @@ -32,28 +32,28 @@ const test_cases = [
}

"
line: 3
line : 3
expected_patch: " version: '1.2.7'"
expected_minor: " version: '1.3.0'"
expected_major: " version: '2.0.0'"
},
BumpTestCase{
file_name: 'random_versions.vv'
contents: "
contents : "
1.1.2
1.2.5
3.21.73
version = '1.5.1'

"
line: 4
line : 4
expected_patch: "version = '1.5.2'"
expected_minor: "version = '1.6.0'"
expected_major: "version = '2.0.0'"
},
BumpTestCase{
file_name: 'sample_tool.v'
contents: "// Module comment and copyright information
contents : "// Module comment and copyright information
import os
import flag

Expand All @@ -64,7 +64,7 @@ fn main() {
// stuff
}
"
line: 5
line : 5
expected_patch: "const tool_version = '0.1.34'"
expected_minor: "const tool_version = '0.2.0'"
expected_major: "const tool_version = '1.0.0'"
Expand Down Expand Up @@ -111,7 +111,7 @@ struct SkipTestCase {
const skip_test_cases = [
SkipTestCase{
file_name: 'CITATION.cff'
contents: 'abstract: A sample CLI tool made in V that prints geometric shapes to the screen.
contents : 'abstract: A sample CLI tool made in V that prints geometric shapes to the screen.
authors:
- alias: hungrybluedev
family-names: Haldar
Expand All @@ -125,8 +125,8 @@ title: geo
url: https://github.com/hungrybluedev/geo
version: 0.2.4
'
line: 12
skip: 'cff-version'
line : 12
skip : 'cff-version'
expected_patch: 'version: 0.2.5'
expected_minor: 'version: 0.3.0'
expected_major: 'version: 1.0.0'
Expand Down
18 changes: 9 additions & 9 deletions cmd/tools/vcheck-md.v
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ pub mut:

fn (v1 CheckResult) + (v2 CheckResult) CheckResult {
return CheckResult{
files: v1.files + v2.files
files : v1.files + v2.files
warnings: v1.warnings + v2.warnings
errors: v1.errors + v2.errors
oks: v1.oks + v2.oks
errors : v1.errors + v2.errors
oks : v1.oks + v2.oks
}
}

Expand Down Expand Up @@ -77,8 +77,8 @@ fn main() {
}
mut mdfile := MDFile{
skip_line_length_check: skip_line_length_check
path: file_path
lines: lines
path : file_path
lines : lines
}
res += mdfile.check()
}
Expand Down Expand Up @@ -243,7 +243,7 @@ fn (mut f MDFile) parse_line(lnumber int, line string) {
command += ' ${default_command}'
}
f.current = VCodeExample{
sline: lnumber
sline : lnumber
command: command
}
}
Expand Down Expand Up @@ -305,7 +305,7 @@ fn (mut ad AnchorData) add_links(line_number int, line string) {
re.match_string(elem)
link := re.get_group_by_name(elem, 'link')
ad.links[link] << AnchorLink{
line: line_number
line : line_number
label: re.get_group_by_name(elem, 'label')
}
}
Expand All @@ -317,7 +317,7 @@ fn (mut ad AnchorData) add_link_targets(line_number int, line string) {
headline := line.substr(headline_start_pos + 1, line.len)
link := create_ref_link(headline)
ad.anchors[link] << Headline{
line: line_number
line : line_number
label: headline
level: headline_start_pos
}
Expand Down Expand Up @@ -634,7 +634,7 @@ fn (mut f MDFile) check_examples() CheckResult {
}
return CheckResult{
errors: errors
oks: oks
oks : oks
}
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vcover/main.v
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ fn (mut ctx Context) process_target(tfile string) ! {
for {
row := reader.read() or { break }
mut cline := CounterLine{
meta: row[0]
meta : row[0]
point: row[1].int()
hits: row[2].u64()
hits : row[2].u64()
}
m := ctx.meta[cline.meta] or {
ctx.verbose('> skipping invalid meta: ${cline.meta} in file: ${cline.file}, csvfile: ${tfile}')
Expand Down
2 changes: 1 addition & 1 deletion cmd/tools/vcreate/project_model_bin.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import os
fn (mut c Create) set_bin_project_files() {
base := if c.new_dir { c.name } else { '' }
c.files << ProjectFiles{
path: os.join_path(base, 'src', 'main.v')
path : os.join_path(base, 'src', 'main.v')
content: "module main

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions cmd/tools/vcreate/project_model_lib.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import os
fn (mut c Create) set_lib_project_files() {
base := if c.new_dir { c.name } else { '' }
c.files << ProjectFiles{
path: os.join_path(base, 'src', c.name + '.v')
path : os.join_path(base, 'src', c.name + '.v')
content: 'module ${c.name}

// square calculates the second power of `x`
Expand All @@ -15,7 +15,7 @@ pub fn square(x int) int {
'
}
c.files << ProjectFiles{
path: os.join_path(base, 'tests', 'square_test.v')
path : os.join_path(base, 'tests', 'square_test.v')
content: 'import ${c.name}

fn test_square() {
Expand Down
Loading
Loading