Coder Social home page Coder Social logo

mulint's People

Contributors

gnieto avatar julienschmidt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mulint's Issues

mulint only detects function calls that are used as statements, not in expressions

Hi, thank you for writing this linter, as I could not find anything similar anywhere else!

I notice that mulint seems to only traverse function calls that are written as simple statements where the return value is not used. So if a function call is used in an expression then mulint will ignore it.

For example, mulint can detect this deadlock:

type someStruct struct {
  m sync.RWMutex
}

func (s *someStruct) A() {
  s.m.RLock()
  s.B()
  s.m.RUnlock()
}

func (s *someStruct) B() bool {
  s.m.RLock() // This is a recursive lock and it should be detected by this tool
  s.m.RUnlock()
  return true
}

...but not this one:

type someStruct struct {
  m sync.RWMutex
}

func (s *someStruct) A() {
  s.m.RLock()
  v := s.B()           // ***** This is the only difference. *****
  fmt.Println(v)
  s.m.RUnlock()
}

func (s *someStruct) B() bool {
  s.m.RLock() // This is a recursive lock and it should be detected by this tool
  s.m.RUnlock()
  return true
}

module declares its path as: github.com/securego/gosec

$ go get -u github.com/gnieto/mulint

go: github.com/gnieto/mulint upgrade => v0.0.0-20180313231918-24ec3193fbeb
go: finding module for package github.com/GoASTScanner/gas
go: found github.com/GoASTScanner/gas in github.com/GoASTScanner/gas v0.0.0-20200401082031-e946c8c39989
go: github.com/gnieto/mulint imports
github.com/gnieto/mulint/mulint imports
github.com/GoASTScanner/gas: github.com/GoASTScanner/[email protected]: parsing go.mod:
module declares its path as: github.com/securego/gosec
but was required as: github.com/GoASTScanner/gas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.