Revert "Use defaults of google java format action (#1845)" (#1912)

This reverts commit 782209ead58f4cd82882872e9f8f40779d8b6e54.
This commit is contained in:
Sriharsha Chintalapani 2021-12-23 19:22:47 -08:00 committed by GitHub
parent 5892595b1f
commit bb847bc004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 22943 additions and 78 deletions

View File

@ -1,5 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="GoogleStyle" />
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GoogleJavaFormatSettings">
<option name="enabled" value="true" />
</component>
</project>

View File

@ -1,31 +0,0 @@
repos:
- repo: https://github.com/ambv/black
rev: 21.12b0
hooks:
- id: black
language_version: python3.8
exclude: ingestion/src/metadata/generated
- repo: https://github.com/timothycrosley/isort
rev: 5.9.3
hooks:
- id: isort
args: ["--profile", "black"]
exclude: ingestion/src/metadata/generated
- repo: local
hooks:
- id: google-style-java
name: Google Java Code Style for Java
description: Formats code in Google's Java codestyle.
entry: scripts/format-code.sh
language: script
files: \.java$ # We don't technically need this, as the script will filter for us, but this will allow the hook to be skipped if no Java is changed.
require_serial: true
- repo: local
hooks:
- id: lint-staged
name: lint-staged
description: Formats TS and JS code.
entry: scripts/lint-staged.sh
language: script
files: \.(js|jsx|ts|tsx)$
require_serial: true

View File

@ -323,6 +323,10 @@
<build>
<plugins>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>googleformatter-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>

View File

@ -50,18 +50,12 @@ public interface EntityDAO<T> {
String findById(@Define("table") String table, @Bind("id") String id);
@SqlQuery("SELECT json FROM <table> WHERE <nameColumn> = :name")
String findByName(
@Define("table") String table,
@Define("nameColumn") String nameColumn,
@Bind("name") String name);
String findByName(@Define("table") String table, @Define("nameColumn") String nameColumn, @Bind("name") String name);
@SqlQuery(
"SELECT count(*) FROM <table> WHERE "
+ "(<nameColumn> LIKE CONCAT(:fqnPrefix, '.%') OR :fqnPrefix IS NULL)")
"SELECT count(*) FROM <table> WHERE " + "(<nameColumn> LIKE CONCAT(:fqnPrefix, '.%') OR :fqnPrefix IS NULL)")
int listCount(
@Define("table") String table,
@Define("nameColumn") String nameColumn,
@Bind("fqnPrefix") String fqnPrefix);
@Define("table") String table, @Define("nameColumn") String nameColumn, @Bind("fqnPrefix") String fqnPrefix);
@SqlQuery(
"SELECT json FROM ("
@ -119,8 +113,7 @@ public interface EntityDAO<T> {
}
if (entity == null) {
String entityName = Entity.getEntityNameFromClass(clz);
throw EntityNotFoundException.byMessage(
CatalogExceptionMessage.entityNotFound(entityName, id));
throw EntityNotFoundException.byMessage(CatalogExceptionMessage.entityNotFound(entityName, id));
}
return entity;
}
@ -134,8 +127,7 @@ public interface EntityDAO<T> {
}
if (entity == null) {
String entityName = Entity.getEntityNameFromClass(clz);
throw EntityNotFoundException.byMessage(
CatalogExceptionMessage.entityNotFound(entityName, fqn));
throw EntityNotFoundException.byMessage(CatalogExceptionMessage.entityNotFound(entityName, fqn));
}
return entity;
}

View File

@ -114,4 +114,13 @@
<artifactId>jackson-datatype-jsr353</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>googleformatter-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,13 @@
repos:
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
language_version: python3.8
exclude: ingestion/src/metadata/generated
- repo: https://github.com/timothycrosley/isort
rev: 5.9.3
hooks:
- id: isort
args: ["--profile", "black"]
exclude: ingestion/src/metadata/generated

View File

@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "lint-staged --concurrent false"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -140,6 +140,7 @@
"file-loader": "4.3.0",
"fork-ts-checker-webpack-plugin": "^6.0.8",
"html-webpack-plugin": "^4.5.1",
"husky": "^4.3.0",
"jest": "^26.6.3",
"jest-environment-jsdom-fourteen": "^1.0.1",
"lint-staged": "^10.3.0",

24
pom.xml
View File

@ -433,6 +433,30 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.theoryinpractise</groupId>
<artifactId>googleformatter-maven-plugin</artifactId>
<version>1.7.3</version>
<executions>
<execution>
<id>reformat-sources</id>
<configuration>
<includeStale>false</includeStale>
<style>GOOGLE</style>
<formatMain>true</formatMain>
<formatTest>true</formatTest>
<filterModified>false</filterModified>
<skip>false</skip>
<fixImports>true</fixImports>
<maxLineLength>120</maxLineLength>
</configuration>
<goals>
<goal>format</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>

View File

@ -1,23 +0,0 @@
#!/usr/bin/env sh
VERSION=1.13.0
JARFILE=google-java-format-$VERSION-all-deps.jar
mkdir -p .cache
cd .cache
if [ ! -f $JARFILE ]
then
curl -LJO "https://github.com/google/google-java-format/releases/download/v$VERSION/$JARFILE"
chmod 755 $JARFILE
fi
cd ..
changed_java_files=$(git diff --cached --name-only --diff-filter=ACMR | grep ".*java$" )
echo $changed_java_files
java \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-jar .cache/$JARFILE --replace $changed_java_files

View File

@ -1,4 +0,0 @@
#!/usr/bin/env sh
cd openmetadata-ui/src/main/resources/ui
npx lint-staged --concurrent false