Skip to content

Commit 45920e1

Browse files
author
Bill Prin
committed
More check style changes
1 parent 1b9f309 commit 45920e1

File tree

3 files changed

+206
-16
lines changed

3 files changed

+206
-16
lines changed

bigquery/src/main/java/com/google/cloud/bigquery/samples/AsyncQuerySample.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/**
22
* Copyright (c) 2015 Google Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
@@ -32,14 +32,14 @@
3232
*/
3333
public class AsyncQuerySample extends BigqueryUtils{
3434

35-
35+
3636
// [START main]
3737
/**
3838
* @param args
3939
* @throws IOException
4040
* @throws InterruptedException
4141
*/
42-
public static void main(String[] args)
42+
public static void main(String[] args)
4343
throws IOException, InterruptedException {
4444

4545
Scanner scanner = new Scanner(System.in);
@@ -63,27 +63,27 @@ public static void main(String[] args)
6363
// [START run]
6464
public static Iterator<GetQueryResultsResponse> run(String projectId,
6565
String queryString,
66-
boolean batch,
67-
long waitTime)
66+
boolean batch,
67+
long waitTime)
6868
throws IOException, InterruptedException{
69-
69+
7070
Bigquery bigquery = BigqueryServiceFactory.getService();
7171

7272
Job query = asyncQuery(bigquery, projectId, queryString, batch);
7373
Bigquery.Jobs.Get getRequest = bigquery.jobs().get(
7474
projectId, query.getJobReference().getJobId());
75-
76-
//Poll every waitTime milliseconds,
75+
76+
//Poll every waitTime milliseconds,
7777
//retrying at most retries times if there are errors
7878
pollJob(getRequest, waitTime);
7979

8080
GetQueryResults resultsRequest = bigquery.jobs().getQueryResults(
8181
projectId, query.getJobReference().getJobId());
82-
82+
8383
return getPages(resultsRequest);
8484
}
8585
// [END run]
86-
86+
8787
// [START asyncQuery]
8888
/**
8989
* Inserts an asynchronous query Job for a particular query
@@ -94,21 +94,21 @@ public static Iterator<GetQueryResultsResponse> run(String projectId,
9494
* @return a reference to the inserted query job
9595
* @throws IOException
9696
*/
97-
public static Job asyncQuery(Bigquery bigquery,
97+
public static Job asyncQuery(Bigquery bigquery,
9898
String projectId,
9999
String querySql,
100100
boolean batch) throws IOException {
101-
101+
102102
JobConfigurationQuery query_config = new JobConfigurationQuery()
103103
.setQuery(querySql);
104-
104+
105105
if(batch){
106106
query_config.setPriority("BATCH");
107107
}
108-
108+
109109
Job job = new Job().setConfiguration(
110110
new JobConfiguration().setQuery(query_config));
111-
111+
112112
return bigquery.jobs().insert(projectId, job).execute();
113113
}
114114
// [END asyncQuery]

checkstyle-checker.xml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
5+
6+
<!--
7+
8+
Checkstyle configuration that checks the sun coding conventions from:
9+
10+
- the Java Language Specification at
11+
http://java.sun.com/docs/books/jls/second_edition/html/index.html
12+
13+
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
14+
15+
- the Javadoc guidelines at
16+
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
17+
18+
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
19+
20+
- some best practices
21+
22+
Checkstyle is very configurable. Be sure to read the documentation at
23+
http://checkstyle.sf.net (or in your downloaded distribution).
24+
25+
Most Checks are configurable, be sure to consult the documentation.
26+
27+
To completely disable a check, just comment it out or delete it from the file.
28+
29+
Finally, it is worth reading the documentation.
30+
31+
-->
32+
33+
<module name="Checker">
34+
<!--
35+
If you set the basedir property below, then all reported file
36+
names will be relative to the specified directory. See
37+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
38+
39+
<property name="basedir" value="${basedir}"/>
40+
-->
41+
42+
<!-- Checks whether files end with a new line. -->
43+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
44+
<module name="NewlineAtEndOfFile"/>
45+
46+
<!-- Checks that property files contain the same keys. -->
47+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
48+
<module name="Translation"/>
49+
50+
<module name="FileLength"/>
51+
52+
<!-- Following interprets the header file as regular expressions. -->
53+
<!-- <module name="RegexpHeader"/> -->
54+
55+
<module name="FileTabCharacter">
56+
<property name="eachLine" value="true"/>
57+
</module>
58+
59+
<module name="RegexpSingleline">
60+
<!-- \s matches whitespace character, $ matches end of line. -->
61+
<property name="format" value="\s+$"/>
62+
<property name="message" value="Line has trailing spaces."/>
63+
</module>
64+
65+
<module name="TreeWalker">
66+
67+
<property name="cacheFile" value="${checkstyle.cache.file}"/>
68+
69+
<!-- required for SuppressWarningsFilter (and other Suppress* rules not used here) -->
70+
<!-- see http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarningsHolder -->
71+
<module name="SuppressWarningsHolder"/>
72+
73+
<!-- Checks for Javadoc comments. -->
74+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
75+
<module name="JavadocMethod"/>
76+
<module name="JavadocType"/>
77+
<module name="JavadocVariable"/>
78+
<module name="JavadocStyle"/>
79+
80+
81+
<!-- Checks for Naming Conventions. -->
82+
<!-- See http://checkstyle.sf.net/config_naming.html -->
83+
<module name="ConstantName"/>
84+
<module name="LocalFinalVariableName"/>
85+
<module name="LocalVariableName"/>
86+
<module name="MemberName"/>
87+
<module name="MethodName"/>
88+
<module name="PackageName"/>
89+
<module name="ParameterName"/>
90+
<module name="StaticVariableName"/>
91+
<module name="TypeName"/>
92+
93+
94+
<!-- Checks for Headers -->
95+
<!-- See http://checkstyle.sf.net/config_header.html -->
96+
<!-- <module name="Header"> -->
97+
<!-- The follow property value demonstrates the ability -->
98+
<!-- to have access to ANT properties. In this case it uses -->
99+
<!-- the ${basedir} property to allow Checkstyle to be run -->
100+
<!-- from any directory within a project. See property -->
101+
<!-- expansion, -->
102+
<!-- http://checkstyle.sf.net/config.html#properties -->
103+
<!-- <property -->
104+
<!-- name="headerFile" -->
105+
<!-- value="${basedir}/java.header"/> -->
106+
<!-- </module> -->
107+
108+
109+
<!-- Checks for imports -->
110+
<!-- See http://checkstyle.sf.net/config_import.html -->
111+
<module name="AvoidStarImport"/>
112+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
113+
<module name="RedundantImport"/>
114+
<module name="UnusedImports"/>
115+
116+
117+
<!-- Checks for Size Violations. -->
118+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
119+
<module name="LineLength"/>
120+
<module name="MethodLength"/>
121+
<module name="ParameterNumber"/>
122+
123+
124+
<!-- Checks for whitespace -->
125+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
126+
<module name="EmptyForIteratorPad"/>
127+
<module name="MethodParamPad"/>
128+
<module name="NoWhitespaceAfter"/>
129+
<module name="NoWhitespaceBefore"/>
130+
<module name="OperatorWrap"/>
131+
<module name="ParenPad"/>
132+
<module name="TypecastParenPad"/>
133+
<module name="WhitespaceAfter"/>
134+
<module name="WhitespaceAround"/>
135+
136+
137+
<!-- Modifier Checks -->
138+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
139+
<module name="ModifierOrder"/>
140+
<module name="RedundantModifier"/>
141+
142+
143+
<!-- Checks for blocks. You know, those {}'s -->
144+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
145+
<module name="AvoidNestedBlocks"/>
146+
<module name="EmptyBlock"/>
147+
<module name="LeftCurly"/>
148+
<module name="NeedBraces"/>
149+
<module name="RightCurly"/>
150+
151+
152+
<!-- Checks for common coding problems -->
153+
<!-- See http://checkstyle.sf.net/config_coding.html -->
154+
<module name="AvoidInlineConditionals"/>
155+
<module name="EmptyStatement"/>
156+
<module name="EqualsHashCode"/>
157+
<module name="HiddenField"/>
158+
<module name="IllegalInstantiation"/>
159+
<module name="InnerAssignment"/>
160+
<module name="MagicNumber"/>
161+
<module name="MissingSwitchDefault"/>
162+
<module name="SimplifyBooleanExpression"/>
163+
<module name="SimplifyBooleanReturn"/>
164+
165+
<!-- Checks for class design -->
166+
<!-- See http://checkstyle.sf.net/config_design.html -->
167+
<module name="FinalClass"/>
168+
<module name="HideUtilityClassConstructor"/>
169+
<module name="InterfaceIsType"/>
170+
<module name="VisibilityModifier"/>
171+
172+
173+
<!-- Miscellaneous other checks. -->
174+
<!-- See http://checkstyle.sf.net/config_misc.html -->
175+
<module name="ArrayTypeStyle"/>
176+
<module name="FinalParameters"/>
177+
<module name="TodoComment"/>
178+
<module name="UpperEll"/>
179+
180+
</module>
181+
182+
<!-- Support @SuppressWarnings (added in Checkstyle 5.7) -->
183+
<!-- see http://checkstyle.sourceforge.net/config.html#SuppressWarningsFilter -->
184+
<module name="SuppressWarningsFilter"/>
185+
186+
<!-- Checks properties file for a duplicated properties. -->
187+
<!-- See http://checkstyle.sourceforge.net/config_misc.html#UniqueProperties -->
188+
<module name="UniqueProperties"/>
189+
190+
</module>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<artifactId>maven-checkstyle-plugin</artifactId>
3434
<version>2.15</version>
3535
<configuration>
36-
<configLocation>config/sun_checks.xml</configLocation>
36+
<configLocation>checkstyle-checker.xml</configLocation>
3737
<consoleOutput>true</consoleOutput>
3838
<failOnViolation>false</failOnViolation>
3939
</configuration>

0 commit comments

Comments
 (0)