leading/trailing newline validation should not check the line numbers

Description

In the web UI of Zanata, the validation of "leading/trailing newline (\n)"
is described as "check for consistent leading and trailing newline (\n)".
But actually, besides checking the leading/trailing newline, the validation will also check whether the line numbers of the source string and translation string are exactly same. If the leading/trailing newline are same, but line numbers are not same, it will report error or warning.

I think, the validation of "leading/trailing newline (\n)" should not check the line numbers. If it's needed to check the line numbers, it's better to separate into two kinds of validations: leading/trailing newline (\n) and same line numbers. Separating into two kinds of validations will help users to config.

Regards
Daisy

Environment

None

Activity

Show:
David Mason
October 13, 2015, 9:54 PM

This makes sense to me. Both those checks are done by the same validator component, but they should be provided as separate options in the user interface so that they can be turned on and off independently.

Technical note:

the best approach to this is to separate the concept of a validator from the concept of a validation. In this case, the newlines validator would provide several validations (line count, leading newlines, trailing newlines, etc.) that could be turned on or off independently.

Performing multiple checks with the same validator avoids parsing the strings multiple times for very similar checks that require the same preparation.

David Mason
October 13, 2015, 9:57 PM

Also relates to separating "validation" and "validator" concept.

Alex Eng
October 14, 2015, 5:02 AM

What we discussed:

  • remove line count check in this validator.

  • check docs, label, reference for this validator.

Ready for Release

Assignee

Alex Eng

Reporter

Daisy Guo

Labels

None

Tested Version/s

None

Story Points

0.5

Sprint

None

Fix versions

Priority

Medium
Configure