Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7721017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:49:04+00:00 2026-06-01T03:49:04+00:00

Is there a common way of counting source lines of code (SLOC) in a

  • 0

Is there a common way of counting source lines of code (SLOC) in a CoffeeScript project?

I’m hoping for something that will traverse all of the directories in my project during the count. I found a few projects online but they seemed kind of overkill for the task. I would love a simple utility or even just some command-line-fu.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:49:05+00:00Added an answer on June 1, 2026 at 3:49 am

    If you’re on UNIX, I would go with the wc tool. I usually use wc -l *.coffee */*.coffee etc. because it is easy to remember. However, a recursive version would be

    wc -l `find <proj-dir> -type f | grep \.coffee$`
    

    which runs the find command, which recursively lists files of type f, or normal files, fed into the grep, which filters down to just Coffeescript files, and the output of that is used as the command line arguments to wc (-l signals a line count).

    Edit: Now we don’t want to count blank or comment lines (we’re only catching single-line comments here). We lose the per-file counts, but here goes:

    cat `find <proj-dir> -type f | grep \.coffee$` | sed '/^\s*#/d;/^\s*$/d' | wc -l
    

    We find the Coffeescript files, and then cat them. Then, sed strips out lines that consist of only whitespace or have whitespace followed by a #. Finally, our friend wc counts the remaining lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a common way to implement videos on the web that will also
Is there a standard/common way to give compiler-style error messages that point to a
Is there a standard or common way in C++ to handle static strings that
I am wondering if there is some way to call C++ code from Common
Is there any common way, example or code template how to repeat a XHR
Is there a common way or good public domain code for converting binary (i.e.
Is there a common way in C++ to translate an error code to a
Is there a common way to get the current time in or with milliseconds?
There's a common way to store multiple values in one variable, by using a
Is there a best-practice or common way in JavaScript to have class members as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.