-
Notifications
You must be signed in to change notification settings - Fork 13
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
Load external denylist entries via ServiceLoader #261
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package slack.lint.denylistedapis | ||
|
||
interface DenyListedEntryLoader { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind adding an experimental annotation for this? None of this is a stable API anyway, but want to make it doubly-clear here :). Can call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's also name this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh yeah sure, good call. |
||
val entries: Set<DenyListedEntry> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package slack.lint.denylistedapis | ||
|
||
internal class TestEntriesLoader: DenyListedEntryLoader { | ||
override val entries: Set<DenyListedEntry> = | ||
setOf( | ||
DenyListedEntry( | ||
className = "slack.lint.TestClass", | ||
functionName = "run", | ||
errorMessage = "TestClass.run() is disallowed in tests via external denylist entry." | ||
) | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
slack.lint.denylistedapis.TestEntriesLoader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to do something like
ServiceLoader.load(...).iterator().toSet()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, the more concise the better. I'm not seeing an applicable
toSet()
call to use here, but I might be missing something.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe
.iterator().asSequence().toSet()