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

Add support for external rules #25

Closed
matthewfarwell opened this issue Jul 17, 2012 · 2 comments
Closed

Add support for external rules #25

matthewfarwell opened this issue Jul 17, 2012 · 2 comments
Labels

Comments

@matthewfarwell
Copy link
Member

Certain rules are very specific to a project. A standard way should be added to allow a user to specify a jar which would contain:

scalastyle_definition.xml
The checker classes.

Then, within the scalastyle configuration, you'd allow the user to specify these classes. This would require a dynamic classloader of course.

@RichardBradley
Copy link

How might this be implemented? Do you have a design in mind?

I thought I might get away with defining a rule class in my project/*.scala files, when using the Scalastyle SBT plugin. However, it seems that while those classes are available during the configuration of the Scalastyle Task, they are not available during its run. Do you think that sounds like a workable approach? My project is currently single-module, and it would be nice to avoid creating and deploying a separate JAR file just to get a single class onto Scalastyle's classpath: http://stackoverflow.com/questions/22372717

@matthewfarwell
Copy link
Member Author

There is an ongoing discussion on how to do this on Scalastyle users - Is it possible to have my custom rule run by scalastyle ?

You're right about the basic way of doing it - include it on the classpath of the build. The problem is the message that is output - we need to find the message, which doesn't happen with resource bundles. The easiest way to do this is using typesafe config, which can automatically handle multiple config files on the classpath. See #90 for more information on this.

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

No branches or pull requests

2 participants