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

Fix tag processing to not skip tags and in cases where a content item has multiple tag properties #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rbottema
Copy link

@rbottema rbottema commented Feb 1, 2024

This fixes two issues:

  • In the ValidateTags method tags were removed from the list of tags (as the copy made in CheckContentProperties was by reference, it would mutate the original list). This would cause subsequent content items to be processed to not include that tag, leading to incorrect results. This is fixed by not modifying the collection at all, but simply computing the set difference between all tags and the tags that the content is tagged with using Except
  • When a content item had multiple tag properties, the logic would in theory remove all occurences of the content item in tags that were not in the last tag property. By chance this did not happen, because of the above bug. By rewriting the logic to first collect the tags from all properties, this issue is (re)avoided

… has multiple tag properties

This fixes two issues:
- In the ValidateTags method tags were removed from the list of tags (as the copy made in CheckContentProperties was by reference, it would mutate the original list). This would cause subsequent content items to be processed to not include that tag, leading to incorrect results. This is fixed by not modifying the collection at all, but simply computing the set difference between all tags and the tags that the content is tagged with using Except
- When a content item had multiple tag properties, the logic would in theory remove all occurences of the content item in tags that were not in the last tag property. By chance this did not happen, because of the above bug. By rewriting the logic to first collect the tags from all properties, this issue is (re)avoided
@rbottema
Copy link
Author

rbottema commented Feb 1, 2024

There are potentially more issues in the scheduled job logic that are worth checking out, for example:

  • The job does not take groups into account, which could lead to issues with tags that have the same name but different groups
  • Theoretically there could be content that has one or more tags, but erroneously isn't attached to any of them. The current logic will not catch and fix that

There is also the question if this job should clean up empty tags, as mentioned in #19

Copy link

sonarqubecloud bot commented Jan 8, 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.

3 participants