8000 `wsl` v5 - a complete rewrite ✍️ by bombsimon · Pull Request #169 · bombsimon/wsl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

wsl v5 - a complete rewrite ✍️ #169

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

Merged
merged 112 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
e5501b7
Initial boilerplate for rewrite
bombsimon Nov 4, 2023
e15c58a
Update dependencies, improve leading whitespace
bombsimon Mar 16, 2024
2d4137b
Add `Cursor`, explore `*ast.IfStmt`
bombsimon Mar 17, 2024
b52dfe0
Handle force error checking
bombsimon Mar 18, 2024
731e9ea
Handle if statements
bombsimon Mar 23, 2024
bd1297e
Improve cursor states, add test
bombsimon Mar 23, 2024
35f4640
WIP: Cursor
bombsimon May 4, 2024
58eaa02
Fix multiple if
bombsimon Jun 6, 2024
6d6e70e
Simplify resetting cursor
bombsimon Jun 6, 2024
1e3a52a
Improve handling of if
bombsimon Jun 6, 2024
a793bc0
Add support to force error cuddlig
bombsimon Jun 23, 2024
50ef04c
Add check for return
bombsimon Jun 25, 2024
d8f161e
Add test for else/else-if
bombsimon Sep 20, 2024
1471bab
For, range, switch
bombsimon Sep 26, 2024
bca7f80
Type switch
bombsimon Dec 25, 2024
618fed2
Branch
bombsimon Dec 25, 2024
f1f3260
Decl, check types config
bombsimon Dec 25, 2024
8000
2d5989f
More exploration with CheckType
bombsimon Dec 25, 2024
bd5c17b
Improve leading whitespace check
bombsimon Dec 31, 2024
20afa0e
Add initial expression statement check
bombsimon Jan 1, 2025
b972ec1
Go stmt
bombsimon Jan 1, 2025
b749b98
Reorganize tests
bombsimon Jan 1, 2025
5b7b0bd
Defer
bombsimon Jan 1, 2025
698c6a1
Support to enable/disable more checks
bombsimon Jan 2, 2025
1241225
Trailing newline
bombsimon Jan 2, 2025
abe45cf
Case clause leading newline
bombsimon Jan 2, 2025
de755a3
Append check and some refactoring
bombsimon Jan 6, 2025
9003d77
IncDec
bombsimon Jan 6, 2025
f70204c
Assign and call (not really...) cuddle
bombsimon Jan 6, 2025
e6d79b5
Improved decl
bombsimon Jan 6, 2025
2950204
More decl testing
bombsimon Jan 7, 2025
51074f9
Some config work
bombsimon Jan 7, 2025
b5e8e09
Support to cuddling if used anywhere in block
bombsimon Jan 9, 2025
52a0e53
Whole block and first statement config
bombsimon Jan 11, 2025
2a58931
First in block improvements and config
bombsimon Jan 13, 2025
2274fc4
Config and comments updates
bombsimon Jan 14, 2025
30853ce
Add case max lines
bombsimon Jan 14, 2025
ad678d8
Add more types to detect idents
bombsimon Jan 14, 2025
a325719
Fix false positives found on wsl
bombsimon Jan 16, 2025
c56cf2a
Add support for exclusive declarations
bombsimon Jan 16, 2025
4110971
Fix broken tests
bombsimon Jan 16, 2025
33486f2
Linting and versioning
bombsimon Jan 16, 2025
62ab7f3
Some more types
bombsimon Jan 19, 2025
3a00ab0
Fix if false positives
bombsimon Jan 19, 2025
b945213
Label statement
bombsimon Jan 20, 2025
d837d8e
Improve/add select
bombsimon Jan 20, 2025
e2ee994
More assign test
bombsimon Jan 21, 2025
de5e4d6
Improve defer
bombsimon Jan 21, 2025
49667d9
Rework finding idents
bombsimon Apr 18, 2025
f803fcf
Drop `FirstInBlockMaxDepth` + fixes
bombsimon Apr 18, 2025
be35424
Update golangci-lint and fix issues
bombsimon Apr 18, 2025
d02bd7f
Remove `allIdents`, support disable IncDec
bombsimon Apr 18, 2025
5defbd7
Update dependencies
bombsimon Apr 18, 2025
117c700
Add test with all checks disabled
bombsimon Apr 18, 2025
0df5e56
Update github actions
bombsimon Apr 18, 2025
3e5c5fc
Skip cgo files
bombsimon Apr 18, 2025
ece3899
Comments and cleanup
bombsimon Apr 21, 2025
b28eebb
Add support for send, update conifg
bombsimon Apr 21, 2025
070c6b0
Update README
bombsimon Apr 21, 2025
48688ce
Configuration and flag changes
bombsimon May 2, 2025
0a9087a
Move send test to test with config
bombsimon May 2, 2025
32a00e1
Update README
bombsimon May 2, 2025
5df9c8d
WIP: Rules
bombsimon May 2, 2025
da1204a
More docs and small fixes
bombsimon May 3, 2025
5569812
Add check type to diagnostic, make branch a single check
bombsimon May 3, 2025
e44fe80
Add fix for label statement (actually check statement)
bombsimon May 3, 2025
fb0d412
Update tests with failed check
bombsimon May 3, 2025
51b3f9f
Use preset instead of two bools
bombsimon May 3, 2025
a6cc700
Rename preset to default to align with `golangci-lint`
bombsimon May 3, 2025
5982d50
Add migration tool for `.golangci.yml`
bombsimon May 4, 2025
04b6483
Use more sensible default in example
bombsimon May 4, 2025
6af122b
Report leading and trailing whitespace on the empty line
bombsimon May 5, 2025
b9b7fed
Ensure we never remove user comments
bombsimon May 5, 2025
3645b0b
Don't report whitespace issues on the same line
bombsimon May 5, 2025
9e0ac25
Doc updates
bombsimon May 5, 2025
79c1072
Bump version
bombsimon May 5, 2025
e0a93ae
Update LICENSE year
bombsimon May 5, 2025
225c0c7
Rename faulty struct names
bombsimon May 5, 2025
9cff0d6
Test updates
bombsimon May 5, 2025
e477d60
Doc updates
bombsimon May 5, 2025
f7b43e9
Remove tests
bombsimon May 6, 2025
62649f4
Refactor cuddling check with intersection
bombsimon May 6, 2025
fb7ee33
Improve decl check
bombsimon May 6, 2025
f35c58c
Branch and return fixes
bombsimon May 6, 2025
f811cc2
More descriptive diagnostic
bombsimon May 10, 2025
f852618
Improve labeled statement handling
bombsimon May 11, 2025
19beb05
Improve send handling
bombsimon May 11, 2025
cc058e6
Add `default` as valid default, enable `send` by default
bombsimon May 11, 2025
9b6cd99
Remove TODO comment
bombsimon May 11, 2025
36899db
Remove config migration comment
bombsimon May 11, 2025
c5a24b4
Move `send` test
bombsimon May 11, 2025
e910a00
Clarify cuddling without intersection
bombsimon May 11, 2025
47c19af
Rename function
bombsimon May 11, 2025
0ad28c2
Fix copy-paste mistake
bombsimon May 11, 2025
cfa164d
Make all wsl types and functions private
bombsimon May 11, 2025
2fad266
Improve `CompositeLit`
bombsimon May 11, 2025
1d05253
Ignore more expr
bombsimon May 11, 2025
2291ec2
Add test for else-if/else blocks
bombsimon May 12, 2025
3805ef1
Add test for multiline case
bombsimon May 12, 2025
7562089
Don't check block list for switch
bombsimon May 12, 2025
e2fee7d
Keep and convert `AllowAssignAndCall` to check
bombsimon May 12, 2025
cb836f0
Docs sorting
bombsimon May 12, 2025
b56fb05
Fix lint issues
bombsimon May 12, 2025
ff92a29
Remove print statements used for debugging
bombsimon May 12, 2025
e35dcd2
Change badge branch
bombsimon May 12, 2025
9c79499
Remove no longer valid deprecation log
bombsimon May 17, 2025
41e6fca
Support Go 1.23
bombsimon Jun 2, 2025
5cdc3d8
Don't use `SplitSq` when supporting Go 1.23
bombsimon Jun 2, 2025
ba6ca98
Rename `RULES.md` to `CHECKS.md`
bombsimon Jun 2, 2025
5e65803
Improve documentation
bombsimon Jun 4, 2025
6f0a5ee
Header is lowercase only
bombsimon Jun 6, 2025
10bbbb0
More docs updates
bombsimon Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,60 @@
name: CI
on:
push:
branches:
- main
pull_request:

jobs:
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.20'
- uses: actions/checkout@v3
- uses: golangci/golangci-lint-action@v3
go-version: stable
- uses: golangci/golangci-lint-action@v8
with:
version: v2.1.6

tests:
# run after golangci-lint action to not produce duplicated errors
name: tests
needs: golangci-lint
strategy:
matrix:
go:
- '1.20'
- oldstable
- stable
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup cache
uses: actions/cache@v3
- name: Install Go
uses: actions/setup-go@v5
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
go-version: ${{ matrix.go }}

- name: Test code
run: go test -race -v ./...

- name: Run
run: go run ./cmd/wsl/ ./...

coverage:
runs-on: ubuntu-latest
steps:
- name: Install Go
- name: Checkout code
if: success()
uses: actions/setup-go@v3
with:
go-version: '1.20'
uses: actions/checkout@v4

- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Calc coverage
run: |
Expand Down
97 changes: 49 additions & 48 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,82 @@
---
run:
deadline: 1m
issues-exit-code: 1
tests: true
skip-dirs:
- vendor$
version: "2"

output:
format: colored-line-number
print-issued-lines: false

linters-settings:
gocognit:
min-complexity: 10

depguard:
list-type: blacklist
include-go-root: false
packages:
- github.com/davecgh/go-spew/spew

misspell:
locale: US

gocritic:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run`
# to see all tags and checks. Empty list by default. See
# https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
formats:
text:
path: stdout
print-issued-lines: false

linters:
enable-all: true
default: all
disable:
- cyclop
- deadcode
- depguard
- dupl
- dupword
- exhaustivestruct
- err113
- exhaustruct
- forbidigo
- funcorder
- funlen
- gci
- gocognit
- gocyclo
- godot
- godox
- golint
- gomnd
- ifshort
- interfacer
- lll
- maintidx
- maligned
- mnd
- nakedret
- nestif
- nlreturn
- nosnakecase
- paralleltest
- prealloc
- rowserrcheck
- scopelint
- structcheck
- tagliatelle
- testpackage
- varcheck
- tparallel
- varnamelen
- wastedassign
fast: false

settings:
depguard:
rules:
main:
deny:
- pkg: github.com/davecgh/go-spew/spew
desc: not allowed
gocognit:
min-complexity: 10
gocritic:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run`
# to see all tags and checks. Empty list by default. See
# https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
misspell:
locale: US

exclusions:
presets:
- comments
- common-false-positives
- std-error-handling

issues:
exclude-use-default: true
max-issues-per-linter: 0
max-same-issues: 0

formatters:
enable:
- gofmt
- gofumpt
- goimports
settings:
gofmt:
rewrite-rules:
- pattern: "interface{}"
replacement: "any"
# vim: set sw=2 ts=2 et:
Loading
Loading
0