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

Support Detekt rules using type resolution #92

Open
ryanpbrewster opened this issue Jan 27, 2021 · 3 comments
Open

Support Detekt rules using type resolution #92

ryanpbrewster opened this issue Jan 27, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@ryanpbrewster
Copy link

Detekt has experimental support for rules that rely on type resolution.

The gradle plugin seems to have support for this. The CLI tool looks like it requires the --jvm-target and --classpath arguments to be provided. Are those paths available during the bazel compilation phase? Is it possible that the bazel rules could support these type-resolution rules?

@arturdryomov
Copy link
Contributor

Definitely an interesting option. It was not pursued at this point since it requires Kotlin code compilation before executing Detekt. Right now it can be executed without ready-to-use classpath. At the same time, I’m not sure if there are rules using this in the first place, a lot of bundled ones use regular UAST.

@arturdryomov arturdryomov changed the title Feature request: support for type resolution Support Detekt rules using type resolution Feb 7, 2021
@arturdryomov arturdryomov added the enhancement New feature or request label Feb 7, 2021
@ryanpbrewster
Copy link
Author

I’m not sure if there are rules using this in the first place

The main one I had in mind is IgnoredReturnValue, which would be extremely helpful in catching common errors when dealing with immutable data structures and Result types

@Kernald
Copy link
Contributor

Kernald commented Oct 25, 2021

ForbiddenMethodCall is another quite useful one (e.g. preventing stray calls to println and friends) that requires type resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants