Provide a default config file for checkstyle plugin

357 views
Skip to first unread message

Maksym Stavytskyi

unread,
Mar 4, 2015, 10:03:04 AM3/4/15
to gradl...@googlegroups.com
We have this issue a lot of time. It is linked to http://issues.gradle.org/browse/GRADLE-2208.
I use sonar default configuration. Benjamin Manes proposes to use Google default checkstyle configuration. Also I think we can provide both. So I propose to implement this feature in next way:

If project folder doesn't consist 'config/checkstyle/checkstyle.xml' gradle will use one of described above config file.
Also user can specify which default configuration file he want to use.
As example, if default config will be sonar and user want to use google. He will write like
checkstyle.config = 'google'

What do you think? We need do decide default behavior and do we need two default configs.

Best regards,
Maksym Stavytskyi

davidmc24

unread,
Mar 4, 2015, 1:01:08 PM3/4/15
to gradl...@googlegroups.com
I'm only slightly hesitant about this, as style/coding conventions vary a lot between companies/organizations/projects.  The question remains: if it hasn't been configured, is it better to fail, or use a default configuration (which will be "right" some percentage of the time, and "wrong" the rest, then requiring the user to configure it).  Overall, I'm +1.

I'm not sure I see the need for special support for "checkstyle.config = 'google'" or "checkstyle.config = 'sun'".  Assuming that the config setting goes to something equivalent to the checkstyle ant task's config attribute, it says it supports resources from the classpath, so using "sun_checks.xml" or "google_checks.xml" should work out of the box.  Instead of having special settings, call it out in the documentation that you can use it that way... and that leads to people being able to use new default styles without further code change, including styles that the user adds in via dependencies in the "checkstyle" configuration.

Using google as default seems reasonable to me.

Maksym Stavytskyi

unread,
Mar 10, 2015, 4:41:02 AM3/10/15
to gradl...@googlegroups.com
Ok, so default configuration will be google.
If it will be need other default configuration will be added later.


среда, 4 марта 2015 г., 20:01:08 UTC+2 пользователь davidmc24 написал:

Maksym Stavytskyi

unread,
Mar 13, 2015, 12:01:48 PM3/13/15
to gradl...@googlegroups.com
I have made pull request. Wait for your comments. Also I think we should change default checkstyle version. A lot of rule from google config file was commented by me because checkstyle 5.7 doesn't provide its.
Reply all
Reply to author
Forward
0 new messages