Skip to content

Document some thoughts on creating config files #135

@nathanjmcdougall

Description

@nathanjmcdougall

Motivation
I have done some thinking on creating config files.

Some config files can't be empty, e.g. pre-commit config, Bitbucket pipelines. There has to be at least one hook, pipeline step, etc. (content items).

After some thinking, I've decided on the following principles for these sorts of functions.

  • If a config file has compulsory contents, then the create-file function should accept a content item as an argument
  • In the add-contents functions, if the file does not exist, it can be created with the content item passed as an argument.
  • If the config file is expected to exist (e.g. pre-commit can't install commits from an empty file) but the tool has no reason to call add-contents (e.g. we have no tools with pre-commits configured yet), then we should add a placeholder content item. Otherwise, we should not add the placeholder item.
  • add-contents functions should remove placeholder content items if they are detected.
  • Placeholder items should be named and structured as similarly as possible between config files.

Summary of desired enhancement
The above principles should be explained more clearly and documented somewhere.

Metadata

Metadata

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions