zavoloklom / docker-compose-linter

A command-line tool for validating and enforcing best practices in Docker Compose files.
MIT License
13 stars 1 forks source link

[Feature] Arbitrary file names #23

Closed szymon-filipiak closed 1 month ago

szymon-filipiak commented 1 month ago

Feature Description

Enable the tool to run checks against any arbitrary file provided by the user and skip regex pattern matching for those files.

Problem this Feature Will Solve

Currently, if a user passes a Docker Compose file to the program that does not match the regex file name pattern, it is ignored. For example:

Screenshot 2024-10-01 at 3 06 19 pm

In above case database.yaml exists in services directory and is a compose file, however the tool skips validation.

This feature will allow users to lint any file they wish, which is particularly useful for modular Docker Compose setups where services are stored in separate files and included in a central docker-compose.yaml file. See include:

Proposed Solution

Add a pre-search step to determine if the file passed by the user is a directory or a file. If it is a file, add it directly to the filesToCheck list without applying regex matching.

Alternatives Considered

None.

Additional Context

Feel free to reach out if you have any questions or need further assistance.

zavoloklom commented 1 month ago

@szymon-filipiak It's great suggestion, thanks a lot! I made it possible in v1.0.6