terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.85k stars 250 forks source link

Scala parsing issue #264

Closed juli1 closed 4 years ago

juli1 commented 5 years ago

There is an error when processing Scala code. In fact, code related to play/slick is being incorrect.

For example, class fields declared like this def id = column[Long]("id", O.PrimaryKey, O.AutoInc) are interpreted as functions and not as class fields. This type of pattern is heavily used in play/slick.

As a result, the number of functions/class fields are not reported correctly.

How to reproduce:

  1. git clone https://github.com/playframework/play-scala-slick-example.git
  2. run lizard in the cloned directory
  3. check errors for the file ./app/models/PersonRepository.scala. Many methods are missing and the fields being added are incorrect.
terryyin commented 4 years ago

Sorry for the super late reply. The Scala support was from a pull request and the implementation wasn't complete. I've improved it to make the support more serious now.