I'm a bit of a neat freak and I'm currently creating a cleaner .info file format by hand which is time consuming and problematic when diffing new exports of features.

The format I use is as such:

  • Each group of info type (dependencies, features, features_exclude, files, etc) get's prepended with three line breaks a comment containing the type name and an additional line break.
  • Each primary key of an info type (features[field_instance], etc) is separated by a single line break

And example of this is seen below:

 

Old:

name = Feature
core = 7.x
package = Features
php = 5.2.4
version = 7.x-2.0
project = feature
dependencies[] = features
dependencies[] = file
dependencies[] = image
features[context][] = layout-articles
features[features_api][] = api:2
features[field_base][] = field_file
features[field_base][] = field_image
features[field_instance][] = node-article-field_file
features[field_instance][] = node-article-field_image
features[node][] = article

 

New:

name = Feature
core = 7.x
package = Features
php = 5.2.4
version = 7.x-2.0
project = feature

 

; Dependencies dependencies[] = features dependencies[] = file dependencies[] = image

 

; Features features[context][] = layout-articles features[features_api][] = api:2 features[field_base][] = field_file features[field_base][] = field_image features[field_instance][] = node-article-field_file features[field_instance][] = node-article-field_image features[node][] = article

 

I find this new format to be much more readable.

Patch coming shortly.

CommentFileSizeAuthor
#1 cleaner_info-2155793-1.patch1.07 KBDeciphered
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Deciphered’s picture

Status: Active » Needs review
FileSize
1.07 KB
Deciphered’s picture

Issue summary: View changes
hefox’s picture

3 new lines seems a bit excessive to me XD

Deciphered’s picture

@hefox,

I'd be more than happy to make the format configurable if I had an inkling that it would help push the patch forward.

hefox’s picture

Type of issue that has too much impact for me to commit without more input. Initial commit means all features will change on update for everyone, which complicates some people's development workflow (or at least reviewing the diff to see what has changed).

Deciphered’s picture

Ok, fair call. While I personally think it's a change for the better, I can understand that it is often frustrating when something changes only aesthetically and clutters up a commit.

I'll re-work the patch with one of the following approaches:

  1. Implement a drupal_alter() so that custom/contrib modules can implement an alternate layout
  2. Implement a layout template which is defaulted to the current layout, but can be customized via the UI to achieve what this patch does
  3. Combination of the two, or similar
mpotter’s picture

Yeah, not sure on this one myself. Seems like a lot of work for aesthetics. Also, Drupal itself doesn't have doc guidelines for .info files. Other lines get added to this file, such as files[] for stylesheets and PHP class inc files. So it's not really something Features has full control over either.

I guess if somebody wants to do the work and submit a full patch that we can look at it. But it will need a lot of testing with different Features to make sure it doesn't break something functional. It should also be tested with other Features-related modules, such as Features Override and Features Extra.