Skip to content

Can't exclude files by directory #14

@moatra

Description

@moatra

For files that I can't load from WebJars, I typically commit them to my assets/javascripts/vendor directory. Not all of them will pass jshint's tests, so I'd like to exclude them from being linted.

I've tried a couple of approaches:

excludeFilter in (Assets, JshintKeys.jshint) := GlobFilter("*/vendor/*")

This doesn't work, since the filtering appears to work on file names rather than full paths.

managedSourceDirectories in (Assets, JshintKeys.jshint) := List((sourceDirectory in Compile).value / "assets" / "javascripts" / "vendor")

The only thing that seems to work is providing a pattern filter for excludeFilter that explicitly enumerates the files contained in the vendor directory, but this is ugly and doesn't scale well.

Is there a better option available?

Edit: Researching sbt's file filters further, I came up with the following. Not pretty, but I guess it gets the job done.

excludeFilter in (Assets, JshintKeys.jshint) := new FileFilter{ def accept(f: File) = ".*/vendor/.*".r.pattern.matcher(f.getAbsolutePath).matches }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions