Skip to content

Conversation

@vkresch
Copy link
Contributor

@vkresch vkresch commented Feb 17, 2020

Reference to a related issue in the repository

Related to the rules PR.

Description

What is this change?
This PR adds a unit test for compliance checking if the rule syntax is correctly defined in OSI. I also updated the regex of the rules so that at the start of a rule there should be a whitespace and after the double colon there must be a numeric number.

What does it fix?
Automatic compliance checking and syntax checking for rules even before the rules are parsed from the osi-validator.

The unit test tests:

  1. Correct spacing of rules
  2. Correct syntax of rule definition like enclosing them between \rules and \endrules tags
  3. Check if defined rules even exist in the rules.yml file
  4. Check if only message fields have rules (There should be no rules in enums or on only messages)

How has it been tested?
Test 1: Add rules to message -> DETECTED
Test 2: Define wrong syntax -> DETECTED
Test 3: Add rules to enums and fields -> DETECTED
Test 4: Mess up the syntax like not defining \rules or \endrules or both -> DETECTED
Test 5: Mess up with the spacing -> DETECTED
Test 6: Add rules which does not exists -> DETECTED

Mention a member

@jdsika pls review. I will explain tomorrow how the rule checking is working.

Check the checklist

  • My code and comments follow the style guidelines and contributors guidelines of this project.
  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests / travis ci pass locally with my changes.

@vkresch vkresch added the Quality Quality improvements. label Feb 17, 2020
@vkresch vkresch self-assigned this Feb 17, 2020
@jdsika jdsika added this to the v3.1.3 milestone Feb 18, 2020
@jdsika jdsika merged commit 179a3b7 into master Feb 18, 2020
@jdsika jdsika mentioned this pull request Feb 18, 2020
@pmai pmai deleted the unit-test-rules branch April 27, 2020 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Quality Quality improvements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants