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

output inaccuracies #1

Open
toomanycats opened this issue Jul 18, 2015 · 3 comments
Open

output inaccuracies #1

toomanycats opened this issue Jul 18, 2015 · 3 comments

Comments

@toomanycats
Copy link

Hi,

I'm really grateful for your program. I haven't touched C in a long time and couldn't have
done such a good job from scratch.

However, I've found some issues with the stream_counter() function and have rewritten it using a different logic. I also added what I consider to be good default behavior for unkown file extensions, which is to still count lines but return 0's for everything else.

My rewritten stream_counter() could use some more refactoring, but it is readable. The logic is simple and exhaustive. The verbosity can makes it a little hard to keep track of.

I've never done a pull request before but will figure out how to do that if you're interested.

Cheers !

@velentr
Copy link
Owner

velentr commented Jul 19, 2015

What kind of output inaccuracies have you found? It hasn't been tested exhaustively, but I haven't noticed anything wrong.

The reason that I skip unknown file types is to avoid wasting time counting binary files etc. When run in a directory with a lot of code that may contain other documentation (PDFs, images, etc), only counting lines in files I care about saves a lot of time. I only care about the languages that I've already defined, so this behavior works for me. Maybe include a command-line switch to toggle this behavior?

I've been meaning to rewrite the stream counter, but it's always worked for me, so I always put it off. Please send your pull request so I can look at what you've written.

@toomanycats
Copy link
Author

Thanks for replying...

I'll have to check the "inaccuracies again", it's possible I'm
wrong....As I recall, the problem I found occurred when comments and
code appear in the same line, using the block style.

For instance in C code:

int foo=0; /* initialize a counter here */

I'll work on sending the pull request. You'll probably want to cherry
pick my changes if you decide that they are useful.

Cheers !

  Daniel P Cuneo
  [email protected]

On Sun, Jul 19, 2015, at 10:04 AM, Brian Kubisiak wrote:

What kind of output inaccuracies have you found? It hasn't been tested exhaustively, but I haven't noticed anything wrong.

The reason that I skip unknown file types is to avoid wasting time counting binary files etc. When run in a directory with a lot of code that may contain other documentation (PDFs, images, etc), only counting lines in files I care about saves a lot of time. I only care about the languages that I've already defined, so this behavior works for me. Maybe include a command-line switch to toggle this behavior?

I've been meaning to rewrite the stream counter, but it's always worked for me, so I always put it off. Please send your pull request so I can look at what you've written.


Reply to this email directly or view it on GitHub[1].

Links:

  1. output inaccuracies #1 (comment)

@toomanycats
Copy link
Author

Hi again,

I've done some reading on "forking" with Github. Since I didn't use the
Github fork tool and I just cloned your repo.

I think the easiest thing is for you to add a remote url that points to
my cloned copy on Github. Then, do a git diff and check out what I did.
The more I look at my refactor the less I think you'll be impressed. If
you have the time I'd appreciate trying to follow through since I've
never done this before.

I've since added a "sloc" repo to my Github account from Bitbucket:
https://github.com/toomanycats/sloc.git

Cheers !

  Daniel P Cuneo
  [email protected]

On Sun, Jul 19, 2015, at 12:36 PM, Daniel P Cuneo wrote:

Thanks for replying...

I'll have to check the "inaccuracies again", it's possible I'm wrong....As I recall, the problem I found occurred when comments and code appear in the same line, using the block style.

For instance in C code:

int foo=0; /* initialize a counter here */

I'll work on sending the pull request. You'll probably want to cherry pick my changes if you decide that they are useful.

Cheers !

  Daniel P Cuneo
  [email protected]

On Sun, Jul 19, 2015, at 10:04 AM, Brian Kubisiak wrote:

What kind of output inaccuracies have you found? It hasn't been tested exhaustively, but I haven't noticed anything wrong.

The reason that I skip unknown file types is to avoid wasting time counting binary files etc. When run in a directory with a lot of code that may contain other documentation (PDFs, images, etc), only counting lines in files I care about saves a lot of time. I only care about the languages that I've already defined, so this behavior works for me. Maybe include a command-line switch to toggle this behavior?

I've been meaning to rewrite the stream counter, but it's always worked for me, so I always put it off. Please send your pull request so I can look at what you've written.


Reply to this email directly or view it on GitHub[1].

Links:

  1. output inaccuracies #1 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants