From a28f4d9d07188c1b1ad84a1b7ec22a900aa52d72 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Thu, 30 Mar 2023 13:43:21 +0300 Subject: [PATCH] initial commit Signed-off-by: Evgenii Stratonikov --- .gitattributes | 2 ++ .gitignore | 51 +++++++++++++++++++++++++++++++ .gitlint | 11 +++++++ .golangci.yml | 66 +++++++++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 45 ++++++++++++++++++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .gitlint create mode 100644 .golangci.yml create mode 100644 .pre-commit-config.yaml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c7a3f7a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/**/*.pb.go -diff -merge +/**/*.pb.go linguist-generated=true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..42b7679 --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +# IDE +.idea +.vscode + +# Vendoring +vendor + +# tempfiles +.DS_Store +*~ +.cache + +temp +tmp + +# binary +bin/ +release/ + +# coverage +coverage.txt +coverage.html + +# testing +cmd/test +/plugins/ +testfile + +# misc +.neofs-cli.yml + +# debhelpers +debian/*debhelper* + +# logfiles +debian/*.log + +# .substvars +debian/*.substvars + +# .bash-completion +debian/*.bash-completion + +# Install folders and files +debian/frostfs-cli/ +debian/frostfs-ir/ +debian/files +debian/frostfs-storage/ +debian/changelog +man/ +debs/ diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..e7218ac --- /dev/null +++ b/.gitlint @@ -0,0 +1,11 @@ +[general] +fail-without-commits=True +regex-style-search=True +contrib=CC1 + +[title-match-regex] +regex=^\[\#[0-9Xx]+\]\s + +[ignore-by-title] +regex=^Release(.*) +ignore=title-match-regex diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..fae355a --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,66 @@ +# This file contains all available configuration options +# with their default values. + +# options for analysis running +run: + # timeout for analysis, e.g. 30s, 5m, default is 1m + timeout: 10m + + # include test files or not, default is true + tests: false + +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" + format: tab + +# all available settings of specific linters +linters-settings: + exhaustive: + # indicates that switch statements are to be considered exhaustive if a + # 'default' case is present, even if all enum members aren't listed in the + # switch + default-signifies-exhaustive: true + govet: + # report about shadowed variables + check-shadowing: false + staticcheck: + checks: ["all", "-SA1019"] # TODO Enable SA1019 after deprecated warning are fixed. + funlen: + lines: 80 # default 60 + statements: 60 # default 40 + gocognit: + min-complexity: 40 # default 30 + +linters: + enable: + # mandatory linters + - govet + - revive + + # some default golangci-lint linters + - errcheck + - gosimple + - godot + - ineffassign + - staticcheck + - typecheck + - unused + + # extra linters + - bidichk + - durationcheck + - exhaustive + - exportloopref + - gofmt + - goimports + - misspell + - predeclared + - reassign + - whitespace + - containedctx + - funlen + - gocognit + - contextcheck + disable-all: true + fast: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..169b7bf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +ci: + autofix_prs: false + +repos: + - repo: https://github.com/jorisroovers/gitlint + rev: v0.19.1 + hooks: + - id: gitlint + stages: [commit-msg] + - id: gitlint-ci + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + - id: check-merge-conflict + - id: check-json + - id: check-xml + - id: check-yaml + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + - id: end-of-file-fixer + exclude: ".key$" + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.9.0.2 + hooks: + - id: shellcheck + + - repo: https://github.com/golangci/golangci-lint + rev: v1.51.2 + hooks: + - id: golangci-lint + + - repo: local + hooks: + - id: go-unit-tests + name: go unit tests + entry: make test + pass_filenames: false + types: [go] + language: system