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

@Suppress("MaxLineLength") at file-level doesn't work #788

Closed
dafi opened this issue Mar 11, 2018 · 3 comments
Closed

@Suppress("MaxLineLength") at file-level doesn't work #788

dafi opened this issue Mar 11, 2018 · 3 comments

Comments

@dafi
Copy link
Contributor

dafi commented Mar 11, 2018

I have some classes containing variables with SQL queries and I want to disable the MaxLineLength check for them, I added the annotation at file level but detekt seems to ignore it.

Example class to use to reproduce the issue

@Suppress("MaxLineLength")
class MaxLineLengthSuppress {
    fun test() {
        val query = "select field1,field2,field3,field4,field5 from a_long_table_name where a_very_very_long_column_name=2 and another_column=5"
    }
}

detekt version used: commit # f7b1dd9

@arturbosch
Copy link
Member

Hey, you're right, it does now work on CLASS level not file level :)
Please try @file:Suppress("MaxLineLength").
It's correct behaviour because the check does not work on KtElement's but on lines. We can't suppress it on class level (annotation over class) :)

@dafi
Copy link
Contributor Author

dafi commented Mar 13, 2018

Oh oh, this is the first time I use @file:Suppress("...") syntax but it works!
Now finally I can use MaxLineLength selectively

thanks!

@arturbosch arturbosch added this to the RC6-4 milestone Mar 15, 2018
@lock
Copy link

lock bot commented Jun 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants