Skip to content

Commit 7417ee7

Browse files
authored
Refactor (#31)
* Update golangci-lint configuration and add project rules documentation * Add golangci-lint configuration file * Add .serena to .gitignore * Update revive linter rules in golangci configuration * Enhance test parallelism and update documentation - Added `t.Parallel()` to all test functions across various test files to improve test execution speed by allowing concurrent test execution. - Updated AGENTS.md to include usage instructions for golangci-lint. * refactor(tests): replace assert with require for error handling in test cases - Updated multiple test files to use `require.NoError` and `require.Error` instead of `assert.NoError` and `assert.Error` for better error handling. - Ensured consistency across test cases in `delete_test.go`, `expr_test.go`, `insert_test.go`, `placeholder_test.go`, `select_test.go`, `statement_test.go`, `update_test.go`, and `where_test.go`. - Improved readability and maintainability of tests by using `require` assertions. * Refactor SQL builder methods for consistency and error handling - Updated error handling in insert, update, and select builders to use more concise error messages. - Changed assertions in tests from assert to require for better failure handling. - Refactored SQL generation methods to return named return values for clarity. - Improved documentation comments for various methods to enhance code readability. - Adjusted placeholder handling in SQL generation to ensure proper formatting. - Enhanced pagination logic in the select builder to handle edge cases more effectively. * refactor: update init functions to include linter directives for builder registrations * refactor: streamline SQL generation methods for better readability and maintainability * refactor(tests): add tests for REPLACE and DELETE queries with CTEs
1 parent e651ace commit 7417ee7

25 files changed

+1110
-724
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.serena

.golangci.yaml

Lines changed: 0 additions & 94 deletions
This file was deleted.

.golangci.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
run:
2+
timeout: 5m
3+
issues-exit-code: 1
4+
tests: true
5+
6+
version: 2
7+
8+
output:
9+
format: colored-line-number
10+
print-issued-lines: true
11+
print-linter-name: true
12+
13+
linters:
14+
disable-all: true
15+
enable:
16+
- godot
17+
- copyloopvar
18+
- gocyclo
19+
- misspell
20+
- rowserrcheck
21+
- staticcheck
22+
- asasalint
23+
- asciicheck
24+
- bidichk
25+
- bodyclose
26+
# - cyclop
27+
- dupl
28+
- durationcheck
29+
- errcheck
30+
- errname
31+
- errorlint
32+
- exhaustive
33+
- exhaustruct
34+
- forbidigo
35+
- gocheckcompilerdirectives
36+
- gochecknoglobals
37+
- gochecknoinits
38+
- gochecksumtype
39+
- gocognit
40+
- goconst
41+
- gocritic
42+
- gomoddirectives
43+
- gomodguard
44+
- goprintffuncname
45+
- gosec
46+
- govet
47+
- ineffassign
48+
- lll
49+
- loggercheck
50+
- makezero
51+
- mirror
52+
- mnd
53+
- musttag
54+
- nakedret
55+
- nestif
56+
- nilerr
57+
- nilnil
58+
- noctx
59+
- nolintlint
60+
- nosprintfhostport
61+
- perfsprint
62+
- prealloc
63+
- predeclared
64+
- promlinter
65+
- protogetter
66+
- reassign
67+
- revive
68+
- sloglint
69+
- sqlclosecheck
70+
- testableexamples
71+
- testifylint
72+
- tparallel
73+
- unconvert
74+
- unparam
75+
- unused
76+
- usestdlibvars
77+
- wastedassign
78+
- whitespace
79+
- paralleltest
80+
settings:
81+
revive:
82+
rules:
83+
- name: var-naming
84+
disabled: true
85+
govet:
86+
check-shadowing: true
87+
gocyclo:
88+
min-complexity: 15
89+
dupl:
90+
threshold: 100
91+
goconst:
92+
min-len: 2
93+
min-occurrences: 2
94+
misspell:
95+
locale: US
96+
lll:
97+
line-length: 120
98+
goimports:
99+
local-prefixes: github.com/n-r-w/squirrel
100+
nolintlint:
101+
require-explanation: true
102+
require-specific: true
103+
gocritic:
104+
enabled-tags:
105+
- diagnostic
106+
- experimental
107+
- opinionated
108+
- performance
109+
- style
110+
disabled-checks:
111+
- dupImport
112+
- ifElseChain
113+
- octalLiteral
114+
- whyNoLint
115+
- wrapperFunc
116+
exclusions:
117+
generated: lax
118+
rules:
119+
- linters:
120+
- perfsprint
121+
- dupl
122+
- gochecknoglobals
123+
- gocognit
124+
- goconst
125+
- gocritic
126+
- gosec
127+
- govet
128+
- lll
129+
- revive
130+
- staticcheck
131+
- unparam
132+
- whitespace
133+
- gocyclo
134+
- cyclop
135+
path: _test\.go
136+
137+
exclude-use-default: false
138+
max-issues-per-linter: 0
139+
max-same-issues: 0
140+
new: false
141+
142+
severity:
143+
default-severity: error
144+
case-sensitive: false
145+
146+
formatters:
147+
enable:
148+
- goimports
149+
exclusions:
150+
generated: lax
151+
paths:
152+
- third_party$
153+
- builtin$
154+
- loadtest$
155+
- profile$
156+
- bench$

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Project Rules
2+
3+
## Tech Stack
4+
5+
- go 1.18
6+
- github.com/stretchr/testify for testing
7+
- golangci-lint-v2 for linting (`golangci-lint run --config .golangci.yml ./... `)

0 commit comments

Comments
 (0)