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

Filter to exclude a generated dir is not working in version 12.1.0 #751

Open
edpichler opened this issue Feb 24, 2024 · 3 comments
Open

Comments

@edpichler
Copy link

The filter is not working in version 12.1.0 under Windows using the following configuration:

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
    filter {
        exclude("**/generated/**")
    }
}

Below is how to workaround the problem:

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
   filter {
        exclude { element -> 
            val path = element.file.path
            path.contains("\\generated\\") || path.contains("/generated/") 
        }
    }
}

I haven't tested it but it seems the problem is related to the / when different platforms.

@jbruchanov
Copy link

jbruchanov commented Mar 17, 2024

it doesn't seem to be reliably working...
I'm using the latest kotlin multiplatform which is generating own Resources...
no matter of exclude result, the ktlint fails as it's not following predefined rules

@xenomachina
Copy link

it doesn't seem to be reliably working

Perhaps this is why.

@brahyam
Copy link

brahyam commented May 15, 2024

I was having the same problem on 12.1.0 with any combination, moved to 12.1.1 using the config below and was solved:

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
    enableExperimentalRules.set(true)
    filter {
        exclude { element ->
            val path = element.file.path
            path.contains("\\generated\\") || path.contains("/generated/")
        }
    }
}

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

No branches or pull requests

4 participants