Skip to content

Support for multiple languages with the same file extension #941

@remyblok

Description

@remyblok

cloc already looks at the shebangs for files. But it would be very useful if there could be other methods for defining types that have the same file extensions. I'm thinking specifically of json files, which contain so many different types information. In my scenario I have Microsoft Azure Logic App code and Microsoft Azure Resource Management (ARM) templates both with json-extensions. But these are very different types and I would like to count them separately.

Would it be possible to add an optional regex to a type definition for 'type identification'. So I can define a type Logic App with extension json where the files should contain .*https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json.* for example.

Ordering is then important, if a file is matched it will count towards that defined type. All more specific types, i.e. with 'type identification' regex should be before any types with the same extension but without the 'type identification'.

This may also solve #837.

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