diff --git a/.config/.editorconfig b/.config/.editorconfig new file mode 100644 index 0000000..ef939c4 --- /dev/null +++ b/.config/.editorconfig @@ -0,0 +1,367 @@ +# generated via dotnet +# https://learn.microsoft.com/en-us/community/content/how-to-enforce-dotnet-format-using-editorconfig-github-actions#option-3-creating-an-editorconfig-file-using-the-dotnet-cli +root = true +roslynator_analyzers.enabled_by_default = true + +# All files +[*] +charset = utf-8 + +# C# files +[*.{cs|csx}] +# Default severity for analyzer diagnostics with category 'Style' (escalated to build error) +dotnet_analyzer_diagnostic.category-Style.severity = error +dotnet_diagnostic.CAxxxx.severity = error + +#### Core EditorConfig Options #### + +# Indentation and spacing +indent_size = 4 +tab_width = 4 + +# New line preferences +insert_final_newline = true +trim_trailing_whitespace = true +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false + +#### .NET Coding Conventions #### +[*.{cs,vb}] + +# Organize usings +dotnet_separate_import_directive_groups = true +dotnet_sort_system_directives_first = true +file_header_template = unset + +# this. and Me. preferences +dotnet_style_qualification_for_event = false:silent +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_property = false:silent + +# Language keywords vs BCL types preferences +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_predefined_type_for_member_access = true:silent + +# Parentheses preferences +dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent +dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent + +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent + +# Expression-level preferences +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_object_initializer = true:suggestion +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_auto_properties = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_return = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion + +# Field preferences +dotnet_style_readonly_field = true:warning + +# Parameter preferences +dotnet_code_quality_unused_parameters = all:suggestion + +# Suppression preferences +dotnet_remove_unnecessary_suppression_exclusions = none + +#### C# Coding Conventions #### +[*.cs] + +# var preferences +csharp_style_var_elsewhere = false:silent +csharp_style_var_for_built_in_types = false:silent +csharp_style_var_when_type_is_apparent = false:silent + +# Expression-bodied members +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent + +# Pattern matching preferences +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_prefer_switch_expression = true:suggestion + +# Null-checking preferences +csharp_style_conditional_delegate_call = true:suggestion + +# Modifier preferences +csharp_prefer_static_local_function = true:warning +csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent + +# Code-block preferences +csharp_prefer_braces = true:silent +csharp_prefer_simple_using_statement = true:suggestion + +# Expression-level preferences +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_pattern_local_over_anonymous_function = true:suggestion +csharp_style_prefer_index_operator = true:suggestion +csharp_style_prefer_range_operator = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:suggestion +csharp_style_unused_value_expression_statement_preference = discard_variable:silent + +# 'using' directive preferences +csharp_using_directive_placement = outside_namespace:silent + +#### C# Formatting Rules #### + +# New line preferences +csharp_new_line_before_catch = true +csharp_new_line_before_else = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_open_brace = all +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_labels = one_less_than_current +csharp_indent_switch_labels = true + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Wrapping preferences +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +#### Naming styles #### +[*.{cs,vb}] + +# Naming rules + +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.symbols = types_and_namespaces +dotnet_naming_rule.types_and_namespaces_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.interfaces_should_be_ipascalcase.severity = suggestion +dotnet_naming_rule.interfaces_should_be_ipascalcase.symbols = interfaces +dotnet_naming_rule.interfaces_should_be_ipascalcase.style = ipascalcase + +dotnet_naming_rule.type_parameters_should_be_tpascalcase.severity = suggestion +dotnet_naming_rule.type_parameters_should_be_tpascalcase.symbols = type_parameters +dotnet_naming_rule.type_parameters_should_be_tpascalcase.style = tpascalcase + +dotnet_naming_rule.methods_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.methods_should_be_pascalcase.symbols = methods +dotnet_naming_rule.methods_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.properties_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.properties_should_be_pascalcase.symbols = properties +dotnet_naming_rule.properties_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.events_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.events_should_be_pascalcase.symbols = events +dotnet_naming_rule.events_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_variables_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_variables_should_be_camelcase.symbols = local_variables +dotnet_naming_rule.local_variables_should_be_camelcase.style = camelcase + +dotnet_naming_rule.local_constants_should_be_camelcase.severity = suggestion +dotnet_naming_rule.local_constants_should_be_camelcase.symbols = local_constants +dotnet_naming_rule.local_constants_should_be_camelcase.style = camelcase + +dotnet_naming_rule.parameters_should_be_camelcase.severity = suggestion +dotnet_naming_rule.parameters_should_be_camelcase.symbols = parameters +dotnet_naming_rule.parameters_should_be_camelcase.style = camelcase + +dotnet_naming_rule.public_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_fields_should_be_pascalcase.symbols = public_fields +dotnet_naming_rule.public_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_fields_should_be__camelcase.severity = suggestion +dotnet_naming_rule.private_fields_should_be__camelcase.symbols = private_fields +dotnet_naming_rule.private_fields_should_be__camelcase.style = _camelcase + +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.severity = suggestion +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.symbols = private_static_fields +dotnet_naming_rule.private_static_fields_should_be_s_camelcase.style = s_camelcase + +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.symbols = public_constant_fields +dotnet_naming_rule.public_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.symbols = private_constant_fields +dotnet_naming_rule.private_constant_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.symbols = public_static_readonly_fields +dotnet_naming_rule.public_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.symbols = private_static_readonly_fields +dotnet_naming_rule.private_static_readonly_fields_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.enums_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.enums_should_be_pascalcase.symbols = enums +dotnet_naming_rule.enums_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.local_functions_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascalcase.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascalcase.style = pascalcase + +dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion +dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members +dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase + +# Symbol specifications + +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.interfaces.required_modifiers = + +dotnet_naming_symbols.enums.applicable_kinds = enum +dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.enums.required_modifiers = + +dotnet_naming_symbols.events.applicable_kinds = event +dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.events.required_modifiers = + +dotnet_naming_symbols.methods.applicable_kinds = method +dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.methods.required_modifiers = + +dotnet_naming_symbols.properties.applicable_kinds = property +dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.properties.required_modifiers = + +dotnet_naming_symbols.public_fields.applicable_kinds = field +dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_fields.required_modifiers = + +dotnet_naming_symbols.private_fields.applicable_kinds = field +dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_fields.required_modifiers = + +dotnet_naming_symbols.private_static_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_fields.required_modifiers = static + +dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum +dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.types_and_namespaces.required_modifiers = + +dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method +dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected +dotnet_naming_symbols.non_field_members.required_modifiers = + +dotnet_naming_symbols.type_parameters.applicable_kinds = namespace +dotnet_naming_symbols.type_parameters.applicable_accessibilities = * +dotnet_naming_symbols.type_parameters.required_modifiers = + +dotnet_naming_symbols.private_constant_fields.applicable_kinds = field +dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_constant_fields.required_modifiers = const + +dotnet_naming_symbols.local_variables.applicable_kinds = local +dotnet_naming_symbols.local_variables.applicable_accessibilities = local +dotnet_naming_symbols.local_variables.required_modifiers = + +dotnet_naming_symbols.local_constants.applicable_kinds = local +dotnet_naming_symbols.local_constants.applicable_accessibilities = local +dotnet_naming_symbols.local_constants.required_modifiers = const + +dotnet_naming_symbols.parameters.applicable_kinds = parameter +dotnet_naming_symbols.parameters.applicable_accessibilities = * +dotnet_naming_symbols.parameters.required_modifiers = + +dotnet_naming_symbols.public_constant_fields.applicable_kinds = field +dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_constant_fields.required_modifiers = const + +dotnet_naming_symbols.public_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.public_static_readonly_fields.applicable_accessibilities = public, internal +dotnet_naming_symbols.public_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private, protected, protected_internal, private_protected +dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readonly, static + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function +dotnet_naming_symbols.local_functions.applicable_accessibilities = * +dotnet_naming_symbols.local_functions.required_modifiers = + +# Naming styles + +dotnet_naming_style.pascalcase.required_prefix = +dotnet_naming_style.pascalcase.required_suffix = +dotnet_naming_style.pascalcase.word_separator = +dotnet_naming_style.pascalcase.capitalization = pascal_case + +dotnet_naming_style.ipascalcase.required_prefix = I +dotnet_naming_style.ipascalcase.required_suffix = +dotnet_naming_style.ipascalcase.word_separator = +dotnet_naming_style.ipascalcase.capitalization = pascal_case + +dotnet_naming_style.tpascalcase.required_prefix = T +dotnet_naming_style.tpascalcase.required_suffix = +dotnet_naming_style.tpascalcase.word_separator = +dotnet_naming_style.tpascalcase.capitalization = pascal_case + +dotnet_naming_style._camelcase.required_prefix = _ +dotnet_naming_style._camelcase.required_suffix = +dotnet_naming_style._camelcase.word_separator = +dotnet_naming_style._camelcase.capitalization = camel_case + +dotnet_naming_style.camelcase.required_prefix = +dotnet_naming_style.camelcase.required_suffix = +dotnet_naming_style.camelcase.word_separator = +dotnet_naming_style.camelcase.capitalization = camel_case + +dotnet_naming_style.s_camelcase.required_prefix = s_ +dotnet_naming_style.s_camelcase.required_suffix = +dotnet_naming_style.s_camelcase.word_separator = +dotnet_naming_style.s_camelcase.capitalization = camel_case diff --git a/.github/workflows/bandit.yaml b/.github/workflows/bandit.yaml new file mode 100644 index 0000000..b172143 --- /dev/null +++ b/.github/workflows/bandit.yaml @@ -0,0 +1,36 @@ +name: bandit + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + contents: read + pull-requests: write + +jobs: + bandit: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Run Bandit Scan + uses: lukehinds/bandit-action@new-action + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: "examples src" + recursive: "true" diff --git a/.github/workflows/bearer.yaml b/.github/workflows/bearer.yaml new file mode 100644 index 0000000..6a2bedd --- /dev/null +++ b/.github/workflows/bearer.yaml @@ -0,0 +1,20 @@ +name: bearer + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + rule_check: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Bearer + uses: bearer/bearer-action@v2 diff --git a/.github/workflows/black.yaml b/.github/workflows/black.yaml new file mode 100644 index 0000000..8c53804 --- /dev/null +++ b/.github/workflows/black.yaml @@ -0,0 +1,42 @@ +name: black + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + black: + name: black Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m venv ./venv + source ./venv/bin/activate + echo "PATH=${PATH}" >> "${GITHUB_ENV}" + python -m pip install --upgrade pip + python -m pip install --requirement requirements.txt + python -m pip install black + + - name: Run black testing + run: | + # shellcheck disable=SC2046 + black --diff --check $(git ls-files '*.py' ':!:docs/source/*') diff --git a/.github/workflows/dependency-scan.yaml b/.github/workflows/dependency-scan.yaml new file mode 100644 index 0000000..3b57099 --- /dev/null +++ b/.github/workflows/dependency-scan.yaml @@ -0,0 +1,70 @@ +name: Dependency scan + +on: + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + fpvs: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m venv ./venv + source ./venv/bin/activate + echo "PATH=${PATH}" >> "${GITHUB_ENV}" + python -m pip install --upgrade pip + python -m pip install --requirement requirements.txt + python -m pip install wheel + python -m pip wheel -r requirements.txt --wheel-dir=vendor + + - name: Run fpvs scan + run: | + python -m pip install fpvs + git clone https://gitlab.com/gitlab-org/security-products/gemnasium-db.git + fpvs-scan --verbose + + pip-audit: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m venv ./venv + source ./venv/bin/activate + echo "PATH=${PATH}" >> "${GITHUB_ENV}" + python -m pip install --requirement requirements.txt + python -m pip install . + + - name: Run pip-audit + uses: pypa/gh-action-pip-audit@v1.1.0 + with: + inputs: requirements.txt diff --git a/.github/workflows/dotnet-format.yaml b/.github/workflows/dotnet-format.yaml new file mode 100644 index 0000000..dde4ec0 --- /dev/null +++ b/.github/workflows/dotnet-format.yaml @@ -0,0 +1,52 @@ +name: dotnet format + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + dotnet-format: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - dotnet-version: "8" + + steps: + - name: checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ matrix.dotnet-version }} + + - name: install Senzing runtime + uses: senzing-factory/github-action-install-senzing-sdk@v2 + with: + packages-to-install: "senzingsdk-runtime senzingsdk-setup" + senzingsdk-repository-package: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_PACKAGE }} + senzingsdk-repository-path: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_URL }} + + - name: configure local nuget repo + run: | + sdk_package=$(grep -Rl "Senzing.Sdk" /opt/senzing/er/sdk/dotnet/ | xargs -L 1 basename) + mkdir -p ~/dev/nuget/packages + dotnet nuget add source ~/dev/nuget/packages -n dev + dotnet nuget push /opt/senzing/er/sdk/dotnet/"${sdk_package}" --source dev + + - name: dotnet format all + run: | + projects=$(find . -name "*.csproj") + echo "[INFO] projects are: $projects" + for project in $projects; do + cd "$(dirname "$project")" + dotnet restore + dotnet format --verify-no-changes --verbosity diagnostic + done diff --git a/.github/workflows/flake8.yaml b/.github/workflows/flake8.yaml new file mode 100644 index 0000000..e4c3824 --- /dev/null +++ b/.github/workflows/flake8.yaml @@ -0,0 +1,35 @@ +name: flake8 + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + flake8: + name: flake8 Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Run flake8 lint + uses: py-actions/flake8@v2 + with: + max-line-length: 88 + path: python + plugins: flake8-black diff --git a/.github/workflows/isort.yaml b/.github/workflows/isort.yaml new file mode 100644 index 0000000..c28c72f --- /dev/null +++ b/.github/workflows/isort.yaml @@ -0,0 +1,41 @@ +name: isort + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + isort: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m venv ./venv + source ./venv/bin/activate + echo "PATH=${PATH}" >> "${GITHUB_ENV}" + python -m pip install --upgrade pip + python -m pip install --requirement requirements.txt + + - name: Run isort + uses: isort/isort-action@v1 + with: + requirements-files: requirements.txt + sort-paths: "examples src/template_python tests" diff --git a/.github/workflows/java-darwin-snippets.yaml b/.github/workflows/java-darwin-snippets.yaml index c378b40..6b20400 100644 --- a/.github/workflows/java-darwin-snippets.yaml +++ b/.github/workflows/java-darwin-snippets.yaml @@ -42,7 +42,7 @@ jobs: - name: build with Maven run: | cd "${GITHUB_WORKSPACE}"/java - mvn clean install + mvn clean install -Pcheckstyle,spotbugs -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - name: run java snippets run: | diff --git a/.github/workflows/java-linux-snippets.yaml b/.github/workflows/java-linux-snippets.yaml index 594e314..ed29d20 100644 --- a/.github/workflows/java-linux-snippets.yaml +++ b/.github/workflows/java-linux-snippets.yaml @@ -42,7 +42,7 @@ jobs: SENZING_PATH: "/opt/senzing" run: | cd "${GITHUB_WORKSPACE}"/java - mvn clean package + mvn clean install -Pcheckstyle,spotbugs -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn - name: run java snippets env: diff --git a/.github/workflows/java-windows-snippets.yaml b/.github/workflows/java-windows-snippets.yaml index 829e2a2..3b89339 100644 --- a/.github/workflows/java-windows-snippets.yaml +++ b/.github/workflows/java-windows-snippets.yaml @@ -35,7 +35,7 @@ jobs: run: | $Env:SENZING_PATH = "$Env:USERPROFILE\senzing" cd "${Env:GITHUB_WORKSPACE}/java" - mvn clean install + mvn clean install "-Pcheckstyle,spotbugs" -B "-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" - name: Add to "Path" environment variable run: | diff --git a/.github/workflows/maven-dependency-review.yaml b/.github/workflows/maven-dependency-review.yaml new file mode 100644 index 0000000..4d72379 --- /dev/null +++ b/.github/workflows/maven-dependency-review.yaml @@ -0,0 +1,26 @@ +name: maven dependency review + +on: + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + dependency-submission-maven: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - java-version: "21" + java-distribution: "temurin" + + steps: + - name: checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: "Dependency Review" + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml new file mode 100644 index 0000000..897768f --- /dev/null +++ b/.github/workflows/mypy.yaml @@ -0,0 +1,42 @@ +name: mypy + +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + mypy: + name: mypy Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m venv ./venv + source ./venv/bin/activate + echo "PATH=${PATH}" >> "${GITHUB_ENV}" + python -m pip install --upgrade pip + python -m pip install --requirement requirements.txt + python -m pip install mypy + + - name: Run mypy tests + run: | + # shellcheck disable=SC2046 + mypy --strict $(git ls-files '*.py' ':!:docs/source/*') diff --git a/.github/workflows/pylint.yaml b/.github/workflows/pylint.yaml index 0a54731..276854f 100644 --- a/.github/workflows/pylint.yaml +++ b/.github/workflows/pylint.yaml @@ -1,6 +1,10 @@ name: pylint -on: [push] +on: + push: + branches-ignore: [main] + pull_request: + branches: [main] permissions: contents: read diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml new file mode 100644 index 0000000..a49a230 --- /dev/null +++ b/checkstyle-suppressions.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/csharp/runner/SnippetRunner/SnippetRunner.csproj b/csharp/runner/SnippetRunner/SnippetRunner.csproj index 576fb6b..a1595cc 100644 --- a/csharp/runner/SnippetRunner/SnippetRunner.csproj +++ b/csharp/runner/SnippetRunner/SnippetRunner.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/configuration/AddDataSources/AddDataSources.csproj b/csharp/snippets/configuration/AddDataSources/AddDataSources.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/configuration/AddDataSources/AddDataSources.csproj +++ b/csharp/snippets/configuration/AddDataSources/AddDataSources.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/configuration/InitDefaultConfig/InitDefaultConfig.csproj b/csharp/snippets/configuration/InitDefaultConfig/InitDefaultConfig.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/configuration/InitDefaultConfig/InitDefaultConfig.csproj +++ b/csharp/snippets/configuration/InitDefaultConfig/InitDefaultConfig.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/deleting/DeleteViaFutures/DeleteViaFutures.csproj b/csharp/snippets/deleting/DeleteViaFutures/DeleteViaFutures.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/deleting/DeleteViaFutures/DeleteViaFutures.csproj +++ b/csharp/snippets/deleting/DeleteViaFutures/DeleteViaFutures.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/deleting/DeleteViaLoop/DeleteViaLoop.csproj b/csharp/snippets/deleting/DeleteViaLoop/DeleteViaLoop.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/deleting/DeleteViaLoop/DeleteViaLoop.csproj +++ b/csharp/snippets/deleting/DeleteViaLoop/DeleteViaLoop.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/deleting/DeleteWithInfoViaFutures/DeleteWithInfoViaFutures.csproj b/csharp/snippets/deleting/DeleteWithInfoViaFutures/DeleteWithInfoViaFutures.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/deleting/DeleteWithInfoViaFutures/DeleteWithInfoViaFutures.csproj +++ b/csharp/snippets/deleting/DeleteWithInfoViaFutures/DeleteWithInfoViaFutures.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/information/CheckDatastorePerformance/CheckDatastorePerformance.csproj b/csharp/snippets/information/CheckDatastorePerformance/CheckDatastorePerformance.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/information/CheckDatastorePerformance/CheckDatastorePerformance.csproj +++ b/csharp/snippets/information/CheckDatastorePerformance/CheckDatastorePerformance.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/information/GetDatastoreInfo/GetDatastoreInfo.csproj b/csharp/snippets/information/GetDatastoreInfo/GetDatastoreInfo.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/information/GetDatastoreInfo/GetDatastoreInfo.csproj +++ b/csharp/snippets/information/GetDatastoreInfo/GetDatastoreInfo.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/information/GetLicense/GetLicense.csproj b/csharp/snippets/information/GetLicense/GetLicense.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/information/GetLicense/GetLicense.csproj +++ b/csharp/snippets/information/GetLicense/GetLicense.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/information/GetVersion/GetVersion.csproj b/csharp/snippets/information/GetVersion/GetVersion.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/information/GetVersion/GetVersion.csproj +++ b/csharp/snippets/information/GetVersion/GetVersion.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/initialization/EnginePriming/EnginePriming.csproj b/csharp/snippets/initialization/EnginePriming/EnginePriming.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/initialization/EnginePriming/EnginePriming.csproj +++ b/csharp/snippets/initialization/EnginePriming/EnginePriming.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/initialization/EnvironmentAndHubs/EnvironmentAndHubs.csproj b/csharp/snippets/initialization/EnvironmentAndHubs/EnvironmentAndHubs.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/initialization/EnvironmentAndHubs/EnvironmentAndHubs.csproj +++ b/csharp/snippets/initialization/EnvironmentAndHubs/EnvironmentAndHubs.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/initialization/PurgeRepository/PurgeRepository.csproj b/csharp/snippets/initialization/PurgeRepository/PurgeRepository.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/initialization/PurgeRepository/PurgeRepository.csproj +++ b/csharp/snippets/initialization/PurgeRepository/PurgeRepository.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/loading/LoadRecords/LoadRecords.csproj b/csharp/snippets/loading/LoadRecords/LoadRecords.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/loading/LoadRecords/LoadRecords.csproj +++ b/csharp/snippets/loading/LoadRecords/LoadRecords.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/loading/LoadTruthSetWithInfoViaLoop/LoadTruthSetWithInfoViaLoop.csproj b/csharp/snippets/loading/LoadTruthSetWithInfoViaLoop/LoadTruthSetWithInfoViaLoop.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/loading/LoadTruthSetWithInfoViaLoop/LoadTruthSetWithInfoViaLoop.csproj +++ b/csharp/snippets/loading/LoadTruthSetWithInfoViaLoop/LoadTruthSetWithInfoViaLoop.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/loading/LoadViaFutures/LoadViaFutures.csproj b/csharp/snippets/loading/LoadViaFutures/LoadViaFutures.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/loading/LoadViaFutures/LoadViaFutures.csproj +++ b/csharp/snippets/loading/LoadViaFutures/LoadViaFutures.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/loading/LoadViaLoop/LoadViaLoop.csproj b/csharp/snippets/loading/LoadViaLoop/LoadViaLoop.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/loading/LoadViaLoop/LoadViaLoop.csproj +++ b/csharp/snippets/loading/LoadViaLoop/LoadViaLoop.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/loading/LoadViaQueue/LoadViaQueue.csproj b/csharp/snippets/loading/LoadViaQueue/LoadViaQueue.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/loading/LoadViaQueue/LoadViaQueue.csproj +++ b/csharp/snippets/loading/LoadViaQueue/LoadViaQueue.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/loading/LoadWithInfoViaFutures/LoadWithInfoViaFutures.csproj b/csharp/snippets/loading/LoadWithInfoViaFutures/LoadWithInfoViaFutures.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/loading/LoadWithInfoViaFutures/LoadWithInfoViaFutures.csproj +++ b/csharp/snippets/loading/LoadWithInfoViaFutures/LoadWithInfoViaFutures.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/loading/LoadWithStatsViaLoop/LoadWithStatsViaLoop.csproj b/csharp/snippets/loading/LoadWithStatsViaLoop/LoadWithStatsViaLoop.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/loading/LoadWithStatsViaLoop/LoadWithStatsViaLoop.csproj +++ b/csharp/snippets/loading/LoadWithStatsViaLoop/LoadWithStatsViaLoop.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/redo/LoadWithRedoViaLoop/LoadWithRedoViaLoop.csproj b/csharp/snippets/redo/LoadWithRedoViaLoop/LoadWithRedoViaLoop.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/redo/LoadWithRedoViaLoop/LoadWithRedoViaLoop.csproj +++ b/csharp/snippets/redo/LoadWithRedoViaLoop/LoadWithRedoViaLoop.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/redo/RedoContinuous/RedoContinuous.csproj b/csharp/snippets/redo/RedoContinuous/RedoContinuous.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/redo/RedoContinuous/RedoContinuous.csproj +++ b/csharp/snippets/redo/RedoContinuous/RedoContinuous.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/redo/RedoContinuousViaFutures/RedoContinuousViaFutures.csproj b/csharp/snippets/redo/RedoContinuousViaFutures/RedoContinuousViaFutures.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/redo/RedoContinuousViaFutures/RedoContinuousViaFutures.csproj +++ b/csharp/snippets/redo/RedoContinuousViaFutures/RedoContinuousViaFutures.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/redo/RedoWithInfoContinuous/RedoWithInfoContinuous.csproj b/csharp/snippets/redo/RedoWithInfoContinuous/RedoWithInfoContinuous.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/redo/RedoWithInfoContinuous/RedoWithInfoContinuous.csproj +++ b/csharp/snippets/redo/RedoWithInfoContinuous/RedoWithInfoContinuous.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/searching/SearchRecords/SearchRecords.csproj b/csharp/snippets/searching/SearchRecords/SearchRecords.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/searching/SearchRecords/SearchRecords.csproj +++ b/csharp/snippets/searching/SearchRecords/SearchRecords.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/searching/SearchViaFutures/SearchViaFutures.csproj b/csharp/snippets/searching/SearchViaFutures/SearchViaFutures.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/searching/SearchViaFutures/SearchViaFutures.csproj +++ b/csharp/snippets/searching/SearchViaFutures/SearchViaFutures.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/stewardship/ForceResolve/ForceResolve.csproj b/csharp/snippets/stewardship/ForceResolve/ForceResolve.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/stewardship/ForceResolve/ForceResolve.csproj +++ b/csharp/snippets/stewardship/ForceResolve/ForceResolve.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/csharp/snippets/stewardship/ForceUnresolve/ForceUnresolve.csproj b/csharp/snippets/stewardship/ForceUnresolve/ForceUnresolve.csproj index 25104ae..eb45fe4 100644 --- a/csharp/snippets/stewardship/ForceUnresolve/ForceUnresolve.csproj +++ b/csharp/snippets/stewardship/ForceUnresolve/ForceUnresolve.csproj @@ -5,6 +5,10 @@ net8.0 enable enable + All + All + false + false diff --git a/java/checkstyle-suppressions.xml b/java/checkstyle-suppressions.xml new file mode 100644 index 0000000..a49a230 --- /dev/null +++ b/java/checkstyle-suppressions.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/java/pom.xml b/java/pom.xml index cbe517c..7241ef4 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -128,4 +128,65 @@ + + + + checkstyle + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.6.0 + + UTF-8 + true + true + false + checkstyle-suppressions.xml + + + + validate + validate + + check + + + + + + + + + spotbugs + + + + com.github.spotbugs + spotbugs-maven-plugin + 4.8.6.6 + + + + com.h3xstream.findsecbugs + findsecbugs-plugin + 1.13.0 + + + + + + validate + validate + + check + + + + + + + +