Menu

cloc query

Help
showkath
2012-05-10
2012-10-11
  • showkath

    showkath - 2012-05-10

    Hi

    How can i tell CLOC tool to consider any line in a file which contains less
    than 2 characters as a blank line. We have a requirement for it, how can i do
    it?

    For example, if \"XY\" is the only word in the line then cloc tool should
    consier that line as blank line.

    C#
    filter remove_matches ^\s//
    filter call_regexp_common C
    filter remove_inline //.
    $
    extension cs
    3rd_gen_scale 1.36
    end_of_line_continuation \\$

     
  • Al Danial

    Al Danial - 2012-05-11

    There currently isn't a way to do that. At best you could define a two
    character word as a comment line, but not a blank line. If you have a version
    of Perl installed on your machine you could do it in three steps:

    1. make a copy of your source files
    2. use Perl to change lines that have two character words into blank lines
      using, for example,
      perl -pi -e "s/^\s\w{2}\s$//" file(s)
    3. count the resulting files with cloc

    Since step 2 modifies your original files you'll want to run that step on the
    copy.

     

Log in to post a comment.