Warn or issue error when recipe contains unrecognized variable

Bug #1166176 reported by Adam Dingle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bake
Triaged
Medium
Unassigned

Bug Description

I think Bake should issue a warning or error if a recipe contains a variable it doesn't recognize. For example, I mistakenly wrote a recipe containing the following:

programs.test {
  source = foo.vala
}

Above, "source" should be "sources". When I ran bake, it ignored the "source" variable and simply did nothing. That was pretty confusing. If it had printed "warning: unknown variable 'source'" then I would have immediately realized what was wrong.

Revision history for this message
shuerhaaken (shkn) wrote :

A similar thing also happend to me.

Warnings are good, but maybe it should be possible to add some user defined vars without warnings.
For these vars there could be a prefix like e.g. 'user-*' or '_*'.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Yes, this is a bit of a pitfall. Not sure the correct solution - all variables are supposed to be supported and the modules scan for ones they know. Also users can define variables. However, there is a risk of user variables colliding with module variables so the 'user-*' prefix (or similar) sounds like a good solution.

Changed in bake:
status: New → Triaged
importance: Undecided → Medium
summary: - warn or issue error when recipe contains unrecognized variable
+ Warn or issue error when recipe contains unrecognized variable
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.