boyter / scc

Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
MIT License
6.58k stars 261 forks source link

(incorrect?) Haskell keywords for complexity checks #384

Closed 0rphee closed 9 months ago

0rphee commented 1 year ago

So, I checked the complexity checks for haskell code:

 "Haskell": {
    "complexitychecks": [
      "for ", -- there are no for loops in haskell, there is a for function, nontheless, but it is not the same
      "for(", -- possibly this isn't needed, because parentheses aren't required
      "if ", -- there would be need to add also `then` 
      "if(", -- possibly this isn't needed, because parentheses aren't required
      "switch ", -- this keyword does not exist, instead it would be `case _expr_ of`
      "while ", -- there are no while loops in haskell
      "else ",
      "|| ",
      "&& ",
      "!= ", -- in haskell "not equals" is /=
      "== "
    ],

and I was a little surprised, since, those keywords seem to be kind of a "default" for many languages, though for haskell it is not the case.

These are just some observations that quickly come to my mind, but here's a more comprehensive page of haskell keywords: https://wiki.haskell.org/Keywords

:)

boyter commented 1 year ago

I am not familiar with Haskell, so likely I made a mistake. Ill fix that for the next release. Cheers.

fmease commented 1 year ago

Same with Rust btw. (e.g. it should be match instead switch).

boyter commented 1 year ago

Now thats an odd one for me to miss.

boyter commented 9 months ago

5c34fee144364946374d78300215442a6ce059a1