[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-07-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16107806#comment-16107806
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user asfgit closed the pull request at:

https://github.com/apache/metron/pull/577


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-07-31 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16107583#comment-16107583
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user mmiklavc commented on the issue:

https://github.com/apache/metron/pull/577
  
+1. I get why we didn't include the code formatting rules in the source 
tree like the checkstyle.xml (covers more than 1 IDE). But we should link to 
the setup instructions in our dev guide somewhere.


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-07-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16100245#comment-16100245
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user ottobackwards commented on the issue:

https://github.com/apache/metron/pull/577
  
Can I +1 this a second time?


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-07-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16095321#comment-16095321
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user mmiklavc commented on the issue:

https://github.com/apache/metron/pull/577
  
Hey @justinleet, apologies for this slipping between the cracks. I'll run 
this again and see if there's anything specific I can find.


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-07-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16095205#comment-16095205
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user justinleet commented on the issue:

https://github.com/apache/metron/pull/577
  
@mmiklavc Any response to the above? I'm also happy to take a look through 
what you set up and see if there's anything missing in the instructions and so 
on, if that would help.


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-07-05 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16074735#comment-16074735
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user justinleet commented on the issue:

https://github.com/apache/metron/pull/577
  
@mmiklavc I still haven't found (significant) issues with autoformat + 
checkstyle, assuming both the checkstyle is setup and the autoformatting is 
setup (preferably with Google's IntelliJ settings).  Are you okay with merging 
this in, and filing follow-on tickets for any issues?  Or is there something in 
particular you'd like to see done here?


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-06-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16054268#comment-16054268
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user justinleet commented on the issue:

https://github.com/apache/metron/pull/577
  
I removed the Apache header from the checkstyle.xml, because after research 
Checkstyle is LGPL and I don't even want to be in the questionable space of 
adding Apache headers to their config files (even though I've seen other 
projects do this).  Including this is fine since it's just in our build tools, 
not part of our releases.

To reflect this, an exception for checkstyle.xml on the RAT check has been 
added.

Let me know if this is the incorrect strategy for handling this, and I'll 
update appropriately.


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-06-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16054087#comment-16054087
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user ottobackwards commented on the issue:

https://github.com/apache/metron/pull/577
  
Justin, should we have a local copy of the check style xml in the git repo 
itself?  Then we could make changes... and they will be automatically setup?


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-06-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16034033#comment-16034033
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user justinleet commented on the issue:

https://github.com/apache/metron/pull/577
  
@mmiklavc I didn't see any of that at all.  All I saw was it either fixing 
things, or in certain cases (e.g. commas starting newlines) that it just left 
things alone.  Autoformat won't fix everything automatically, because it won't 
touch certain things like the comma stuff, unfortunately.

If there's any examples, or a particular file, I can take a look at it and 
see if I can find a disconnect.  I'll also take a look and see if I can find 
any examples where a checkstyle error from autoformat is produced (at least 
where there wasn't already one).


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-05-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16027644#comment-16027644
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user justinleet commented on the issue:

https://github.com/apache/metron/pull/577
  
Resolved conflicts.

@mmiklavc I think you said on another PR that you'd seen some issues with 
the Google formatting?  Any update on that?


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-05-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16009087#comment-16009087
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user justinleet commented on the issue:

https://github.com/apache/metron/pull/577
  
Actually, that's a lie, autoformat works, but checkstyle doesn't highlight 
anything.  Well, actually, Eclipse won't highlight any errors, including 
outright compilation errors.  If someone has a working Eclipse environment, I 
can help setup checkstyle, but I'm not spending time debugging why Eclipse 
doesn't know how to import a cleanly cloned Maven project.


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-05-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16009083#comment-16009083
 ] 

ASF GitHub Bot commented on METRON-746:
---

Github user justinleet commented on the issue:

https://github.com/apache/metron/pull/577
  
This appears to also work in Eclipse (similar deal: Install Checkstyle from 
Eclipse Marketplace, import GoogleStyle with the same instruction link as 
IntelliJ).

Having said that, Eclipse really dislikes some plugins in our POMs, and it 
seems like an Eclipse thing.  I haven't dug in further, and to be blunt, am not 
interested in doing so unless someone really, really wants to work with Eclipse.


> Build Custom Checkstyle and IDE formatting settings
> ---
>
> Key: METRON-746
> URL: https://issues.apache.org/jira/browse/METRON-746
> Project: Metron
>  Issue Type: Improvement
>Reporter: Justin Leet
>Assignee: Justin Leet
>Priority: Minor
>
> We need a custom checkstyle.xml based off the sun convention checkstyle.  
> Based on a discussion thread, there are a few things that need to be setup
> * Two space indents
> * Line Length longer than 80 (pretty popular in the discussion, but not 
> officially part of our code style)
> * Appropriate warn/error levels set so we don't immediately start failing 
> every build.
> * Importable IntelliJ code style at minimum, but I'd also like to see Eclipse 
> if possible to avoid forcing a given dev environment.  IntelliJ allows for 
> importing a checkstyle.xml to use as the basis.  We can export the resulting 
> formatting settings for people.
> * Ensure Travis actually runs checkstyle during our builds



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-05-12 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16009082#comment-16009082
 ] 

ASF GitHub Bot commented on METRON-746:
---

GitHub user justinleet reopened a pull request:

https://github.com/apache/metron/pull/577

METRON-746: Build Custom Checkstyle and IDE formatting settings

## Contributor Comments

Pretty much just editing the POM to actually set up Checkstyle with the 
Google Code Style, per the dev thread.

See [Google Java Style 
Guide](https://google.github.io/styleguide/javaguide.html)

Note that the Checkstyle version is set to 7.7.  I've tested it with the 
plugin version and had no issues at all, but if anyone is concerned, we can 
lower it to either the default or another version.

### IntelliJ warnings
To pull into IntelliJ, please see 
https://github.com/jshiell/checkstyle-idea#configuration
Essentially the instructions are to:

-  Install the plugin (Available in IntelliJ's directly)
- Go into Settings -> Other Settings -> Checkstyle
- Change "Checkstyle version" to 7.7.
- Apply.  Otherwise the new file won't match the version and an error will 
be thrown.
- Add a new Checkstyle file
  - This can either be a local file or a remote one (remote will attempt to 
update periodically, so if you don't want to repeatedly connect to the URL, 
download the file somewhere and load it in).  Either works. For 7.7, use 
[google_checks.xml](https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml)
  - If you have errors, you most likely need to make sure you're set to the 
right version and have applied it.
- Select the checkbox for the new style
- Apply

To ensure it's setup properly, open a file, e.g. 
`metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/StringFunctions.java`

New warnings should show up that are based on Checkstyle, e.g.
```
Checkstyle: WhitespaceAround: 'if' is not followed by whitespace. Empty 
blocks may only be represented as {} when not part of a multi-block statement
```

### Code formatting
There are two options for code formatting. One is to import the 
google_checks.xml file from above.  The other is to import Google's IntelliJ 
editor settings for coverage.  In practice, Google's direct IntelliJ settings 
seem to handle autoformatting better. The instructions are essentially the same 
for each.

Google's setup is described at 
https://github.com/HPI-Information-Systems/Metanome/wiki/Installing-the-google-styleguide-settings-in-intellij-and-eclipse.
  The direct Checkstyle can be imported similarly, but choosing the CheckStyle 
Configuration when doing Import Scheme.

### Required Follow-up
This will require updating the wiki at 
https://cwiki.apache.org/confluence/display/METRON/Development+Guidelines 
(Section 2.2).  It needs to be switched to the Google code conventions, and the 
instructions above for formatting and warnings should be pulled in.

### Testing
I still need to spin up full-dev, but to get the checkstyle report do:
```
mvn clean install -DskipTests
mvn site site:stage-deploy site:deploy -Dmaven.javadoc.skip=true 
```
Navigate to file:///tmp/metron/site/checkstyle-aggregate.html in a browser.
You should see
`The following document contains the results of Checkstyle 7.7 with 
google_checks.xml ruleset.` and a set of warnings. In practice, most of them 
are fixed by batch autoformatting, per discussions, which will be a followup 
task.

### Misc
No enforcement of Checkstyle is made, and in fact, by default 
google_checks.xml sets everything to warning. The thought is that we'd need to 
pretty significantly reduce the number of warnings, and probably think through 
how we want to handle it.

## Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.  
Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 for complete smoke testing guides.  


In order to streamline the review of the contribution we ask you follow 
these guidelines and ask you to double check the following:

### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
 
- [x] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular attention 

[jira] [Commented] (METRON-746) Build Custom Checkstyle and IDE formatting settings

2017-05-09 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/METRON-746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16003709#comment-16003709
 ] 

ASF GitHub Bot commented on METRON-746:
---

GitHub user justinleet opened a pull request:

https://github.com/apache/incubator-metron/pull/577

METRON-746: Build Custom Checkstyle and IDE formatting settings

## Contributor Comments

Pretty much just editing the POM to actually set up Checkstyle with the 
Google Code Style, per the dev thread.

See [Google Java Style 
Guide](https://google.github.io/styleguide/javaguide.html)

Note that the Checkstyle version is set to 7.7.  I've tested it with the 
plugin version and had no issues at all, but if anyone is concerned, we can 
lower it to either the default or another version.

### IntelliJ warnings
To pull into IntelliJ, please see 
https://github.com/jshiell/checkstyle-idea#configuration
Essentially the instructions are to:

-  Install the plugin (Available in IntelliJ's directly)
- Go into Settings -> Other Settings -> Checkstyle
- Change "Checkstyle version" to 7.7.
- Apply.  Otherwise the new file won't match the version and an error will 
be thrown.
- Add a new Checkstyle file
  - This can either be a local file or a remote one (remote will attempt to 
update periodically, so if you don't want to repeatedly connect to the URL, 
download the file somewhere and load it in).  Either works. For 7.7, use 
[google_checks.xml](https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/google_checks.xml)
  - If you have errors, you most likely need to make sure you're set to the 
right version and have applied it.
- Select the checkbox for the new style
- Apply

To ensure it's setup properly, open a file, e.g. 
`metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/StringFunctions.java`

New warnings should show up that are based on Checkstyle, e.g.
```
Checkstyle: WhitespaceAround: 'if' is not followed by whitespace. Empty 
blocks may only be represented as {} when not part of a multi-block statement
```

### Code formatting
There are two options for code formatting. One is to import the 
google_checks.xml file from above.  The other is to import Google's IntelliJ 
editor settings for coverage.  In practice, Google's direct IntelliJ settings 
seem to handle autoformatting better. The instructions are essentially the same 
for each.

Google's setup is described at 
https://github.com/HPI-Information-Systems/Metanome/wiki/Installing-the-google-styleguide-settings-in-intellij-and-eclipse.
  The direct Checkstyle can be imported similarly, but choosing the CheckStyle 
Configuration when doing Import Scheme.

### Required Follow-up
This will require updating the wiki at 
https://cwiki.apache.org/confluence/display/METRON/Development+Guidelines 
(Section 2.2).  It needs to be switched to the Google code conventions, and the 
instructions above for formatting and warnings should be pulled in.

### Testing
I still need to spin up full-dev, but to get the checkstyle report do:
```
mvn clean install -DskipTests
mvn site site:stage-deploy site:deploy -Dmaven.javadoc.skip=true 
```
Navigate to file:///tmp/metron/site/checkstyle-aggregate.html in a browser.
You should see
`The following document contains the results of Checkstyle 7.7 with 
google_checks.xml ruleset.` and a set of warnings. In practice, most of them 
are fixed by batch autoformatting, per discussions, which will be a followup 
task.

### Misc
No enforcement of Checkstyle is made, and in fact, by default 
google_checks.xml sets everything to warning. The thought is that we'd need to 
pretty significantly reduce the number of warnings, and probably think through 
how we want to handle it.

## Pull Request Checklist

Thank you for submitting a contribution to Apache Metron.  
Please refer to our [Development 
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
 for the complete guide to follow for contributions.  
Please refer also to our [Build Verification 
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
 for complete smoke testing guides.  


In order to streamline the review of the contribution we ask you follow 
these guidelines and ask you to double check the following:

### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to 
be created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
 
- [x] Does your PR title start with METRON- where  is the JIRA 
number you are trying to resolve? Pay particular