Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: check references to rules and articles #39

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Nanush7
Copy link
Member

@Nanush7 Nanush7 commented Jan 11, 2025

Added the ReferenceCheck visitor:

  • Flag rules referencing other non-existent/removed nodes.
  • Flag invalid references (e.g. regulations:guideline:..., guidelines:regulation:... or REgulations:...:...).

An example output with errors:

Couldn't compile file, the following occurred:
 - Error: 9t2 has an invalid reference: 'rgulations:regulation:9m2'
 - Error: Rule 4f is referenced in ['11e1', '11e1+'], but was not found
 - Error: Rule E2b++ is referenced in ['1h+++'], but was not found
 - Error: Rule 4f+ is referenced in ['11e1+'], but was not found

Note:
Given that we want to check cross-references between regulations and guidelines (who live in different ASTs), we need to keep the state of the ReferenceCheck class after each WCADocument has been visited. The obvious way to do this is to use a Singleton. I think it makes sense to do it this way, in order to minimize the changes required to the WCAParser class. Moreover, there's additional logic that needs to run when the parser gets an instance of the ReferenceCheck visitor class (see the ReferenceCheck.get_instance method).

@Nanush7 Nanush7 requested a review from gregorbg January 11, 2025 04:57
@Nanush7 Nanush7 self-assigned this Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant