diff --git a/.github/workflows/qlty.yml b/.github/workflows/qlty.yml new file mode 100644 index 0000000..4ff1004 --- /dev/null +++ b/.github/workflows/qlty.yml @@ -0,0 +1,24 @@ +name: Code Quality Check + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + qlty: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Install qlty + run: | + # Install qlty using official install script + curl https://qlty.sh | sh + echo "$HOME/.qlty/bin" >> $GITHUB_PATH + + - name: Run qlty check + run: qlty check diff --git a/.qlty/.gitignore b/.qlty/.gitignore new file mode 100644 index 0000000..3036618 --- /dev/null +++ b/.qlty/.gitignore @@ -0,0 +1,7 @@ +* +!configs +!configs/** +!hooks +!hooks/** +!qlty.toml +!.gitignore diff --git a/.qlty/configs/.hadolint.yaml b/.qlty/configs/.hadolint.yaml new file mode 100644 index 0000000..8f7e23e --- /dev/null +++ b/.qlty/configs/.hadolint.yaml @@ -0,0 +1,2 @@ +ignored: + - DL3008 diff --git a/.qlty/configs/.shellcheckrc b/.qlty/configs/.shellcheckrc new file mode 100644 index 0000000..6a38d92 --- /dev/null +++ b/.qlty/configs/.shellcheckrc @@ -0,0 +1 @@ +source-path=SCRIPTDIR \ No newline at end of file diff --git a/.qlty/configs/.yamllint.yaml b/.qlty/configs/.yamllint.yaml new file mode 100644 index 0000000..7440066 --- /dev/null +++ b/.qlty/configs/.yamllint.yaml @@ -0,0 +1,21 @@ +extends: default + +rules: + document-start: disable + quoted-strings: + required: only-when-needed + extra-allowed: ["{|}"] + key-duplicates: {} + octal-values: + forbid-implicit-octal: true + line-length: disable + indentation: disable + new-line-at-end-of-file: disable + trailing-spaces: disable + brackets: disable + colons: disable + empty-lines: disable + comments: disable + braces: disable + comments-indentation: disable + commas: disable diff --git a/.qlty/configs/dialyzer.config b/.qlty/configs/dialyzer.config new file mode 100644 index 0000000..cc177e1 --- /dev/null +++ b/.qlty/configs/dialyzer.config @@ -0,0 +1,16 @@ +%% Dialyzer configuration for epp_proxy project +[ + {dialyzer, + [ + {warnings, [unknown, unmatched_returns, error_handling, race_conditions, underspecs]}, + {plt_apps, [erts, kernel, stdlib, ssl, public_key, crypto, asn1, xmerl, inets, mnesia, os_mon, runtime_tools, sasl, tools, webtool, debugger, observer, et, wx]}, + {plt_location, local}, + {base_plt_apps, [erts, kernel, stdlib]}, + {files_rec, ["apps/epp_proxy/src"]}, + {from, byte_code}, + {defines, [{debug, true}]}, + {include_dirs, ["apps/epp_proxy/include"]}, + {output_format, formatted}, + {verbosity, 1} + ]} +]. diff --git a/.qlty/configs/elvis.config b/.qlty/configs/elvis.config new file mode 100644 index 0000000..d9781d4 --- /dev/null +++ b/.qlty/configs/elvis.config @@ -0,0 +1,57 @@ +%% Elvis configuration for epp_proxy project +[ + {elvis, + [ + {config, + [ + {dirs, ["apps/epp_proxy/src", "apps/epp_proxy/test"]}, + {filter, "*.erl"}, + {ruleset, erl_files} + ]}, + {output_format, colored} + ]}, + {erl_files, + [ + {elvis_style, line_length, #{limit => 100}}, + {elvis_style, no_tabs}, + {elvis_style, no_trailing_whitespace}, + {elvis_style, macro_names, #{regex => "^[A-Z][A-Z_]*$"}}, + {elvis_style, macro_module_names, #{regex => "^[A-Z][a-zA-Z0-9]*$"}}, + {elvis_style, function_naming_convention, #{regex => "^[a-z][a-zA-Z0-9_]*$"}}, + {elvis_style, variable_naming_convention, #{regex => "^[A-Z][a-zA-Z0-9_]*$"}}, + {elvis_style, no_catch_expressions}, + {elvis_style, no_if_expression}, + {elvis_style, no_throw}, + {elvis_style, no_author}, + {elvis_style, no_spec_with_records}, + {elvis_style, dont_repeat_yourself, #{min_complexity => 10}}, + {elvis_style, no_debug_call}, + {elvis_style, no_common_caveats_call}, + {elvis_style, no_nested_try_catch}, + {elvis_style, no_seqbind}, + {elvis_style, no_useless_seqbind}, + {elvis_style, used_ignored_variable}, + {elvis_style, no_behavior_info}, + {elvis_style, module_naming_convention, #{regex => "^[a-z][a-zA-Z0-9_]*$"}}, + {elvis_style, state_record_and_type}, + {elvis_style, no_spec_with_records}, + {elvis_style, callback_spec}, + {elvis_style, no_catch_expressions}, + {elvis_style, no_if_expression}, + {elvis_style, no_throw}, + {elvis_style, no_author}, + {elvis_style, no_spec_with_records}, + {elvis_style, dont_repeat_yourself, #{min_complexity => 10}}, + {elvis_style, no_debug_call}, + {elvis_style, no_common_caveats_call}, + {elvis_style, no_nested_try_catch}, + {elvis_style, no_seqbind}, + {elvis_style, no_useless_seqbind}, + {elvis_style, used_ignored_variable}, + {elvis_style, no_behavior_info}, + {elvis_style, module_naming_convention, #{regex => "^[a-z][a-zA-Z0-9_]*$"}}, + {elvis_style, state_record_and_type}, + {elvis_style, no_spec_with_records}, + {elvis_style, callback_spec} + ]} +]. diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml new file mode 100644 index 0000000..8285f8f --- /dev/null +++ b/.qlty/qlty.toml @@ -0,0 +1,145 @@ +# This file was automatically generated by `qlty init`. +# You can modify it to suit your needs. +# We recommend you to commit this file to your repository. +# +# This configuration is used by both Qlty CLI and Qlty Cloud. +# +# Qlty CLI -- Code quality toolkit for developers +# Qlty Cloud -- Fully automated Code Health Platform +# +# Try Qlty Cloud: https://qlty.sh +# +# For a guide to configuration, visit https://qlty.sh/d/config +# Or for a full reference, visit https://qlty.sh/d/qlty-toml +config_version = "0" + +exclude_patterns = [ + # Build and dependency directories + "**/build/**", + "**/deps/**", + "**/dist/**", + "**/target/**", + "**/vendor/**", + "**/_build/**", + "**/node_modules/**", + + # Erlang-specific excludes + "**/*.beam", + "**/*.plt", + "**/*.ez", + "**/ebin/**", + "**/log/**", + "**/rebar3.crashdump", + + # Generated and temporary files + "**/generated/**", + "**/cache/**", + "**/testdata/**", + + # Configuration files (keep for analysis) + # "**/config/**", # Commented out - config files are important + + # Documentation and assets (keep for analysis) + # "**/assets/**", # Commented out - may contain important files + + # Unused patterns for this project + "*_min.*", + "*-min.*", + "*.min.*", + "**/.yarn/**", + "**/*.d.ts", + "**/bower_components/**", + "**/extern/**", + "**/external/**", + "**/Godeps/**", + "**/gradlew/**", + "**/mvnw/**", + "**/protos/**", + "**/seed/**", + "**/templates/**", +] + +test_patterns = [ + "**/test/**", + "**/spec/**", + "**/*.test.*", + "**/*.spec.*", + "**/*_test.*", + "**/*_spec.*", + "**/test_*.*", + "**/spec_*.*", + # Erlang-specific test patterns + "**/*_SUITE.erl", + "**/*_test.erl", + "**/test_*.erl", +] + +[smells] +mode = "comment" + +[smells.boolean_logic] +threshold = 4 + +[smells.file_complexity] +threshold = 55 + +[smells.return_statements] +threshold = 4 + +[smells.nested_control_flow] +threshold = 4 + +[smells.function_parameters] +threshold = 5 + +[smells.function_complexity] +threshold = 8 + +[smells.duplication] +enabled = true +threshold = 20 + +[[source]] +name = "default" +default = true + + +# Docker and containerization +[[plugin]] +name = "dockerfmt" + +[[plugin]] +name = "hadolint" + +# Documentation +[[plugin]] +name = "markdownlint" +mode = "comment" + +# Security scanning +[[plugin]] +name = "osv-scanner" + +[[plugin]] +name = "trivy" +drivers = [ + "config", + "fs-vuln", +] + +[[plugin]] +name = "trufflehog" + +# Shell scripts +[[plugin]] +name = "shellcheck" + +[[plugin]] +name = "shfmt" + +# YAML files (GitHub Actions) +[[plugin]] +name = "yamllint" + +# Erlang-specific plugins +# Note: qlty doesn't support erlc plugin yet