fpompermaier / onvif

Java ONVIF library
Apache License 2.0
191 stars 88 forks source link

Add checkstyle to the java code #15

Open fpompermaier opened 5 years ago

fpompermaier commented 5 years ago

Add a checkstyle to the project

Bhlowe commented 5 years ago

Do you have a style format you like? sun vs. google? tabs vs. spaces? I don't care much-- but code with tabs.. but don't mind running Code-Format for all source files from intellij.

BTW, I'm running FindBugs on the code and fixing a few of the warnings.

fpompermaier commented 5 years ago

I think we just need to choose one. I'd go with google just because it has the largest width (100) and it's very easy to set up. Then we could set up also a Travis job to verify the PRs

Bhlowe commented 5 years ago

Google is fine. Made a PR but not sure exactly how checkstyle works. Checkstyle now builds a report when you run maven site.. but I did not bother to correct all of the warnings.

Also, I think checkstyle/code formatting should ignore or not modify the generated source code. Or at least not require a "format source" on generated code to match what is in the repository. Perhaps a "generated source" folder is a good idea.

Noticed on one camera that getting the list of audioSources fails if a camera doesn't support audio by throwing a soapfaultexception. Not sure how to avoid without wrapping the call with a catch throwable. Is there a check to see if audio is supported? Not very important, but want the "checkDevice" test to complete if the url, user and pass are correct.

fpompermaier commented 5 years ago

Merged the PR but we still needs to exclude generated code from checks and fix the distributionManagmenet in the pom.xml so I keep this issue open just as a reminder

Bhlowe commented 5 years ago

Sounds good. I've been busy on other projects.. but using this internally in my software. Thanks!