This is an automated email from the ASF dual-hosted git repository. chesnay pushed a commit to branch ci_utils in repository https://gitbox.apache.org/repos/asf/flink-connector-shared-utils.git
commit d672ed1aded3dc26785b40e0baf6de94e78d1894 Author: Chesnay Schepler <ches...@apache.org> AuthorDate: Tue Mar 14 14:36:15 2023 +0100 [FLINK-31455] Setup test project --- .editorconfig | 276 ++++++++++ .github/workflows/_testing.yml | 37 ++ .gitignore | 38 +- pom.xml | 127 +++++ .../apache/flink/connector/testing/SomeClass.java | 22 + .../flink/connector/testing/SomeClassTest.java | 27 + tools/maven/checkstyle.xml | 562 +++++++++++++++++++++ tools/maven/suppressions.xml | 30 ++ 8 files changed, 1118 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b66771d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,276 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +max_line_length = 100 +# ij_formatter_off_tag = @formatter:off +# ij_formatter_on_tag = @formatter:on +# ij_formatter_tags_enabled = false +# ij_smart_tabs = false +# ij_wrap_on_typing = false + +[*.java] +indent_size = 4 +indent_style = space +tab_width = 4 +ij_continuation_indent_size = 8 +# ij_java_align_consecutive_assignments = false +# ij_java_align_consecutive_variable_declarations = false +# ij_java_align_group_field_declarations = false +# ij_java_align_multiline_annotation_parameters = false +# ij_java_align_multiline_array_initializer_expression = false +# ij_java_align_multiline_assignment = false +# ij_java_align_multiline_binary_operation = false +# ij_java_align_multiline_chained_methods = false +# ij_java_align_multiline_extends_list = false +# ij_java_align_multiline_for = true +# ij_java_align_multiline_method_parentheses = false +# ij_java_align_multiline_parameters = true +# ij_java_align_multiline_parameters_in_calls = false +# ij_java_align_multiline_parenthesized_expression = false +# ij_java_align_multiline_records = true +# ij_java_align_multiline_resources = true +# ij_java_align_multiline_ternary_operation = false +# ij_java_align_multiline_text_blocks = false +# ij_java_align_multiline_throws_list = false +# ij_java_align_subsequent_simple_methods = false +# ij_java_align_throws_keyword = false +# ij_java_annotation_parameter_wrap = off +# ij_java_array_initializer_new_line_after_left_brace = false +# ij_java_array_initializer_right_brace_on_new_line = false +# ij_java_array_initializer_wrap = off +# ij_java_assert_statement_colon_on_next_line = false +# ij_java_assert_statement_wrap = off +# ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = true +ij_java_binary_operation_wrap = normal +# ij_java_blank_lines_after_anonymous_class_header = 0 +# ij_java_blank_lines_after_class_header = 0 +# ij_java_blank_lines_after_imports = 1 +# ij_java_blank_lines_after_package = 1 +# ij_java_blank_lines_around_class = 1 +# ij_java_blank_lines_around_field = 0 +# ij_java_blank_lines_around_field_in_interface = 0 +# ij_java_blank_lines_around_initializer = 1 +# ij_java_blank_lines_around_method = 1 +# ij_java_blank_lines_around_method_in_interface = 1 +# ij_java_blank_lines_before_class_end = 0 +# ij_java_blank_lines_before_imports = 1 +# ij_java_blank_lines_before_method_body = 0 +# ij_java_blank_lines_before_package = 0 +# ij_java_block_brace_style = end_of_line +# ij_java_block_comment_at_first_column = true +ij_java_call_parameters_new_line_after_left_paren = true +# ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = on_every_item +# ij_java_case_statement_on_separate_line = true +# ij_java_catch_on_new_line = false +# ij_java_class_annotation_wrap = split_into_lines +# ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 9999 +# ij_java_class_names_in_javadoc = 1 +# ij_java_do_not_indent_top_level_class_members = false +# ij_java_do_not_wrap_after_single_annotation = false +# ij_java_do_while_brace_force = never +# ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = true +ij_java_doc_add_blank_line_after_return = true +# ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = false +ij_java_doc_align_param_comments = false +ij_java_doc_do_not_wrap_if_one_line = true +ij_java_doc_enable_formatting = true +# ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = true +ij_java_doc_keep_empty_lines = true +# ij_java_doc_keep_empty_parameter_tag = true +# ij_java_doc_keep_empty_return_tag = true +# ij_java_doc_keep_empty_throws_tag = true +# ij_java_doc_keep_invalid_tags = true +# ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +# ij_java_doc_use_throws_not_exception_tag = true +# ij_java_else_on_new_line = false +# ij_java_entity_dd_suffix = EJB +# ij_java_entity_eb_suffix = Bean +# ij_java_entity_hi_suffix = Home +# ij_java_entity_lhi_prefix = Local +# ij_java_entity_lhi_suffix = Home +# ij_java_entity_li_prefix = Local +# ij_java_entity_pk_class = java.lang.String +# ij_java_entity_vo_suffix = VO +# ij_java_enum_constants_wrap = off +# ij_java_extends_keyword_wrap = off +# ij_java_extends_list_wrap = off +# ij_java_field_annotation_wrap = split_into_lines +# ij_java_finally_on_new_line = false +# ij_java_for_brace_force = never +# ij_java_for_statement_new_line_after_left_paren = false +# ij_java_for_statement_right_paren_on_new_line = false +# ij_java_for_statement_wrap = off +# ij_java_generate_final_locals = false +# ij_java_generate_final_parameters = false +# ij_java_if_brace_force = never +ij_java_imports_layout = org.apache.flink.**,|,org.apache.flink.shaded.**,|,*,|,javax.**,|,java.**,|,scala.**,|,$* +# ij_java_indent_case_from_switch = true +# ij_java_insert_inner_class_imports = false +# ij_java_insert_override_annotation = true +# ij_java_keep_blank_lines_before_right_brace = 2 +# ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +# ij_java_keep_blank_lines_in_code = 2 +# ij_java_keep_blank_lines_in_declarations = 2 +# ij_java_keep_control_statement_in_one_line = true +# ij_java_keep_first_column_comment = true +# ij_java_keep_indents_on_empty_lines = false +# ij_java_keep_line_breaks = true +# ij_java_keep_multiple_expressions_in_one_line = false +# ij_java_keep_simple_blocks_in_one_line = false +# ij_java_keep_simple_classes_in_one_line = false +# ij_java_keep_simple_lambdas_in_one_line = false +# ij_java_keep_simple_methods_in_one_line = false +# ij_java_label_indent_absolute = false +# ij_java_label_indent_size = 0 +# ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +# ij_java_line_comment_add_space = false +# ij_java_line_comment_at_first_column = true +# ij_java_message_dd_suffix = EJB +# ij_java_message_eb_suffix = Bean +# ij_java_method_annotation_wrap = split_into_lines +# ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = on_every_item +ij_java_method_parameters_new_line_after_left_paren = true +# ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = on_every_item +# ij_java_modifier_list_wrap = false +ij_java_names_count_to_use_import_on_demand = 9999 +# ij_java_new_line_after_lparen_in_record_header = false +# ij_java_packages_to_use_import_on_demand = java.awt.*,javax.swing.* +# ij_java_parameter_annotation_wrap = off +# ij_java_parentheses_expression_new_line_after_left_paren = false +# ij_java_parentheses_expression_right_paren_on_new_line = false +# ij_java_place_assignment_sign_on_next_line = false +# ij_java_prefer_longer_names = true +# ij_java_prefer_parameters_wrap = false +# ij_java_record_components_wrap = normal +# ij_java_repeat_synchronized = true +# ij_java_replace_instanceof_and_cast = false +# ij_java_replace_null_check = true +# ij_java_replace_sum_lambda_with_method_ref = true +# ij_java_resource_list_new_line_after_left_paren = false +# ij_java_resource_list_right_paren_on_new_line = false +# ij_java_resource_list_wrap = off +# ij_java_rparen_on_new_line_in_record_header = false +# ij_java_session_dd_suffix = EJB +# ij_java_session_eb_suffix = Bean +# ij_java_session_hi_suffix = Home +# ij_java_session_lhi_prefix = Local +# ij_java_session_lhi_suffix = Home +# ij_java_session_li_prefix = Local +# ij_java_session_si_suffix = Service +# ij_java_space_after_closing_angle_bracket_in_type_argument = false +# ij_java_space_after_colon = true +# ij_java_space_after_comma = true +# ij_java_space_after_comma_in_type_arguments = true +# ij_java_space_after_for_semicolon = true +# ij_java_space_after_quest = true +# ij_java_space_after_type_cast = true +# ij_java_space_before_annotation_array_initializer_left_brace = false +# ij_java_space_before_annotation_parameter_list = false +# ij_java_space_before_array_initializer_left_brace = false +# ij_java_space_before_catch_keyword = true +# ij_java_space_before_catch_left_brace = true +# ij_java_space_before_catch_parentheses = true +# ij_java_space_before_class_left_brace = true +# ij_java_space_before_colon = true +# ij_java_space_before_colon_in_foreach = true +# ij_java_space_before_comma = false +# ij_java_space_before_do_left_brace = true +# ij_java_space_before_else_keyword = true +# ij_java_space_before_else_left_brace = true +# ij_java_space_before_finally_keyword = true +# ij_java_space_before_finally_left_brace = true +# ij_java_space_before_for_left_brace = true +# ij_java_space_before_for_parentheses = true +# ij_java_space_before_for_semicolon = false +# ij_java_space_before_if_left_brace = true +# ij_java_space_before_if_parentheses = true +# ij_java_space_before_method_call_parentheses = false +# ij_java_space_before_method_left_brace = true +# ij_java_space_before_method_parentheses = false +# ij_java_space_before_opening_angle_bracket_in_type_parameter = false +# ij_java_space_before_quest = true +# ij_java_space_before_switch_left_brace = true +# ij_java_space_before_switch_parentheses = true +# ij_java_space_before_synchronized_left_brace = true +# ij_java_space_before_synchronized_parentheses = true +# ij_java_space_before_try_left_brace = true +# ij_java_space_before_try_parentheses = true +# ij_java_space_before_type_parameter_list = false +# ij_java_space_before_while_keyword = true +# ij_java_space_before_while_left_brace = true +# ij_java_space_before_while_parentheses = true +# ij_java_space_inside_one_line_enum_braces = false +# ij_java_space_within_empty_array_initializer_braces = false +# ij_java_space_within_empty_method_call_parentheses = false +# ij_java_space_within_empty_method_parentheses = false +# ij_java_spaces_around_additive_operators = true +# ij_java_spaces_around_assignment_operators = true +# ij_java_spaces_around_bitwise_operators = true +# ij_java_spaces_around_equality_operators = true +# ij_java_spaces_around_lambda_arrow = true +# ij_java_spaces_around_logical_operators = true +# ij_java_spaces_around_method_ref_dbl_colon = false +# ij_java_spaces_around_multiplicative_operators = true +# ij_java_spaces_around_relational_operators = true +# ij_java_spaces_around_shift_operators = true +# ij_java_spaces_around_type_bounds_in_type_parameters = true +# ij_java_spaces_around_unary_operator = false +# ij_java_spaces_within_angle_brackets = false +# ij_java_spaces_within_annotation_parentheses = false +# ij_java_spaces_within_array_initializer_braces = false +# ij_java_spaces_within_braces = false +# ij_java_spaces_within_brackets = false +# ij_java_spaces_within_cast_parentheses = false +# ij_java_spaces_within_catch_parentheses = false +# ij_java_spaces_within_for_parentheses = false +# ij_java_spaces_within_if_parentheses = false +# ij_java_spaces_within_method_call_parentheses = false +# ij_java_spaces_within_method_parentheses = false +# ij_java_spaces_within_parentheses = false +# ij_java_spaces_within_switch_parentheses = false +# ij_java_spaces_within_synchronized_parentheses = false +# ij_java_spaces_within_try_parentheses = false +# ij_java_spaces_within_while_parentheses = false +# ij_java_special_else_if_treatment = true +# ij_java_subclass_name_suffix = Impl +# ij_java_ternary_operation_signs_on_next_line = false +# ij_java_ternary_operation_wrap = off +# ij_java_test_name_suffix = Test +# ij_java_throws_keyword_wrap = off +# ij_java_throws_list_wrap = off +# ij_java_use_external_annotations = false +# ij_java_use_fq_class_names = false +# ij_java_use_relative_indents = false +# ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = normal +# ij_java_visibility = public +# ij_java_while_brace_force = never +# ij_java_while_on_new_line = false +# ij_java_wrap_comments = false +ij_java_wrap_first_method_in_call_chain = true +# ij_java_wrap_long_lines = false + +[*.xml] +indent_style = tab +indent_size = 4 + +[*.scala] +indent_style = space +indent_size = 2 + +[*.py] +indent_style = space +indent_size = 4 \ No newline at end of file diff --git a/.github/workflows/_testing.yml b/.github/workflows/_testing.yml new file mode 100644 index 0000000..130c476 --- /dev/null +++ b/.github/workflows/_testing.yml @@ -0,0 +1,37 @@ +################################################################################ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +name: CI +on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + specific-version: + uses: ./.github/workflows/ci.yml + with: + flink_version: 1.16.1 + snapshot-version: + uses: ./.github/workflows/ci.yml + with: + flink_version: 1.16-SNAPSHOT + disable-convergence: + uses: ./.github/workflows/ci.yml + with: + flink_version: 1.16.1 + run_dependency_convergence: false diff --git a/.gitignore b/.gitignore index 29b636a..d6073bc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,38 @@ +.eslintcache +.cache +scalastyle-output.xml +.classpath .idea -*.iml \ No newline at end of file +!.idea/vcs.xml +.metadata +.settings +.project +.version.properties +filter.properties +logs.zip +.mvn/wrapper/*.jar +target +tmp +*.class +*.iml +*.swp +*.jar +*.zip +*.log +*.pyc +.DS_Store +build-target +atlassian-ide-plugin.xml +out/ +/docs/api +/docs/.bundle +/docs/.rubydeps +/docs/ruby2/.bundle +/docs/ruby2/.rubydeps +/docs/.jekyll-metadata +*.ipr +*.iws +tools/flink +tools/flink-* +tools/releasing/release +tools/japicmp-output \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..fa1b1d6 --- /dev/null +++ b/pom.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + + <parent> + <groupId>io.github.zentol.flink</groupId> + <artifactId>flink-connector-parent</artifactId> + <version>1.0</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.flink</groupId> + <artifactId>test-project</artifactId> + <version>1.0</version> + <packaging>jar</packaging> + + <properties> + <flink.version>1.16.1</flink.version> + <japicmp.referenceVersion>1.16.0</japicmp.referenceVersion> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.flink</groupId> + <artifactId>flink-core</artifactId> + <version>${flink.version}</version> + </dependency> + <dependency> + <groupId>org.apache.flink</groupId> + <artifactId>flink-test-utils-junit</artifactId> + <version>${flink.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.36</version> + </dependency> + </dependencies> + </dependencyManagement> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <inherited>false</inherited> + <dependencies> + <dependency> + <groupId>org.apache.flink</groupId> + <artifactId>flink-ci-tools</artifactId> + <version>${flink.version}</version> + </dependency> + </dependencies> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + </plugin> + + <plugin> + <!-- activate API compatibility checks --> + <groupId>io.github.zentol.japicmp</groupId> + <artifactId>japicmp-maven-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <inherited>false</inherited> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + </plugin> + + <plugin> + <groupId>com.diffplug.spotless</groupId> + <artifactId>spotless-maven-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> diff --git a/src/main/java/org/apache/flink/connector/testing/SomeClass.java b/src/main/java/org/apache/flink/connector/testing/SomeClass.java new file mode 100644 index 0000000..36da836 --- /dev/null +++ b/src/main/java/org/apache/flink/connector/testing/SomeClass.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.connector.testing; + +/** A dummy class; only exists so that the compile/packaging plugins have something to do. */ +public class SomeClass {} diff --git a/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java b/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java new file mode 100644 index 0000000..57630b7 --- /dev/null +++ b/src/test/java/org/apache/flink/connector/testing/SomeClassTest.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.connector.testing; + +import org.junit.jupiter.api.Test; + +class SomeClassTest { + + @Test + void someTest() {} +} diff --git a/tools/maven/checkstyle.xml b/tools/maven/checkstyle.xml new file mode 100644 index 0000000..2048fd1 --- /dev/null +++ b/tools/maven/checkstyle.xml @@ -0,0 +1,562 @@ +<?xml version="1.0"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> + +<!-- +This is a checkstyle configuration file. For descriptions of +what the following rules do, please see the checkstyle configuration +page at http://checkstyle.sourceforge.net/config.html. + +This file is based on the checkstyle file of Apache Beam. +--> + +<module name="Checker"> + + <module name="NewlineAtEndOfFile"> + <!-- windows can use \r\n vs \n, so enforce the most used one ie UNIx style --> + <property name="lineSeparator" value="lf"/> + </module> + + <module name="RegexpSingleline"> + <!-- Checks that TODOs don't have stuff in parenthesis, e.g., username. --> + <property name="format" value="((//.*)|(\*.*))TODO\("/> + <property name="message" value="TODO comments must not include usernames."/> + <property name="severity" value="error"/> + </module> + + <module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + <property name="message" value="Trailing whitespace"/> + <property name="severity" value="error"/> + </module> + + <module name="RegexpSingleline"> + <property name="format" value="Throwables.propagate\("/> + <property name="message" value="Throwables.propagate is deprecated"/> + <property name="severity" value="error"/> + </module> + + <!-- Prevent *Tests.java as tools may not pick them up --> + <!--<module name="RegexpOnFilename">--> + <!--<property name="fileNamePattern" value=".*Tests\.java$" />--> + <!--</module>--> + + <module name="SuppressionFilter"> + <property name="file" value="${checkstyle.suppressions.file}" default="suppressions.xml"/> + </module> + + <!-- Check that every module has a package-info.java --> + <!--<module name="JavadocPackage"/>--> + + <!-- + + FLINK CUSTOM CHECKS + + --> + + <module name="FileLength"> + <property name="max" value="3000"/> + </module> + + <!-- All Java AST specific tests live under TreeWalker module. --> + <module name="TreeWalker"> + + <!-- Allow use of comment to suppress javadocstyle --> + <module name="SuppressionCommentFilter"> + <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/> + <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/> + <property name="checkFormat" value="$1"/> + </module> + + <!-- + + FLINK CUSTOM CHECKS + + --> + + <!-- Prohibit T.getT() methods for standard boxed types --> + <module name="Regexp"> + <property name="format" value="Boolean\.getBoolean"/> + <property name="illegalPattern" value="true"/> + <property name="message" value="Use System.getProperties() to get system properties."/> + </module> + + <module name="Regexp"> + <property name="format" value="Integer\.getInteger"/> + <property name="illegalPattern" value="true"/> + <property name="message" value="Use System.getProperties() to get system properties."/> + </module> + + <module name="Regexp"> + <property name="format" value="Long\.getLong"/> + <property name="illegalPattern" value="true"/> + <property name="message" value="Use System.getProperties() to get system properties."/> + </module> + + <!-- + + IllegalImport cannot blacklist classes so we have to fall back to Regexp. + + --> + + <!-- forbid use of commons lang validate --> + <module name="Regexp"> + <property name="format" value="org\.apache\.commons\.lang3\.Validate"/> + <property name="illegalPattern" value="true"/> + <property name="message" + value="Use Guava Checks instead of Commons Validate. Please refer to the coding guidelines."/> + </module> + <!-- forbid the use of google.common.base.Preconditions --> + <module name="Regexp"> + <property name="format" value="import com\.google\.common\.base\.Preconditions"/> + <property name="illegalPattern" value="true"/> + <property name="message" + value="Use Flink's Preconditions instead of Guava's Preconditions"/> + </module> + <!-- forbid the use of com.google.common.annotations.VisibleForTesting --> + <module name="Regexp"> + <property name="format" + value="import com\.google\.common\.annotations\.VisibleForTesting"/> + <property name="illegalPattern" value="true"/> + <property name="message" + value="Use Flink's VisibleForTesting instead of Guava's VisibleForTesting"/> + </module> + <module name="Regexp"> + <property name="format" value="import static com\.google\.common\.base\.Preconditions"/> + <property name="illegalPattern" value="true"/> + <property name="message" + value="Use Flink's Preconditions instead of Guava's Preconditions"/> + </module> + <!-- forbid the use of org.apache.commons.lang.SerializationUtils --> + <module name="Regexp"> + <property name="format" value="org\.apache\.commons\.lang\.SerializationUtils"/> + <property name="illegalPattern" value="true"/> + <property name="message" + value="Use Flink's InstantiationUtil instead of common's SerializationUtils"/> + </module> + <module name="Regexp"> + <property name="format" value="org\.apache\.commons\.lang3\.SerializationUtils"/> + <property name="illegalPattern" value="true"/> + <property name="message" + value="Use Flink's InstantiationUtil instead of common's SerializationUtils"/> + </module> + <module name="Regexp"> + <property name="format" value="org\.apache\.commons\.lang\."/> + <property name="illegalPattern" value="true"/> + <property name="message" value="Use commons-lang3 instead of commons-lang."/> + </module> + <module name="Regexp"> + <property name="format" value="org\.codehaus\.jettison"/> + <property name="illegalPattern" value="true"/> + <property name="message" value="Use com.fasterxml.jackson instead of jettison."/> + </module> + + <!-- Enforce Java-style array declarations --> + <module name="ArrayTypeStyle"/> + + <module name="TodoComment"> + <!-- Checks that disallowed strings are not used in comments. --> + <property name="format" value="(FIXME)|(XXX)|(@author)"/> + </module> + + <!-- + + IMPORT CHECKS + + --> + + <module name="RedundantImport"> + <!-- Checks for redundant import statements. --> + <property name="severity" value="error"/> + <message key="import.redundancy" + value="Redundant import {0}."/> + </module> + + <module name="ImportOrder"> + <!-- Checks for out of order import statements. --> + <property name="severity" value="error"/> + <property name="groups" + value="org.apache.flink,org.apache.flink.shaded,*,javax,java,scala"/> + <property name="separated" value="true"/> + <property name="sortStaticImportsAlphabetically" value="true"/> + <property name="option" value="bottom"/> + <property name="tokens" value="STATIC_IMPORT, IMPORT"/> + <message key="import.ordering" + value="Import {0} appears after other imports that it should precede"/> + </module> + + <module name="AvoidStarImport"> + <property name="severity" value="error"/> + </module> + + <module name="IllegalImport"> + <property name="illegalPkgs" + value="autovalue.shaded, avro.shaded, com.google.api.client.repackaged, com.google.appengine.repackaged"/> + </module> + <module name="IllegalImport"> + <property name="illegalPkgs" value="org.codehaus.jackson"/> + <message key="import.illegal" value="{0}; Use flink-shaded-jackson instead."/> + </module> + <module name="IllegalImport"> + <property name="illegalPkgs" value="org.objectweb.asm"/> + <message key="import.illegal" value="{0}; Use flink-shaded-asm instead."/> + </module> + <module name="IllegalImport"> + <property name="illegalPkgs" value="io.netty"/> + <message key="import.illegal" value="{0}; Use flink-shaded-netty instead."/> + </module> + <module name="IllegalImport"> + <property name="illegalPkgs" value="com.google.common"/> + <message key="import.illegal" value="{0}; Use flink-shaded-guava instead."/> + </module> + + <module name="RedundantModifier"> + <!-- Checks for redundant modifiers on various symbol definitions. + See: http://checkstyle.sourceforge.net/config_modifier.html#RedundantModifier + + We exclude METHOD_DEF to allow final methods in final classes to make them more future-proof. + --> + <property name="tokens" + value="VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CLASS_DEF, ENUM_DEF"/> + </module> + + <!-- + IllegalImport cannot blacklist classes, and c.g.api.client.util is used for some shaded + code and some useful code. So we need to fall back to Regexp. + --> + <!--<module name="RegexpSinglelineJava">--> + <!--<property name="format" value="com\.google\.api\.client\.util\.(ByteStreams|Charsets|Collections2|Joiner|Lists|Maps|Objects|Preconditions|Sets|Strings|Throwables)"/>--> + <!--</module>--> + + <!-- + Require static importing from Preconditions. + --> + <module name="RegexpSinglelineJava"> + <property name="format" value="^import com.google.common.base.Preconditions;$"/> + <property name="message" value="Static import functions from Guava Preconditions"/> + </module> + + <module name="UnusedImports"> + <property name="severity" value="error"/> + <property name="processJavadoc" value="true"/> + <message key="import.unused" + value="Unused import: {0}."/> + </module> + + <!-- + + JAVADOC CHECKS + + --> + + <!-- Checks for Javadoc comments. --> + <!-- See http://checkstyle.sf.net/config_javadoc.html --> + <module name="JavadocMethod"> + <property name="scope" value="protected"/> + <property name="severity" value="error"/> + <property name="allowMissingJavadoc" value="true"/> + <property name="allowMissingParamTags" value="true"/> + <property name="allowMissingReturnTag" value="true"/> + <property name="allowMissingThrowsTags" value="true"/> + <property name="allowThrowsTagsForSubclasses" value="true"/> + <property name="allowUndeclaredRTE" value="true"/> + <!-- This check sometimes failed for with "Unable to get class information for @throws tag" for custom exceptions --> + <property name="suppressLoadErrors" value="true"/> + </module> + + <!-- Check that paragraph tags are used correctly in Javadoc. --> + <module name="JavadocParagraph"/> + + <module name="JavadocType"> + <property name="scope" value="protected"/> + <property name="severity" value="error"/> + <property name="allowMissingParamTags" value="true"/> + </module> + + <module name="JavadocStyle"> + <property name="severity" value="error"/> + <property name="checkHtml" value="true"/> + </module> + + <!-- + + NAMING CHECKS + + --> + + <!-- Item 38 - Adhere to generally accepted naming conventions --> + + <module name="PackageName"> + <!-- Validates identifiers for package names against the + supplied expression. --> + <!-- Here the default checkstyle rule restricts package name parts to + seven characters, this is not in line with common practice at Google. + --> + <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/> + <property name="severity" value="error"/> + </module> + + <module name="TypeNameCheck"> + <!-- Validates static, final fields against the + expression "^[A-Z][a-zA-Z0-9]*$". --> + <metadata name="altname" value="TypeName"/> + <property name="severity" value="error"/> + </module> + + <module name="ConstantNameCheck"> + <!-- Validates non-private, static, final fields against the supplied + public/package final fields "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". --> + <metadata name="altname" value="ConstantName"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="false"/> + <property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|FLAG_.*)$"/> + <message key="name.invalidPattern" + value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/> + <property name="severity" value="error"/> + </module> + + <module name="StaticVariableNameCheck"> + <!-- Validates static, non-final fields against the supplied + expression "^[a-z][a-zA-Z0-9]*_?$". --> + <metadata name="altname" value="StaticVariableName"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + <property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/> + <property name="severity" value="error"/> + </module> + + <module name="MemberNameCheck"> + <!-- Validates non-static members against the supplied expression. --> + <metadata name="altname" value="MemberName"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + <property name="severity" value="error"/> + </module> + + <module name="MethodNameCheck"> + <!-- Validates identifiers for method names. --> + <metadata name="altname" value="MethodName"/> + <property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*$"/> + <property name="severity" value="error"/> + </module> + + <module name="ParameterName"> + <!-- Validates identifiers for method parameters against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + + <module name="LocalFinalVariableName"> + <!-- Validates identifiers for local final variables against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + + <module name="LocalVariableName"> + <!-- Validates identifiers for local variables against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + + <!-- Type parameters must be either one of the four blessed letters + T, K, V, W, X or else be capital-case terminated with a T, + such as MyGenericParameterT --> + <!--<module name="ClassTypeParameterName">--> + <!--<property name="format" value="^(((T|K|V|W|X)[0-9]*)|([A-Z][a-z][a-zA-Z]*T))$"/>--> + <!--<property name="severity" value="error"/>--> + <!--</module>--> + + <!--<module name="MethodTypeParameterName">--> + <!--<property name="format" value="^(((T|K|V|W|X)[0-9]*)|([A-Z][a-z][a-zA-Z]*T))$"/>--> + <!--<property name="severity" value="error"/>--> + <!--</module>--> + + <!--<module name="InterfaceTypeParameterName">--> + <!--<property name="format" value="^(((T|K|V|W|X)[0-9]*)|([A-Z][a-z][a-zA-Z]*T))$"/>--> + <!--<property name="severity" value="error"/>--> + <!--</module>--> + + <!-- + + LENGTH and CODING CHECKS + + --> + + <!--<module name="LineLength">--> + <!--<!– Checks if a line is too long. –>--> + <!--<property name="max" value="100"/>--> + <!--<property name="severity" value="error"/>--> + + <!--<!–--> + <!--The default ignore pattern exempts the following elements:--> + <!-- - import statements--> + <!-- - long URLs inside comments--> + <!--–>--> + + <!--<property name="ignorePattern"--> + <!--value="^(package .*;\s*)|(import .*;\s*)|( *\* .*https?://.*)$"/>--> + <!--</module>--> + + <!-- Checks for braces around if and else blocks --> + <module name="NeedBraces"> + <property name="severity" value="error"/> + <property name="tokens" + value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/> + </module> + + <module name="UpperEll"> + <!-- Checks that long constants are defined with an upper ell.--> + <property name="severity" value="error"/> + </module> + + <module name="FallThrough"> + <!-- Warn about falling through to the next case statement. Similar to + javac -Xlint:fallthrough, but the check is suppressed if a single-line comment + on the last non-blank line preceding the fallen-into case contains 'fall through' (or + some other variants that we don't publicized to promote consistency). + --> + <property name="reliefPattern" + value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/> + <property name="severity" value="error"/> + </module> + + <!-- Checks for over-complicated boolean expressions. --> + <module name="SimplifyBooleanExpression"/> + + <!-- Detects empty statements (standalone ";" semicolon). --> + <module name="EmptyStatement"/> + + <!-- Detect multiple consecutive semicolons (e.g. ";;"). --> + <module name="RegexpSinglelineJava"> + <property name="format" value=";{2,}"/> + <property name="message" value="Use one semicolon"/> + <property name="ignoreComments" value="true"/> + </module> + + <!-- + + MODIFIERS CHECKS + + --> + + <module name="ModifierOrder"> + <!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and + 8.4.3. The prescribed order is: + public, protected, private, abstract, static, final, transient, volatile, + synchronized, native, strictfp + --> + <property name="severity" value="error"/> + </module> + + + <!-- + + WHITESPACE CHECKS + + --> + + <module name="EmptyLineSeparator"> + <!-- Checks for empty line separator between tokens. The only + excluded token is VARIABLE_DEF, allowing class fields to + be declared on consecutive lines. + --> + <property name="allowMultipleEmptyLines" value="false"/> + <property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/> + <property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, + INTERFACE_DEF, ENUM_DEF, STATIC_INIT, INSTANCE_INIT, METHOD_DEF, + CTOR_DEF"/> + </module> + + <module name="WhitespaceAround"> + <!-- Checks that various tokens are surrounded by whitespace. + This includes most binary operators and keywords followed + by regular or curly braces. + --> + <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, + BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, + EQUAL, GE, GT, LAMBDA, LAND, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, + LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, + LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, + MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, + SL, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/> + <property name="severity" value="error"/> + </module> + + <module name="WhitespaceAfter"> + <!-- Checks that commas, semicolons and typecasts are followed by + whitespace. + --> + <property name="tokens" value="COMMA, SEMI, TYPECAST"/> + </module> + + <module name="NoWhitespaceAfter"> + <!-- Checks that there is no whitespace after various unary operators. + Linebreaks are allowed. + --> + <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, + UNARY_PLUS"/> + <property name="allowLineBreaks" value="true"/> + <property name="severity" value="error"/> + </module> + + <module name="NoWhitespaceBefore"> + <!-- Checks that there is no whitespace before various unary operators. + Linebreaks are allowed. + --> + <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/> + <property name="allowLineBreaks" value="true"/> + <property name="severity" value="error"/> + </module> + + <!--<module name="OperatorWrap">--> + <!--<!– Checks that operators like + and ? appear at newlines rather than--> + <!--at the end of the previous line.--> + <!--–>--> + <!--<property name="option" value="NL"/>--> + <!--<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL,--> + <!--GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD,--> + <!--NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR "/>--> + <!--</module>--> + + <module name="OperatorWrap"> + <!-- Checks that assignment operators are at the end of the line. --> + <property name="option" value="eol"/> + <property name="tokens" value="ASSIGN"/> + </module> + + <module name="ParenPad"> + <!-- Checks that there is no whitespace before close parens or after + open parens. + --> + <property name="severity" value="error"/> + </module> + + </module> +</module> + diff --git a/tools/maven/suppressions.xml b/tools/maven/suppressions.xml new file mode 100644 index 0000000..8affed4 --- /dev/null +++ b/tools/maven/suppressions.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<!DOCTYPE suppressions PUBLIC + "-//Puppy Crawl//DTD Suppressions 1.1//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> + +<suppressions> + <!-- Pulsar broker required to handle Netty EventLoopGroup --> + <suppress + files="MockBookKeeperClientFactory.java" + checks="IllegalImport"/> +</suppressions>