Giter Site home page Giter Site logo

Comments (8)

Vinatorul avatar Vinatorul commented on July 18, 2024

May be some problem with blank lines? Can you add examples ro repo?

from cargo-count.

kbknapp avatar kbknapp commented on July 18, 2024

I noticed it in the Rust repo (See the example output), but I haven't yet done any real investigating such as creating a quick .c file and seeing what happens.

from cargo-count.

Vinatorul avatar Vinatorul commented on July 18, 2024

It seems to be the same bug as #2.

int  test() {
    return /* test */ 0;    
}

Result is

         Language  Files  Lines  Blanks  Comments  Code  Unsafe (%)
         --------  -----  -----  ------  --------  ----  ----------
         C Header  1      3      0       1         2     1 (50.00%)
         TOML      1      4      0       0         4     
         --------  -----  -----  ------  --------  ----  ----------
Totals:            2      7      0       1         6     1 (16.67%)

from cargo-count.

kbknapp avatar kbknapp commented on July 18, 2024

Makes sense, and now I see why I didn't catch it before! Thanks! 😄

from cargo-count.

kbknapp avatar kbknapp commented on July 18, 2024

#2 found some of the erroneous lines...but not all.

from cargo-count.

Vinatorul avatar Vinatorul commented on July 18, 2024

The only place, where count.code increments before unsafe check is

else if line.contains(ms) {
    debugln!("line contains a multi start");
    count.code += 1;
    is_in_comments = line.contains(count.multi_end().unwrap());
    debugln!("line also contained a multi end: {:?}", is_in_comments);
    continue;
    }

and there is continue

from cargo-count.

Vinatorul avatar Vinatorul commented on July 18, 2024

Let me fix it?

from cargo-count.

kbknapp avatar kbknapp commented on July 18, 2024

That was it! Sorry, I just pushed the patch!

from cargo-count.

Related Issues (18)

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.