cloc

Cloc's --force-lang-def works on ubuntu but fails on windows


I have next file structure:

--root folder
  --Gemfile.lock
  --Gemfile

And next language definition:

Gem
    filter remove_matches ^\s*#
    filename Gemfile.lock
    filename Gemfile
    3rd_gen_scale 2.11

On ubunutu next command:

cloc path_to_root_dir --csv --force-lang-def=path_to_def_file

Gives me:

2 text files.
2 unique files.
0 files ignored.

files,language,blank,comment,code,"github.com/AlDanial/cloc v 1.90 T=0.03 s (62.0 files/s, 11467.1 lines/s)"
2,Gem,9,5,356
2,SUM,9,5,356

And on Windows:

2 text files.
2 unique files.
3 files ignored.


Solution

  • For some reason 1.90 version of cloc requires file names in definition to be lowercase. Adding switch --ignored="myfile.txt" resulted in next output:

    path_to_root_dir , zero sized file
    path_to_root_dir/gemfile, language unknown (#3)
    path_to_root_dir/gemfile.lock, language unknown (#3)

    And after changing cloc file to have file names in lower case everything started working:

    Gem
        filter remove_matches ^\s*#
        filename gemfile.lock
        filename gemfile
        3rd_gen_scale 2.11
    

    2 text files.
    2 unique files.
    1 file ignored.

    files,language,blank,comment,code,"github.com/AlDanial/cloc v 1.90 T=0.01 s (278.8 files/s, 51583.6 lines/s)"
    2,Gem,9,5,356
    2,SUM,9,5,356

    Submitted an issue on github.