Skip to content

How can I exclude/filter specific MagicNumber issues in detekt.yml #3283

Answered by arturbosch
xetra11 asked this question in Q&A
Discussion options

You must be logged in to vote

I am using Jetbrain's Compose for Desktop and the code structure there is a little bit odd and unconventional.
Given the following snippet:

Modifier.preferredSize(70.dp, 25.dp),

Detekt spits out a MagicNumber issue. I understand the problem - however I have no other way than going "magical" here.
I read in the detekt.yml. that there are some options to customize the behaviour.
This is my configuration therefore:

  MagicNumber:
    active: false # inactive due my problem for now
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    ignoreNumbers: ['-1', '0', '1', '2']
    ignoreHashCodeFunction: true
    ignorePropertyD…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@xetra11
Comment options

@cortinico
Comment options

@arturbosch
Comment options

@BraisGabin
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by schalkms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants