chore: add .editorconfig .golangci.yml

This commit is contained in:
MuXiu1997
2023-01-25 02:31:00 +08:00
parent a5d338545d
commit 52e9daf794
2 changed files with 103 additions and 0 deletions

59
.editorconfig Normal file
View File

@@ -0,0 +1,59 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 120
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false
[{*.go,*.go2}]
indent_style = tab
ij_continuation_indent_size = 4
ij_go_GROUP_CURRENT_PROJECT_IMPORTS = false
ij_go_add_leading_space_to_comments = false
ij_go_add_parentheses_for_single_import = false
ij_go_call_parameters_new_line_after_left_paren = true
ij_go_call_parameters_right_paren_on_new_line = true
ij_go_call_parameters_wrap = off
ij_go_fill_paragraph_width = 80
ij_go_group_stdlib_imports = false
ij_go_import_sorting = gofmt
ij_go_keep_indents_on_empty_lines = false
ij_go_local_group_mode = project
ij_go_move_all_imports_in_one_declaration = false
ij_go_move_all_stdlib_imports_in_one_group = false
ij_go_remove_redundant_import_aliases = false
ij_go_run_go_fmt_on_reformat = true
ij_go_use_back_quotes_for_imports = false
ij_go_wrap_comp_lit = off
ij_go_wrap_comp_lit_newline_after_lbrace = true
ij_go_wrap_comp_lit_newline_before_rbrace = true
ij_go_wrap_func_params = off
ij_go_wrap_func_params_newline_after_lparen = true
ij_go_wrap_func_params_newline_before_rparen = true
ij_go_wrap_func_result = off
ij_go_wrap_func_result_newline_after_lparen = true
ij_go_wrap_func_result_newline_before_rparen = true
[{*.yaml,*.yml}]
indent_size = 2
ij_yaml_align_values_properties = do_not_align
ij_yaml_autoinsert_sequence_marker = true
ij_yaml_block_mapping_on_new_line = false
ij_yaml_indent_sequence_value = true
ij_yaml_keep_indents_on_empty_lines = false
ij_yaml_keep_line_breaks = true
ij_yaml_sequence_on_new_line = false
ij_yaml_space_before_colon = false
ij_yaml_spaces_within_braces = true
ij_yaml_spaces_within_brackets = true

44
.golangci.yml Normal file
View File

@@ -0,0 +1,44 @@
run:
modules-download-mode: vendor
go: '1.19'
linters:
enable:
# region - default
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
# endregion - default
- gofmt
- gofumpt
- goimports
- cyclop
- whitespace
- decorder
- exportloopref
- funlen
- gci
- goconst
- gocritic
- gomoddirectives
- gosec
- grouper
- importas
- nilnil
- nosprintfhostport
- unconvert
- unparam
- usestdlibvars
linters-settings:
gofumpt:
extra-rules: true
cyclop:
max-complexity: 20
issues:
fix: true