From 20c7446e06f0d77f6055070f6a379fb5a58553f4 Mon Sep 17 00:00:00 2001 From: Artem Derevnjuk Date: Fri, 4 Nov 2022 01:54:47 +0400 Subject: [PATCH] chore: initial project structure --- .codeclimate.yml | 25 + .config/dotnet-tools.json | 12 + .editorconfig | 107 + .github/workflows/auto-build.yml | 55 + .github/workflows/composite/net/action.yml | 27 + .github/workflows/composite/npm/action.yml | 25 + .github/workflows/coverage.yml | 43 + .github/workflows/deploy.yml | 51 + .github/workflows/release.yml | 22 + .gitignore | 456 ++ .husky/commit-msg | 22 + .husky/post-commit | 22 + .husky/pre-commit | 22 + .husky/task-runner.json | 36 + .releaserc | 53 + CONTRIBUTING.md | 237 + Directory.Build.props | 10 + LICENSE | 21 + README.md | 116 + SecTester.sln | 15 + global.json | 7 + nuget.config | 8 + package-lock.json | 5017 ++++++++++++++++++++ package.json | 37 + src/Directory.Build.props | 37 + test/Directory.Build.props | 30 + 26 files changed, 6513 insertions(+) create mode 100644 .codeclimate.yml create mode 100644 .config/dotnet-tools.json create mode 100644 .editorconfig create mode 100644 .github/workflows/auto-build.yml create mode 100644 .github/workflows/composite/net/action.yml create mode 100644 .github/workflows/composite/npm/action.yml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/release.yml create mode 100644 .gitignore create mode 100755 .husky/commit-msg create mode 100755 .husky/post-commit create mode 100755 .husky/pre-commit create mode 100644 .husky/task-runner.json create mode 100644 .releaserc create mode 100644 CONTRIBUTING.md create mode 100644 Directory.Build.props create mode 100644 LICENSE create mode 100644 README.md create mode 100644 SecTester.sln create mode 100644 global.json create mode 100644 nuget.config create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/Directory.Build.props create mode 100644 test/Directory.Build.props diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..7a5001d --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,25 @@ +version: '2' +checks: + argument-count: + config: + threshold: 4 + complex-logic: + config: + threshold: 10 + file-lines: + config: + threshold: 500 + method-complexity: + config: + threshold: 5 + method-count: + enabled: false + method-lines: + config: + threshold: 25 + nested-control-flow: + config: + threshold: 3 + return-statements: + config: + threshold: 4 diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..f303543 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "husky": { + "version": "0.5.2", + "commands": [ + "husky" + ] + } + } +} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..be5b152 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,107 @@ +# Editor configuration, see http://editorconfig.org +root = true + +# All files +[*] +indent_style = space +insert_final_newline = true +indent_size = 2 + +[*.cs] +# Organize usings +dotnet_sort_system_directives_first = true +# this. preferences +dotnet_style_qualification_for_field = false:silent +dotnet_style_qualification_for_property = false:silent +dotnet_style_qualification_for_method = false:silent +dotnet_style_qualification_for_event = 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_relational_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 +# Modifier preferences +dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent +dotnet_style_readonly_field = true:suggestion +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent + +# Style Definitions +dotnet_naming_style.pascal_case_style.capitalization = pascal_case +# Use PascalCase for constant fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.applicable_accessibilities = * +dotnet_naming_symbols.constant_fields.required_modifiers = const + +# var preferences +csharp_style_var_for_built_in_types = true:silent +csharp_style_var_when_type_is_apparent = true:silent +csharp_style_var_elsewhere = true:silent +# Expression-bodied members +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +# Pattern matching preferences +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +# Null-checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion +# Modifier preferences +csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion +# Expression-level preferences +csharp_prefer_braces = true:silent +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_prefer_simple_default_expression = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true +# Indentation preferences +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left +# Space preferences +csharp_space_after_cast = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_around_binary_operators = before_and_after +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +# Wrapping preferences +csharp_preserve_single_line_statements = true +csharp_preserve_single_line_blocks = true + +[*.md] +max_line_length = off +trim_trailing_whitespace = false diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml new file mode 100644 index 0000000..4dfba9d --- /dev/null +++ b/.github/workflows/auto-build.yml @@ -0,0 +1,55 @@ +name: CI / Automated testing + +on: + workflow_dispatch: + + pull_request: + branches: + - '**' + +jobs: + install-deps: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install .NET deps + uses: ./.github/workflows/composite/net + + build-and-test: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }} + needs: install-deps + + strategy: + fail-fast: false + matrix: + # Using macos-12 because we need Xcode 13.3 or later (macos-latest currently points at macos-11 which uses Xcode 13.2) + # Using windows-2019 because windows-latest is much slower and we don't need anything in particular from it. + os: [ ubuntu-latest, windows-2019, macos-12 ] + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install .NET deps + uses: ./.github/workflows/composite/net + + - name: Restore .NET Dependencies + run: dotnet restore --nologo + + - name: Build + run: dotnet build -c Release --no-restore --nologo /p:CopyLocalLockFileAssemblies=true + + - name: dotnet format + run: dotnet format --no-restore + + - name: dotnet test + run: dotnet test -c Release --no-build --nologo + + diff --git a/.github/workflows/composite/net/action.yml b/.github/workflows/composite/net/action.yml new file mode 100644 index 0000000..2f71582 --- /dev/null +++ b/.github/workflows/composite/net/action.yml @@ -0,0 +1,27 @@ +name: '.NET' +description: 'Installs .NET deps' + +runs: + using: 'composite' + steps: + - name: Set Global Environment Variables + shell: bash + run: | + echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV + echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV + + # Note, the following is needed on the windows-2019 image only. + # All other versions of .NET we need are pre-installed on the GitHub Actions virtual images. + - name: Install .NET 6 SDK + uses: actions/setup-dotnet@v3 + if: runner.os == 'Windows' + with: + dotnet-version: 6.x.x + + - name: Dependency Caching + uses: actions/cache@v3 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget- diff --git a/.github/workflows/composite/npm/action.yml b/.github/workflows/composite/npm/action.yml new file mode 100644 index 0000000..0a5700a --- /dev/null +++ b/.github/workflows/composite/npm/action.yml @@ -0,0 +1,25 @@ +name: 'NPM' +description: 'Installs NPM deps' + +inputs: + registry: + description: 'NPM registry' + default: 'https://registry.npmjs.org' + required: false + +runs: + using: 'composite' + steps: + - name: Set Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'npm' + registry-url: ${{ inputs.registry }} + + + - name: Install deps in quiet mode + shell: bash + run: npm ci -q + env: + NODE_AUTH_TOKEN: ${{ env.NODE_AUTH_TOKEN }} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..f06087c --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,43 @@ +name: CI / Coverage + +on: + workflow_dispatch: + + pull_request: + branches: + - '**' + push: + branches: + - master + +env: + NX_CACHE: nx-cache + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install deps + uses: ./.github/workflows/composite/net + + - name: Restore .NET Dependencies + run: dotnet restore --nologo + + - name: Build + run: dotnet build -c Release --no-restore --nologo /p:CopyLocalLockFileAssemblies=true + + - name: dotnet test + run: dotnet test -c Release --no-build --nologo + + - name: Send reports to Codeclimate + uses: paambaati/codeclimate-action@v3.0.0 + if: ${{ hashFiles('test/**/coverage/coverage.info') }} + env: + CC_TEST_REPORTER_ID: 1a61ea2fb28c8abe9961c5f2678c063d656d29ac41cc2b4614d7c2eafa576c21 + with: + coverageLocations: test/**/coverage/coverage.info:lcov diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f700e89 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +name: Automated deploy + +on: + release: + types: [created] + +env: + TARGET_REF: ${{ github.event.release.target_commitish }} + TAG: ${{ github.event.release.target_commitish == 'master' && 'latest' || 'next' }} + +jobs: + install-deps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ env.TARGET_REF }} + token: ${{ secrets.GPR_TOKEN }} + + - name: Install deps + uses: ./.github/workflows/composite/net + + publish: + runs-on: ubuntu-latest + needs: install-deps + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ env.TARGET_REF }} + token: ${{ secrets.GPR_TOKEN }} + + - name: Install deps + uses: ./.github/workflows/composite/net + + - name: Restore .NET Dependencies + run: dotnet restore --nologo + + - name: Build + run: dotnet build -c Release --no-restore --nologo /p:CopyLocalLockFileAssemblies=true + + - name: Create Nuget Packages + run: dotnet pack -c Release --no-build --nologo + + - uses: actions/upload-artifact@v2 + with: + name: build + path: | + src/**/Release/*.nupkg + + - name: Publish package to NuGet + run: dotnet nuget push src/**/bin/Release/*.nupkg -s nuget.org -k ${{ secrets.NUGET_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f9d5d03 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: Semantic release + +on: + push: + branches: + - master + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.GPR_TOKEN }} + + - name: Install deps + uses: ./.github/workflows/composite/npm + + - name: Release a new version + run: npm run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96436e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,456 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates +.DS_Store + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info +**/coverage + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..9c9eb6a --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1,22 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +## husky task runner examples ------------------- +## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky' + +## run all tasks +#husky run + +### run all tasks with group: 'group-name' +#husky run --group group-name + +## run task with name: 'task-name' +#husky run --name task-name + +## pass hook arguments to task +#husky run --args "$1" "$2" + +## or put your custom commands ------------------- +#echo 'Husky.Net is awesome!' + +dotnet husky run --group commit-msg --args "$1" diff --git a/.husky/post-commit b/.husky/post-commit new file mode 100755 index 0000000..2f8d253 --- /dev/null +++ b/.husky/post-commit @@ -0,0 +1,22 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +## husky task runner examples ------------------- +## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky' + +## run all tasks +#husky run + +### run all tasks with group: 'group-name' +#husky run --group group-name + +## run task with name: 'task-name' +#husky run --name task-name + +## pass hook arguments to task +#husky run --args "$1" "$2" + +## or put your custom commands ------------------- +#echo 'Husky.Net is awesome!' + +dotnet husky run --group post-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..65130a6 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,22 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +## husky task runner examples ------------------- +## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky' + +## run all tasks +#husky run + +### run all tasks with group: 'group-name' +#husky run --group group-name + +## run task with name: 'task-name' +#husky run --name task-name + +## pass hook arguments to task +#husky run --args "$1" "$2" + +## or put your custom commands ------------------- +#echo 'Husky.Net is awesome!' + +dotnet husky run --group pre-commit diff --git a/.husky/task-runner.json b/.husky/task-runner.json new file mode 100644 index 0000000..47ed9a8 --- /dev/null +++ b/.husky/task-runner.json @@ -0,0 +1,36 @@ +{ + "tasks": [ + { + "name": "formatting", + "group": "pre-commit", + "command": "dotnet", + "args": [ + "format", + "--include", + "${staged}", + "--no-restore" + ] + }, + { + "name": "commitlint", + "command": "npx", + "group": "commit-msg", + "args": [ + "--no", + "--", + "commitlint", + "--edit", + "${args}" + ] + }, + { + "name": "refresh-index", + "command": "git", + "group": "post-commit", + "args": [ + "update-index", + "--again" + ] + } + ] +} diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..a1b1c14 --- /dev/null +++ b/.releaserc @@ -0,0 +1,53 @@ +{ + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "parserOpts": { + "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"] + } + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "angular", + "parserOpts": { + "noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"] + }, + "writerOpts": { + "commitsSort": ["subject", "scope"] + } + } + ], + [ + "@semantic-release/exec", + { + "prepareCmd": "sed -i '' -e \"1,// s!.*!${nextRelease.version}!\" Directory.Build.props" + } + ], + [ + "@semantic-release/git", + { + "assets": ["src/**.csproj"], + "message": "chore(release): cut the ${nextRelease.version} release [skip ci]" + } + ], + [ + "@semantic-release/github", + { + "labels": false, + "releasedLabels": false, + "failTitle": false, + "failComment": false, + "successComment": false + } + ] + ], + "branches": [ + { + "name": "master" + } + ], + "ci": true +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..342ce75 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,237 @@ +# How to contribute to SecTester SDKs + +## Table of contents + +- [Your First Contribution](#your-first-contribution) +- [Forks and Branches](#forks-and-branches) + - [Start a feature branch](#start-a-feature-branch) + - [Commit Message Format](#commit-message-format) +- [How to work on SecTester](#how-to-work-on-sectester) +- [Installation](#installation) + - [Build](#build) + - [Tests](#tests) + - [Linting](#linting) + - [Formatting](#formatting) + - [Creating publishable package](#creating-publishable-package) + +## Your First Contribution + +Working on your first Pull Request? You can learn how from this free series, [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). + +## Forks and Branches + +All contributions must be submitted as a [Pull Request (PR)](https://help.github.com/articles/about-pull-requests/) so you need to [fork this repo](https://help.github.com/articles/fork-a-repo/) on your GitHub account. + +The main branch aka mainline is `master`, it contains the latest code, and it is undergoing major development. Any other branch is temporary and could be deleted. You can read more about the [Trank-based development](https://trunkbaseddevelopment.com/) to get a deep understanding of how it works. + +> ⚡ All PRs must be against the `master` branch to be considered. + +A valid PR must follow these points: + +- Unit test is correctly implemented and covers the new scenario. +- If the code introduces a new feature, please add documentation or describe the feature in the PR description. +- The commit message follows [the conventional commit](#commit-message-format). +- The reviewer is assigned from the developers of the same project or code owners, possibly related to the task designed or a component affected. +- If you are going to work on new features or fix bugs or make significant architecture changes, create an issue before sending a PR, use [close keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) to link an issue, and PR. + +The PR, which is **NOT** planned to be merged, has to be converted to draft PR. + +To release a new version, you should issue the following commands: + +```bash +git fetch origin +git checkout master +git merge --squash branch-name +git commit -m 'message' +``` + +Use `--squash`, to leave the history of commits in feature-branch and prevents the Git merge command from creating a merge commit. + +### Start a feature branch + +To create a feature branch you should issue the following commands: + +```bash +git fetch +git checkout --no-track -b branch-name origin/master +``` + +Each branch name consists of a **type**, **ref,** and **subject**. + +``` +[#]/ +``` + +Where `type` - can accept one of the values are described [below](#commit-message-format), `ref` \- reference GitHub issues, Jira tickets, or other PRs. + +e.g. `fix-#184/multiple-hosts-are-duplicated` or `fix/multiple-hosts-are-duplicated` + +The `type` and `subject` are mandatory, the `ref` is optional. + +### Commit Message Format + +The commits must follow the [https://www.conventionalcommits.org/en/v1.0.0/](https://www.conventionalcommits.org/en/v1.0.0/) naming convention. Please make sure to read the full guideline. + +Each commit message consists of a **header**, a **body**, and a **footer**. + +``` +
+ + + +