Skip to content
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

Wrong line count for the language Elm (and maybe other languages too) when encounter certain characters #230

Closed
lucamug opened this issue Feb 20, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@lucamug
Copy link

lucamug commented Feb 20, 2021

I found this issue in cloc so I tried scc but it seems that also scc has the same issue.

This is the issue that I opened for cloc: AlDanial/cloc#568

@boyter
Copy link
Owner

boyter commented Feb 21, 2021

Ah another edge case :)

I think it should be simple to fix, but don't quote me on that.

@boyter boyter added the bug Something isn't working label Feb 21, 2021
@lucamug
Copy link
Author

lucamug commented Feb 21, 2021

This same bug is also on cloc so the fix should be the same: AlDanial/cloc#568

@boyter
Copy link
Owner

boyter commented Feb 22, 2021

Alas the fix is not the same. cloc tries to remove comments in some instances, whereas scc uses a state machine that changes based on what it's looking at and what state it can move into.

@boyter
Copy link
Owner

boyter commented Feb 23, 2021

Looks like it was a simple fix.

$ bat test.elm 
───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: test.elm
───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ module Main exposing (main)
   2   │ 
   3   │ import Html
   4   │ 
   5   │ 
   6   │ main =
   7   │     Html.node "style" [] [ Html.text "div[role=button] {-webkit-tap-highlight-color: transparent}" ]
   8   │ 
   9   │ 
  10   │ a =
  11   │     3
───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

# boyter @ Bens-MacBook-Air in ~/Documents/projects/scc/examples/issue230 on git:master x [17:25:16] 
$ scc
───────────────────────────────────────────────────────────────────────────────
Language                 Files     Lines   Blanks  Comments     Code Complexity
───────────────────────────────────────────────────────────────────────────────
Elm                          1        11        5         0        6          0
───────────────────────────────────────────────────────────────────────────────
Total                        1        11        5         0        6          0
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $125
Estimated Schedule Effort (organic) 0.452796 months
Estimated People Required (organic) 0.024625
───────────────────────────────────────────────────────────────────────────────
Processed 162 bytes, 0.000 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────

Missing quotes :)

Committing to master as this looks like its correct now.

@boyter boyter closed this as completed in c1db1da Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants