Skip to content

Read scope from rule json metadata file.#252

Merged
saberduck merged 2 commits intomasterfrom
issue-3122-rule-metadata-scope
Aug 19, 2022
Merged

Read scope from rule json metadata file.#252
saberduck merged 2 commits intomasterfrom
issue-3122-rule-metadata-scope

Conversation

@francoismora
Copy link
Copy Markdown
Contributor

@francoismora francoismora commented Aug 18, 2022

Fixes #252

RuleScope scope;

assertThat(RuleMetadataLoader.getScopeIfPresent(Collections.emptyMap(), "scope")).isNotPresent();
assertThat(RuleMetadataLoader.getScopeIfPresent(Collections.singletonMap("scope", null), "scope")).isNotPresent();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use static import for singletonMap and emptyMap to make code a bit more succint

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.

Indeed I saw that too. The PR doesn't show that the same methods are used many times in the same file. There's undoubtedly an opportunity to refactor the class, for instance, to use the shorter form List.of(). I may do this as part of a separate PR, maybe? WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we would need to change the pom.xml to use Java 11, otherwise List.of is not available. We could do this, but perhaps later.

@sonarsource-next
Copy link
Copy Markdown

@francoismora francoismora requested a review from saberduck August 19, 2022 06:47
@francoismora francoismora self-assigned this Aug 19, 2022
@saberduck saberduck merged commit 726be8a into master Aug 19, 2022
@saberduck saberduck deleted the issue-3122-rule-metadata-scope branch August 19, 2022 07:14
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.

Rule metadata loader is not reading scope property from JSON file

3 participants