Menu

#84 Ignore files based on pattern

v1.63
closed
nobody
None
1
2016-10-21
2014-08-12
Anonymous
No

In Go, test files are named <file>_test.go if it's testing <file>.go. I'm often not interested in these files, so it would be nice to exclude them.

It would also be nice to include based on a pattern as well (e.g. see only test files).

An alternate idea that would solve the same problem is to special-case <file>_test.go files by having them in a separate group, but this seems unnecessarily complicated.

Discussion

  • Al Danial

    Al Danial - 2014-08-12

    Ignoring files based on pattern is an existing capability via the --not-match-f switch. Try

    cloc --not-match-f '_test\.go$' DIR1 DIR2 ..
    

    Same with counting only files that match a pattern (--match-f) as in

    cloc --match-f '_test\.go$' DIR1 DIR2 ..
    
     
  • Al Danial

    Al Danial - 2014-08-14
    • status: open --> pending
     
  • Al Danial

    Al Danial - 2015-06-27

    v1.64 released

     
  • Al Danial

    Al Danial - 2015-06-27
    • status: pending --> closed
     
  • The Shady Watcher

    This is a great feature. Thanks very much :P. Note that in order to get it to work right under Windows, you must use double quotes around the pattern, not single quotes. Also, these are evidently regular expressions, FYI.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.