Skip to content

Commit 86d7afa

Browse files
jnmugerwaRongrong Zhong
authored and
Rongrong Zhong
committed
Move linter code into top-level package
1 parent 5e25d81 commit 86d7afa

File tree

13 files changed

+236
-22
lines changed

13 files changed

+236
-22
lines changed

Diff for: linter/pom.xml

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>com.facebook.presto</groupId>
7+
<artifactId>presto-coresql</artifactId>
8+
<version>0.2-SNAPSHOT</version>
9+
</parent>
10+
11+
<artifactId>presto-coresql-linter</artifactId>
12+
<name>presto-coresql-linter</name>
13+
14+
<properties>
15+
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
16+
<maven.compiler.source>1.6</maven.compiler.source>
17+
<maven.compiler.target>1.6</maven.compiler.target>
18+
</properties>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>junit</groupId>
23+
<artifactId>junit</artifactId>
24+
<version>4.12</version>
25+
<scope>test</scope>
26+
</dependency>
27+
28+
<dependency>
29+
<groupId>org.testng</groupId>
30+
<artifactId>testng</artifactId>
31+
<scope>test</scope>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>com.facebook.presto</groupId>
36+
<artifactId>presto-coresql-parser</artifactId>
37+
<version>0.2-SNAPSHOT</version>
38+
</dependency>
39+
40+
<dependency>
41+
<groupId>com.google.guava</groupId>
42+
<artifactId>guava</artifactId>
43+
</dependency>
44+
</dependencies>
45+
46+
<build>
47+
<plugins>
48+
<plugin>
49+
<groupId>org.codehaus.mojo</groupId>
50+
<artifactId>build-helper-maven-plugin</artifactId>
51+
<executions>
52+
<execution>
53+
<phase>generate-sources</phase>
54+
<goals>
55+
<goal>add-source</goal>
56+
</goals>
57+
<configuration>
58+
<sources>
59+
<source>${project.build.directory}/generated-sources</source>
60+
</sources>
61+
</configuration>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
66+
<plugin>
67+
<groupId>com.facebook.presto</groupId>
68+
<artifactId>presto-maven-plugin</artifactId>
69+
<version>0.3</version>
70+
<extensions>true</extensions>
71+
</plugin>
72+
73+
<plugin>
74+
<groupId>org.apache.maven.plugins</groupId>
75+
<artifactId>maven-shade-plugin</artifactId>
76+
<version>3.1.1</version>
77+
</plugin>
78+
79+
<plugin>
80+
<groupId>org.skife.maven</groupId>
81+
<artifactId>really-executable-jar-maven-plugin</artifactId>
82+
<version>1.0.5</version>
83+
</plugin>
84+
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-antrun-plugin</artifactId>
88+
<version>1.8</version>
89+
</plugin>
90+
91+
<plugin>
92+
<groupId>io.airlift.maven.plugins</groupId>
93+
<artifactId>sphinx-maven-plugin</artifactId>
94+
<version>2.1</version>
95+
</plugin>
96+
97+
<plugin>
98+
<groupId>org.apache.maven.plugins</groupId>
99+
<artifactId>maven-enforcer-plugin</artifactId>
100+
<configuration>
101+
<rules>
102+
<requireUpperBoundDeps>
103+
<excludes combine.children="append">
104+
<!-- TODO: fix this in Airlift resolver -->
105+
<exclude>org.alluxio:alluxio-shaded-client</exclude>
106+
<exclude>org.codehaus.plexus:plexus-utils</exclude>
107+
<exclude>com.google.guava:guava</exclude>
108+
</excludes>
109+
</requireUpperBoundDeps>
110+
</rules>
111+
</configuration>
112+
</plugin>
113+
114+
<plugin>
115+
<groupId>org.apache.maven.plugins</groupId>
116+
<artifactId>maven-release-plugin</artifactId>
117+
<configuration>
118+
<preparationGoals>clean verify -DskipTests</preparationGoals>
119+
</configuration>
120+
</plugin>
121+
122+
<plugin>
123+
<groupId>org.apache.maven.plugins</groupId>
124+
<artifactId>maven-compiler-plugin</artifactId>
125+
<configuration combine.children="append">
126+
<fork>true</fork>
127+
<compilerArgs>
128+
<arg>-verbose</arg>
129+
<arg>-J-Xss100M</arg>
130+
</compilerArgs>
131+
</configuration>
132+
</plugin>
133+
134+
<plugin>
135+
<groupId>org.apache.maven.plugins</groupId>
136+
<artifactId>maven-surefire-plugin</artifactId>
137+
<configuration combine.children="append">
138+
<includes>
139+
<include>**/*.java</include>
140+
<include>target/**/*.java</include>
141+
<include>**/Benchmark*.java</include>
142+
</includes>
143+
<excludes>
144+
<exclude>**/*jmhTest*.java</exclude>
145+
<exclude>**/*jmhType*.java</exclude>
146+
</excludes>
147+
</configuration>
148+
</plugin>
149+
150+
<!-- Always build a jar with the test classes -->
151+
<plugin>
152+
<groupId>org.apache.maven.plugins</groupId>
153+
<artifactId>maven-jar-plugin</artifactId>
154+
<configuration>
155+
<!-- do not build an empty jar if the project is
156+
e.g. a pom project -->
157+
<skipIfEmpty>true</skipIfEmpty>
158+
<archive>
159+
<manifest>
160+
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
161+
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
162+
<addClasspath>false</addClasspath>
163+
</manifest>
164+
</archive>
165+
</configuration>
166+
</plugin>
167+
</plugins>
168+
169+
<pluginManagement>
170+
<plugins>
171+
<plugin>
172+
<groupId>org.gaul</groupId>
173+
<artifactId>modernizer-maven-plugin</artifactId>
174+
<version>2.1.0</version>
175+
<configuration>
176+
<javaVersion>1.8</javaVersion>
177+
<ignorePackages>com.facebook.coresql.parser</ignorePackages>
178+
</configuration>
179+
</plugin>
180+
</plugins>
181+
</pluginManagement>
182+
</build>
183+
</project>

Diff for: parser/src/main/java/com/facebook/coresql/lint/LintingVisitor.java renamed to linter/src/main/java/com/facebook/coresql/linter/lint/LintingVisitor.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.lint;
15+
package com.facebook.coresql.linter.lint;
1616

17+
import com.facebook.coresql.linter.warning.WarningCode;
18+
import com.facebook.coresql.linter.warning.WarningCollector;
1719
import com.facebook.coresql.parser.AstNode;
1820
import com.facebook.coresql.parser.SqlParserDefaultVisitor;
19-
import com.facebook.coresql.warning.WarningCode;
20-
import com.facebook.coresql.warning.WarningCollector;
2121

2222
public abstract class LintingVisitor
2323
extends SqlParserDefaultVisitor

Diff for: parser/src/main/java/com/facebook/coresql/lint/MixedAndOr.java renamed to linter/src/main/java/com/facebook/coresql/linter/lint/MixedAndOr.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.lint;
15+
package com.facebook.coresql.linter.lint;
1616

17+
import com.facebook.coresql.linter.warning.WarningCollector;
1718
import com.facebook.coresql.parser.AndExpression;
1819
import com.facebook.coresql.parser.OrExpression;
19-
import com.facebook.coresql.warning.WarningCollector;
2020

21+
import static com.facebook.coresql.linter.warning.StandardWarningCode.MIXING_AND_OR_WITHOUT_PARENTHESES;
2122
import static com.facebook.coresql.parser.SqlParserTreeConstants.JJTANDEXPRESSION;
2223
import static com.facebook.coresql.parser.SqlParserTreeConstants.JJTOREXPRESSION;
23-
import static com.facebook.coresql.warning.StandardWarningCode.MIXING_AND_OR_WITHOUT_PARENTHESES;
2424

2525
/**
2626
* A visitor that validates an AST built from an SQL string. Right now, it validates

Diff for: parser/src/main/java/com/facebook/coresql/warning/CoreSqlWarning.java renamed to linter/src/main/java/com/facebook/coresql/linter/warning/CoreSqlWarning.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.warning;
15+
package com.facebook.coresql.linter.warning;
1616

1717
import com.facebook.coresql.parser.Location;
1818

Diff for: parser/src/main/java/com/facebook/coresql/warning/DefaultWarningCollector.java renamed to linter/src/main/java/com/facebook/coresql/linter/warning/DefaultWarningCollector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.warning;
15+
package com.facebook.coresql.linter.warning;
1616

1717
import com.facebook.coresql.parser.AstNode;
1818
import com.google.common.collect.ImmutableList;

Diff for: parser/src/main/java/com/facebook/coresql/warning/StandardWarningCode.java renamed to linter/src/main/java/com/facebook/coresql/linter/warning/StandardWarningCode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.warning;
15+
package com.facebook.coresql.linter.warning;
1616

1717
public enum StandardWarningCode
1818
{

Diff for: parser/src/main/java/com/facebook/coresql/warning/WarningCode.java renamed to linter/src/main/java/com/facebook/coresql/linter/warning/WarningCode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.warning;
15+
package com.facebook.coresql.linter.warning;
1616

1717
import java.util.Objects;
1818

Diff for: parser/src/main/java/com/facebook/coresql/warning/WarningCollector.java renamed to linter/src/main/java/com/facebook/coresql/linter/warning/WarningCollector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.warning;
15+
package com.facebook.coresql.linter.warning;
1616

1717
import com.facebook.coresql.parser.AstNode;
1818

Diff for: parser/src/main/java/com/facebook/coresql/warning/WarningCollectorConfig.java renamed to linter/src/main/java/com/facebook/coresql/linter/warning/WarningCollectorConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* limitations under the License.
1313
*/
1414

15-
package com.facebook.coresql.warning;
15+
package com.facebook.coresql.linter.warning;
1616

1717
import static com.google.common.base.Preconditions.checkArgument;
1818

Diff for: parser/src/test/java/com/facebook/coresql/lint/TestMixedAndOr.java renamed to linter/src/test/java/com/facebook/coresql/linter/lint/TestMixedAndOr.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
* See the License for the specific language governing permissions and
1212
* limitations under the License.
1313
*/
14-
package com.facebook.coresql.lint;
14+
package com.facebook.coresql.linter.lint;
1515

16+
import com.facebook.coresql.linter.warning.DefaultWarningCollector;
17+
import com.facebook.coresql.linter.warning.WarningCollectorConfig;
1618
import com.facebook.coresql.parser.AstNode;
17-
import com.facebook.coresql.warning.DefaultWarningCollector;
18-
import com.facebook.coresql.warning.WarningCollectorConfig;
1919
import org.testng.annotations.Test;
2020

21+
import static com.facebook.coresql.linter.warning.StandardWarningCode.MIXING_AND_OR_WITHOUT_PARENTHESES;
2122
import static com.facebook.coresql.parser.ParserHelper.parseStatement;
22-
import static com.facebook.coresql.warning.StandardWarningCode.MIXING_AND_OR_WITHOUT_PARENTHESES;
2323
import static org.testng.Assert.assertEquals;
2424

2525
public class TestMixedAndOr

Diff for: parser/src/test/java/com/facebook/coresql/warning/TestWarningCollector.java renamed to linter/src/test/java/com/facebook/coresql/linter/warning/TestWarningCollector.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* See the License for the specific language governing permissions and
1212
* limitations under the License.
1313
*/
14-
package com.facebook.coresql.warning;
14+
package com.facebook.coresql.linter.warning;
1515

1616
import com.facebook.coresql.parser.AstNode;
1717
import org.testng.annotations.Test;

0 commit comments

Comments
 (0)