Skip to content

--exclude-list-file not working #784

@rensvanleeuwen

Description

@rensvanleeuwen

Describe the bug
The --exclude-list-file option does not exclude the file in my exclusion file. If use the inverse option --list-file it does.

cloc; OS; OS version

  • cloc version: 1.98
  • If running the cloc source, Perl version: -
  • OS (eg Linux, Windows, macOS, etc): macOS
  • OS version: 13.6.1

To Reproduce

I have created a small directory structure with some config and code:

❯ tree -a
.
├── .cloc-ignore
└── src
    └── net
        └── companies
            ├── CompaniesController.cs
            └── OtherCompaniesController.cs

4 directories, 3 files

With the .cloc-ignore containing:

❯ cat .cloc-ignore
./src/net/companies/CompaniesController.cs

When I run cloc without any file filtering, the following is shown:

❯ cloc . --quiet --by-file-by-lang
github.com/AlDanial/cloc v 1.98  T=0.01 s (164.9 files/s, 989.5 lines/s)
--------------------------------------------------------------------------------------------------
File                                                           blank        comment           code
--------------------------------------------------------------------------------------------------
./src/net/companies/CompaniesController.cs                         0              1              5
./src/net/companies/OtherCompaniesController.cs                    0              1              5
--------------------------------------------------------------------------------------------------
SUM:                                                               0              2             10
--------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C#                               2              0              2             10
-------------------------------------------------------------------------------
SUM:                             2              0              2             10
-------------------------------------------------------------------------------

Using the --list-file, you can see that the file in .cloc-ignore is filtered out:

❯ cloc . --quiet --by-file-by-lang --list-file=.cloc-ignore
github.com/AlDanial/cloc v 1.98  T=0.01 s (84.0 files/s, 503.9 lines/s)
---------------------------------------------------------------------------------------------
File                                                      blank        comment           code
---------------------------------------------------------------------------------------------
./src/net/companies/CompaniesController.cs                    0              1              5
---------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C#                               1              0              1              5
-------------------------------------------------------------------------------

However, using the inverse of that argument, I see all the files and nothing is filtered out:

❯ cloc . --quiet --by-file-by-lang --exclude-list-file=.cloc-ignore
github.com/AlDanial/cloc v 1.98  T=0.01 s (162.6 files/s, 975.9 lines/s)
--------------------------------------------------------------------------------------------------
File                                                           blank        comment           code
--------------------------------------------------------------------------------------------------
./src/net/companies/CompaniesController.cs                         0              1              5
./src/net/companies/OtherCompaniesController.cs                    0              1              5
--------------------------------------------------------------------------------------------------
SUM:                                                               0              2             10
--------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C#                               2              0              2             10
-------------------------------------------------------------------------------
SUM:                             2              0              2             10
-------------------------------------------------------------------------------

Expected result
The --exclude-list-file to filter out the defined files.

Additional context
I am currently using a --not-match-f as a workaround, but I prefer a more explicit/maintainable way for colleagues to easily add entries without having to know much about regexes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions