alingse / sundrylint

three thousand real world bug linter
MIT License
5 stars 0 forks source link

New Idea: use AI pipeline to auto find the bug pattern #9

Open alingse opened 4 months ago

alingse commented 4 months ago

Pipeline

  1. Search "fix small bug" + "Go" + "pull requests" --> https://github.com/search?q=fix+bug+language%3AGo&type=pullrequests&l=Go
  2. Read each PR diff find the bug's Root cause
  3. Auto summarize the new parttern

Some Human Result

Error usage

  1. err.Error() == "EOF" should be errors.Is(err, io.EOF) ---> https://github.com/inelpandzic/simpledb/pull/3/files

this can be generalized to all other std error like context.Canceld

  1. if err != nil && other condition not cover all err != nil ---> https://github.com/kubevirt/kubevirt/pull/13759/files

this may cause some bug

Body Close like

  1. file should Close --> https://github.com/etcd-io/etcd/pull/18086/files

Make wrong length

  1. make slice and range from another ---> https://github.com/zenon-network/go-zenon/pull/49/files

Already report by other linter

  1. [ruleguard] A && A should be simplify toA ---> https://github.com/blocktree/go-owcrypt/pull/12/files
  2. [gosimple] *x == true should be reduce to *a ---> https://github.com/aunefyren/poenskelisten/pull/33/files
  3. [gocritic] len(x) >= 0 is always true, it should be len(x) > 0 ---> https://github.com/rook/rook/pull/15445/files
  4. Printf to Print --> https://github.com/Tulsishah/gcsfuse-tulsishah7/pull/17/files
  5. return data, err should be return data, nil --> https://github.com/lightningnetwork/lnd/pull/9519/files
fuyangpengqi commented 4 months ago

Good job! But I’m curious why 6 and 7 are missing?

I came here from a PR under the lnd project. May I ask are you Chinese? I'm also very interested in static analysis.

My WeChat ``. Looking forward to more communication.