Skip to content

#579 Validate variable substitution in Award text#612

Open
VasilevNStas wants to merge 4 commits into
zerocracy:masterfrom
VasilevNStas:579-award-var-substitution
Open

#579 Validate variable substitution in Award text#612
VasilevNStas wants to merge 4 commits into
zerocracy:masterfrom
VasilevNStas:579-award-var-substitution

Conversation

@VasilevNStas

Copy link
Copy Markdown
Contributor

Problem

When ${var} is used in award or bylaw text, an undefined variable silently produces nil or "**nil**" in the output, hiding configuration errors.

Solution

Both Bill#line and Bylaw#line now check that the variable exists via key? before substitution. If undefined, a descriptive Fbe::Error is raised with the variable name and the failing text.

Closes #579

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 plz review

@yegor256

Copy link
Copy Markdown
Member

@VasilevNStas no test?

@VasilevNStas VasilevNStas left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yegor256

Tests added: test_bill_raises_on_undefined_var and test_bylaw_raises_on_undefined_var

plz review

@yegor256

Copy link
Copy Markdown
Member

@VasilevNStas conflicts here

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256
I`m fixed it
plz re-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Award variable substitution silently returns nil/empty for undefined variables

2 participants