Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support config files without extensions #5

Open
kehoecj opened this issue Apr 28, 2023 · 6 comments · May be fixed by #154
Open

Support config files without extensions #5

kehoecj opened this issue Apr 28, 2023 · 6 comments · May be fixed by #154
Labels
CLI Update to the CLI enhancement New feature or request validator-core Issues that relate to the core validator functionality

Comments

@kehoecj
Copy link
Contributor

kehoecj commented Apr 28, 2023

Description

The current configuration file validator finder code recursively searches for files by file extension. Some types of configuration files do not typically include an extension such as ini files (see Ansible inventories). Options for supporting this:

Add a command line option to include extra files and metadata

Allow users to pass in a file or a string on the command line to include other files and their types. It might work something like this for the command line option:

validator --search-path /path/to/search --additional-file=inventory,ini --additional-file=myconfig,yaml

Or like this for the the file option

custom_config.yml example:

yaml:
  - myconfig,
  - myconfig2
ini:
  - inventory

CLI Command

validator --search-path=/path/to/search --additional-files-config=custom_config.yaml

Rewrite the finder code to detect each type of file (out of scope for hacktoberfest Hacktoberfest 2023 )

This would be a much larger effort but would rewrite the finder to determine the type of each file based on content. The downside to this is that some config types are very similar (like TOML and INI) and some are supersets of other types (JSON and YAML)

@kehoecj kehoecj added enhancement New feature or request help wanted Extra attention is needed labels Apr 28, 2023
@kehoecj kehoecj added validator-core Issues that relate to the core validator functionality CLI Update to the CLI hacktoberfest Hacktoberfest 2023 labels Oct 2, 2023
@gokulav137
Copy link
Contributor

gokulav137 commented Oct 6, 2023

Hi @kehoecj, I'm not familiar with this use case so wanted to understand if the --additional-file should be a filepath or filename.

I can work on this issue if this is clarified.

@LeslieLeung
Copy link
Contributor

Can the finder code be more tolerant to unofficial extensions(such as .TOML)? I know that the spec says that the extension should be .toml, but some of the projects I am currently working on did use unofficial extensions.

@kehoecj
Copy link
Contributor Author

kehoecj commented Oct 9, 2023

Can the finder code be more tolerant to unofficial extensions(such as .TOML)? I know that the spec says that the extension should be .toml, but some of the projects I am currently working on did use unofficial extensions.

Hi @LeslieLeung - that's a good idea. For the example you provided we could ignore case when matching files to file types. I've also seen .INI pretty commonly used. Can anyone think of a reason not to support capitalized extensions?

@kehoecj kehoecj removed hacktoberfest Hacktoberfest 2023 help wanted Extra attention is needed labels Oct 17, 2023
@kehoecj
Copy link
Contributor Author

kehoecj commented Dec 1, 2023

@

Can the finder code be more tolerant to unofficial extensions(such as .TOML)? I know that the spec says that the extension should be .toml, but some of the projects I am currently working on did use unofficial extensions.

@LeslieLeung I created a separate issue to support capitalized extensions since it should be a really straightforward implementation

@ccoVeille
Copy link
Contributor

This issue was old and I missed it when I opened #140 and #147

Maybe they should be addressed at the same time or being thought by having them in mind when working on this issue

@ccoVeille
Copy link
Contributor

cc for @vogJust who works on #154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Update to the CLI enhancement New feature or request validator-core Issues that relate to the core validator functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants