diff --git a/av-best-shop/makefile b/Makefile similarity index 100% rename from av-best-shop/makefile rename to Makefile diff --git a/av-best-shop/go.mod b/av-best-shop/go.mod deleted file mode 100644 index 47a2a86..0000000 --- a/av-best-shop/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/av-best-shop - -go 1.21.4 diff --git a/av-best-shop/golangci.yml b/av-best-shop/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/av-best-shop/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/av-find-broken/go.mod b/av-find-broken/go.mod deleted file mode 100644 index ac396df..0000000 --- a/av-find-broken/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/av-find-broken - -go 1.21.4 diff --git a/av-find-broken/golangci.yml b/av-find-broken/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/av-find-broken/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/av-find-broken/makefile b/av-find-broken/makefile deleted file mode 100644 index 379a03c..0000000 --- a/av-find-broken/makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/ya-details -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/cw-compare-margin/go.mod b/cw-compare-margin/go.mod deleted file mode 100644 index 9352fad..0000000 --- a/cw-compare-margin/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/skosovsky/algo/cw-compare-margin diff --git a/cw-enumerable-magic-20/go.mod b/cw-enumerable-magic-20/go.mod deleted file mode 100644 index 121dc5f..0000000 --- a/cw-enumerable-magic-20/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/cw-enumerable-magic-20 -go 1.21.5 diff --git a/cw-grasshopper-summation/go.mod b/cw-grasshopper-summation/go.mod deleted file mode 100644 index 8c8c13b..0000000 --- a/cw-grasshopper-summation/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/cw-grasshopper-summation -go 1.21.5 diff --git a/cw-indexed-capitaliztion/go.mod b/cw-indexed-capitaliztion/go.mod deleted file mode 100644 index 4677132..0000000 --- a/cw-indexed-capitaliztion/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/cw-indexed-capitaliztion - -go 1.21.5 diff --git a/cw-merge-arrays/go.mod b/cw-merge-arrays/go.mod deleted file mode 100644 index 503a520..0000000 --- a/cw-merge-arrays/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/cw-merge-arrays -go 1.21.5 diff --git a/cw-returning-strings/go.mod b/cw-returning-strings/go.mod deleted file mode 100644 index 4b4b146..0000000 --- a/cw-returning-strings/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/cw-returning-strings -go 1.21.5 diff --git a/cw-well-ideas-easy/go.mod b/cw-well-ideas-easy/go.mod deleted file mode 100644 index 88c45b4..0000000 --- a/cw-well-ideas-easy/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/cw-well-ideas-easy -go 1.21.5 diff --git a/go.mod b/go.mod index 9f5bda1..271dc05 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/skosovsky/algo +module github.com/skosovsky/go-algo.git -go 1.21.4 +go 1.21.6 diff --git a/golangci.yml b/golangci.yml index 6ff473a..77e7c87 100644 --- a/golangci.yml +++ b/golangci.yml @@ -1,160 +1,337 @@ +# This code is licensed under the terms of the MIT license https://opensource.org/license/mit +# Copyright (c) 2021 Marat Reymers + +## Golden config for golangci-lint v1.55.2 +# +# This is the best config for golangci-lint based on my experience and opinion. +# It is very strict, but not extremely strict. +# Feel free to adapt and change it for your needs. + +run: + # Timeout for analysis, e.g. 30s, 5m. + # Default: 1m + timeout: 3m + + +# This file contains only configs which differ from defaults. +# All possible options can be found here https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 + cyclop: + # The maximal code complexity to report. + # Default: 10 + max-complexity: 30 + # The maximal average package complexity. + # If it's higher than 0.0 (float) the check is enabled + # Default: 0.0 + package-average: 10.0 + + errcheck: + # Report about not checking of errors in type assertions: `a := b.(MyStruct)`. + # Such cases aren't reported by default. + # Default: false + check-type-assertions: true + + exhaustive: + # Program elements to check for exhaustiveness. + # Default: [ switch ] + check: + - switch + - map + + exhaustruct: + # List of regular expressions to exclude struct packages and names from check. + # Default: [] + exclude: + # std libs + - "^net/http.Client$" + - "^net/http.Cookie$" + - "^net/http.Request$" + - "^net/http.Response$" + - "^net/http.Server$" + - "^net/http.Transport$" + - "^net/url.URL$" + - "^os/exec.Cmd$" + - "^reflect.StructField$" + # public libs + - "^github.com/Shopify/sarama.Config$" + - "^github.com/Shopify/sarama.ProducerMessage$" + - "^github.com/mitchellh/mapstructure.DecoderConfig$" + - "^github.com/prometheus/client_golang/.+Opts$" + - "^github.com/spf13/cobra.Command$" + - "^github.com/spf13/cobra.CompletionOptions$" + - "^github.com/stretchr/testify/mock.Mock$" + - "^github.com/testcontainers/testcontainers-go.+Request$" + - "^github.com/testcontainers/testcontainers-go.FromDockerfile$" + - "^golang.org/x/tools/go/analysis.Analyzer$" + - "^google.golang.org/protobuf/.+Options$" + - "^gopkg.in/yaml.v3.Node$" + funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. + # Checks the number of lines in a function. + # If lower than 0, disable the check. + # Default: 60 + lines: 100 + # Checks the number of statements in a function. + # If lower than 0, disable the check. + # Default: 40 statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 + # Ignore comments when counting lines. + # Default false + ignore-comments: true + + gocognit: + # Minimal code complexity to report. + # Default: 30 (but we recommend 10-20) + min-complexity: 20 + gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint + # Settings passed to gocritic. + # The settings key is the name of a supported gocritic checker. + # The list of supported checkers can be find in https://go-critic.github.io/overview. + settings: + captLocal: + # Whether to restrict checker to params only. + # Default: true + paramsOnly: false + underef: + # Whether to skip (*x).method() calls where x is a pointer receiver. + # Default: true + skipRecvDeref: false + gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' + # List of function patterns to exclude from analysis. + # Values always ignored: `time.Date`, + # `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`, + # `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`. + # Default: [] ignored-functions: - - strings.SplitN + - flag.Arg + - flag.Duration.* + - flag.Float.* + - flag.Int.* + - flag.Uint.* + - os.Chmod + - os.Mkdir.* + - os.OpenFile + - os.WriteFile + - prometheus.ExponentialBuckets.* + - prometheus.LinearBuckets + + gomodguard: + blocked: + # List of blocked modules. + # Default: [] + modules: + - github.com/golang/protobuf: + recommendations: + - google.golang.org/protobuf + reason: "see https://developers.google.com/protocol-buffers/docs/reference/go/faq#modules" + - github.com/satori/go.uuid: + recommendations: + - github.com/google/uuid + reason: "satori's package is not maintained" + - github.com/gofrs/uuid: + recommendations: + - github.com/google/uuid + reason: "gofrs' package is not go module" govet: - check-shadowing: true + # Enable all analyzers. + # Default: false + enable-all: true + # Disable analyzers by name. + # Run `go tool vet help` to see all analyzers. + # Default: [] + disable: + - fieldalignment # too strict + # Settings per analyzer. settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + shadow: + # Whether to be strict about shadowing; can be noisy. + # Default: false + strict: true + lll: - line-length: 140 - misspell: - locale: US + # Max line length, lines longer will be reported. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option. + # Default: 120. + line-length: 180 + # Tab width in spaces. + # Default: 1 + tab-width: 1 + + nakedret: + # Make an issue if func has more lines of code than this setting, and it has naked returns. + # Default: 30 + max-func-lines: 0 + nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter + # Exclude following linters from requiring an explanation. + # Default: [] + allow-no-explanation: [ funlen, gocognit, lll ] + # Enable to require an explanation of nonzero length after each nolint directive. + # Default: false + require-explanation: true + # Enable to require nolint directives to mention the specific linter being suppressed. + # Default: false + require-specific: true + + rowserrcheck: + # database/sql is always checked + # Default: [] + packages: + - github.com/jmoiron/sqlx + + tenv: + # The option `all` will run against whole test files (`_test.go`) regardless of method/function signatures. + # Otherwise, only methods that take `*testing.T`, `*testing.B`, and `testing.TB` as arguments are checked. + # Default: false + all: true + linters: disable-all: true enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl + ## enabled by default + - errcheck # checking for unchecked errors, these unchecked errors can be critical bugs in some cases + - gosimple # specializes in simplifying a code + - govet # reports suspicious constructs, such as Printf calls whose arguments do not align with the format string + - ineffassign # detects when assignments to existing variables are not used + - staticcheck # is a go vet on steroids, applying a ton of static analysis checks + - typecheck # like the front-end of a Go compiler, parses and type-checks Go code + - unused # checks for unused constants, variables, functions and types + ## disabled by default + - asasalint # checks for pass []any as any in variadic func(...any) + - asciicheck # checks that your code does not contain non-ASCII identifiers + - bidichk # checks for dangerous unicode character sequences + - bodyclose # checks whether HTTP response body is closed successfully + - cyclop # checks function and package cyclomatic complexity + - dupl # tool for code clone detection + - durationcheck # checks for two durations multiplied together + - errname # checks that sentinel errors are prefixed with the Err and error types are suffixed with the Error + - errorlint # finds code that will cause problems with the error wrapping scheme introduced in Go 1.13 + - execinquery # checks query string in Query function which reads your Go src files and warning it finds + - exhaustive # checks exhaustiveness of enum switch statements + - exportloopref # checks for pointers to enclosing loop variables + - forbidigo # forbids identifiers + - funlen # tool for detection of long functions + - gocheckcompilerdirectives # validates go compiler directive comments (//go:) + - gochecknoglobals # checks that no global variables exist + - gochecknoinits # checks that no init functions are present in Go code + - gochecksumtype # checks exhaustiveness on Go "sum types" + - gocognit # computes and checks the cognitive complexity of functions + - goconst # finds repeated strings that could be replaced by a constant + - gocritic # provides diagnostics that check for bugs, performance and style issues + - gocyclo # computes and checks the cyclomatic complexity of functions + - godot # checks if comments end in a period + - goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt + - gomnd # detects magic numbers + - gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod + - gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations + - goprintffuncname # checks that printf-like functions are named with f at the end + - gosec # inspects source code for security problems + - lll # reports long lines + - loggercheck # checks key value pairs for common logger libraries (kitlog,klog,logr,zap) + - makezero # finds slice declarations with non-zero initial length + - mirror # reports wrong mirror patterns of bytes/strings usage + - musttag # enforces field tags in (un)marshaled structs + - nakedret # finds naked returns in functions greater than a specified function length + - nestif # reports deeply nested if statements + - nilerr # finds the code that returns nil even if it checks that the error is not nil + - nilnil # checks that there is no simultaneous return of nil error and an invalid value + - noctx # finds sending http request without context.Context + - nolintlint # reports ill-formed or insufficient nolint directives + - nonamedreturns # reports all named returns + - nosprintfhostport # checks for misuse of Sprintf to construct a host with port in a URL + - perfsprint # checks that fmt.Sprintf can be replaced with a faster alternative + - predeclared # finds code that shadows one of Go's predeclared identifiers + - promlinter # checks Prometheus metrics naming via promlint + - protogetter # reports direct reads from proto message fields when getters should be used + - reassign # checks that package variables are not reassigned + - revive # fast, configurable, extensible, flexible, and beautiful linter for Go, drop-in replacement of golint + - rowserrcheck # checks whether Err of rows is checked successfully + - sloglint # ensure consistent code style when using log/slog + - sqlclosecheck # checks that sql.Rows and sql.Stmt are closed + - stylecheck # is a replacement for golint + - tenv # detects using os.Setenv instead of t.Setenv since Go1.17 + - testableexamples # checks if examples are testable (have an expected output) + - testifylint # checks usage of github.com/stretchr/testify + - testpackage # makes you use a separate _test package + - tparallel # detects inappropriate usage of t.Parallel() method in your Go test codes + - unconvert # removes unnecessary type conversions + - unparam # reports unused function parameters + - usestdlibvars # detects the possibility to use variables/constants from the Go standard library + - wastedassign # finds wasted assignment statements + - whitespace # detects leading and trailing whitespace + + ## you may want to enable + - decorder # checks declaration order and count of types, constants, variables and functions + - exhaustruct # [highly recommend to enable] checks if all structure fields are initialized + - gci # controls golang package import order and makes it always deterministic + - ginkgolinter # [if you use ginkgo/gomega] enforces standards of using ginkgo and gomega + #- godox # detects FIXMЕ, TОDO and other comment keywords + - goheader # checks is file header matches to pattern + - inamedparam # [great idea, but too strict, need to ignore a lot of cases by default] reports interfaces with unnamed method parameters + - interfacebloat # checks the number of methods inside an interface + - ireturn # accept interfaces, return concrete types + - prealloc # [premature optimization, but can be used in some cases] finds slice declarations that could potentially be preallocated + - tagalign # checks that struct tags are well aligned + - varnamelen # [great idea, but too many false positives] checks that the length of a variable's name matches its scope + - wrapcheck # checks that errors returned from external packages are wrapped + - zerologlint # detects the wrong usage of zerolog that a user forgets to dispatch zerolog.Event + + ## disabled + #- containedctx # detects struct contained context.Context field + #- contextcheck # [too many false positives] checks the function whether use a non-inherited context + #- depguard # [replaced by gomodguard] checks if package imports are in a list of acceptable packages + #- dogsled # checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) + #- dupword # [useless without config] checks for duplicate words in the source code + #- errchkjson # [don't see profit + I'm against of omitting errors like in the first example https://github.com/breml/errchkjson] checks types passed to the json encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted + #- forcetypeassert # [replaced by errcheck] finds forced type assertions + #- goerr113 # [too strict] checks the errors handling expressions + #- gofmt # [replaced by goimports] checks whether code was gofmt-ed + #- gofumpt # [replaced by goimports, gofumports is not available yet] checks whether code was gofumpt-ed + #- gosmopolitan # reports certain i18n/l10n anti-patterns in your Go codebase + #- grouper # analyzes expression groups + #- importas # enforces consistent import aliases + #- maintidx # measures the maintainability index of each function + #- misspell # [useless] finds commonly misspelled English words in comments + #- nlreturn # [too strict and mostly code is not more readable] checks for a new line before return and branch statements to increase code clarity + #- paralleltest # [too many false positives] detects missing usage of t.Parallel() method in your Go test + #- tagliatelle # checks the struct tags + #- thelper # detects golang test helpers without t.Helper() call and checks the consistency of test helpers + #- wsl # [too strict and mostly code is not more readable] whitespace linter forces you to use empty lines + + ## deprecated + #- deadcode # [deprecated, replaced by unused] finds unused code + #- exhaustivestruct # [deprecated, replaced by exhaustruct] checks if all struct's fields are initialized + #- golint # [deprecated, replaced by revive] golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes + #- ifshort # [deprecated] checks that your code uses short syntax for if-statements whenever possible + #- interfacer # [deprecated] suggests narrower interface types + #- maligned # [deprecated, replaced by govet fieldalignment] detects Go structs that would take less memory if their fields were sorted + #- nosnakecase # [deprecated, replaced by revive var-naming] detects snake case of variable naming and function name + #- scopelint # [deprecated, replaced by exportloopref] checks for unpinned variables in go programs + #- structcheck # [deprecated, replaced by unused] finds unused struct fields + #- varcheck # [deprecated, replaced by unused] finds unused global variables and constants + issues: - # Excluding configuration per-path, per-linter, per-text and per-source + # Maximum count of issues with the same text. + # Set to 0 to disable. + # Default: 3 + max-same-issues: 50 + exclude-rules: - - path: _test\.go + - source: "(noinspection|TODO)" + linters: [ godot ] + - source: "//noinspection" + linters: [ gocritic ] + - path: "_test\\.go" linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code + - bodyclose + - dupl + - funlen + - goconst + - gosec + - noctx + - wrapcheck diff --git a/on-car-plates/README.md b/on-car-plates/README.md new file mode 100644 index 0000000..8af88e4 --- /dev/null +++ b/on-car-plates/README.md @@ -0,0 +1,46 @@ +# Тренировочный раунд Route 256: Junior Go-разработчик + +## 3. Автомобильные номера + +| Показатель | значение | +|----------------------|--------------------| +| Ограничение времени | 2 000 Мс | +| Ограничение памяти | 512Mb | +| Ввод | стандартный ввод | +| Вывод | стандартный вывод | + +В Берляндии автомобильные номера состоят из цифр и прописных букв латинского алфавита. Они бывают двух видов: +- либо автомобильный номер имеет вид `буква−цифра−цифра−буква−буква` (примеры корректных номеров первого вида: `R48FAR48FA`, `O00OOO00OO`, `A99OKA99OK`); +- либо автомобильный номер имеет вид `буква−цифра−буква−буква` (примеры корректных номеров второго вида: `T7RRT7RR`, `A9PQA9PQ`, `O0OOO0OO`). + +Таким образом, каждый автомобильный номер является строкой либо первого, либо второго вида. + +Вам задана строка из цифр и прописных букв латинского алфавита. Можно ли разделить её пробелами на последовательность корректных автомобильных номеров? Иными словами, проверьте, что заданная строка может быть образована как последовательность корректных автомобильных номеров, которые записаны подряд без пробелов. В случае положительного ответа выведите любое такое разбиение. + +### Входные данные + +В первой строке записано целое число `t` (`1 ≤ t ≤ 1000`) — количество наборов входных данных в тесте. + +Наборы входных данных в тесте независимы. Друг на друга они никак не влияют. + +Каждый набор входных данных — непустая строка `s`, которая состоит из цифр и прописных букв латинского алфавита. Длина строки — от 1 до 50 символов. + +### Выходные данные + +Выведите `n` строк: очередная строка должна содержать ответ для соответствующего набора входных данных. + +Если ответ отрицательный — то есть заданную строку `s` невозможно представить как последовательность номеров автомобилей — строка в выводе должна содержать единственный символ `-` (минус, ASCII-код 45). + +В случае положительного ответа выведите любое разбиение заданной строки ss на последовательность корректных номеров. Каждый номер должен соответствовать одному из двух видов (см. условие). Номера разделяйте пробелами. Вы можете выводить произвольное количество пробелов и даже лишние пробелы после последнего номера. + +#### Пример 1 + +| Ввод | Вывод | +|--------------------------|------------------------------| +| 6 | | +| R48FAO00OOO0OOA99OKA99OK | R48FA O00OO O0OO A99OK A99OK | +| R48FAO00OOO0OOA99OKA99O | - | +| A9PQ | A9PQ | +| A9PQA | - | +| A99AAA99AAA99AAA99AA | A99AA A99AA A99AA A99AA | +| AP9QA | - | diff --git a/on-car-plates/main.go b/on-car-plates/main.go new file mode 100644 index 0000000..c17818e --- /dev/null +++ b/on-car-plates/main.go @@ -0,0 +1,106 @@ +package main + +import ( + "fmt" + "log" + "unicode" +) + +func main() { + carPlatesPackage := parseCarPlates() + for _, carPlates := range carPlatesPackage { + showMessage(iterateCarPlates(carPlates)) + } +} + +func parseCarPlates() []string { + var carPlatesPackage []string + var err error + var countCarPlates int + + _, err = fmt.Scan(&countCarPlates) + if err != nil { + log.Println(err) + } + + for i := 0; i < countCarPlates; i++ { + var carPlates string + _, err = fmt.Scan(&carPlates) + if err != nil { + log.Println(err) + } + + carPlatesPackage = append(carPlatesPackage, carPlates) + } + + return carPlatesPackage +} + +func isValidCarPlate(carPlate string) bool { + if len(carPlate) == 4 { + character1 := rune(carPlate[0]) + character2 := rune(carPlate[1]) + character3 := rune(carPlate[2]) + character4 := rune(carPlate[3]) + + if unicode.IsLetter(character1) && unicode.IsDigit(character2) && unicode.IsLetter(character3) && unicode.IsLetter(character4) { + return true + } + } + if len(carPlate) == 5 { + character1 := rune(carPlate[0]) + character2 := rune(carPlate[1]) + character3 := rune(carPlate[2]) + character4 := rune(carPlate[3]) + character5 := rune(carPlate[4]) + + if unicode.IsLetter(character1) && unicode.IsDigit(character2) && unicode.IsDigit(character3) && unicode.IsLetter(character4) && unicode.IsLetter(character5) { + return true + } + } + + return false +} + +func iterateCarPlates(carPlates string) string { + const fourCharacters = 4 + const fiveCharacters = 5 + + if len(carPlates) < fourCharacters { + return "-" + } + + var carPlatesList string + var currentIdx int + var remainCharactersCarPlates = len(carPlates) + + for remainCharactersCarPlates != 0 { + var fourCharactersCarPlate string + var fiveCharactersCarPlate string + + if remainCharactersCarPlates >= fourCharacters { + fourCharactersCarPlate = carPlates[currentIdx : currentIdx+fourCharacters] + } + if remainCharactersCarPlates >= fiveCharacters { + fiveCharactersCarPlate = carPlates[currentIdx : currentIdx+fiveCharacters] + } + + if isValidCarPlate(fourCharactersCarPlate) && remainCharactersCarPlates >= fourCharacters { + carPlatesList += fourCharactersCarPlate + " " + currentIdx += fourCharacters + remainCharactersCarPlates -= fourCharacters + continue + } else if isValidCarPlate(fiveCharactersCarPlate) && remainCharactersCarPlates >= fiveCharacters { + carPlatesList += fiveCharactersCarPlate + " " + currentIdx += fiveCharacters + remainCharactersCarPlates -= fiveCharacters + continue + } + return "-" + } + return carPlatesList +} + +func showMessage(msg string) { + fmt.Printf("%s\n", msg) //nolint:forbidigo - it's not debug +} diff --git a/on-car-plates/main_test.go b/on-car-plates/main_test.go new file mode 100644 index 0000000..e95c12a --- /dev/null +++ b/on-car-plates/main_test.go @@ -0,0 +1,52 @@ +package main + +import "testing" + +func Test_iterateCarPlates(t *testing.T) { + type args struct { + carPlates string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "Example 1", + args: args{"R48FAO00OOO0OOA99OKA99OK"}, + want: "R48FA O00OO O0OO A99OK A99OK ", + }, + { + name: "Example 2", + args: args{"R48FAO00OOO0OOA99OKA99O"}, + want: "-", + }, + { + name: "Example 3", + args: args{"A9PQ"}, + want: "A9PQ ", + }, + { + name: "Example 4", + args: args{"A9PQA"}, + want: "-", + }, + { + name: "Example 5", + args: args{"A99AAA99AAA99AAA99AA"}, + want: "A99AA A99AA A99AA A99AA ", + }, + { + name: "Example 6", + args: args{"AP9QA"}, + want: "-", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := iterateCarPlates(tt.args.carPlates); got != tt.want { + t.Errorf("iterateCarPlates() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/on-check-date/README.md b/on-check-date/README.md new file mode 100644 index 0000000..a353e88 --- /dev/null +++ b/on-check-date/README.md @@ -0,0 +1,53 @@ +# Тренировочный раунд Route 256: Junior Go-разработчик + +## 2. Проверка даты + +| Показатель | значение | +|----------------------|--------------------| +| Ограничение времени | 2 000 Мс | +| Ограничение памяти | 512Mb | +| Ввод | стандартный ввод | +| Вывод | стандартный вывод | + +Задана дата в формате "день месяц год" в виде трёх целых чисел. Гарантируется, что: +- день — это целое число от 1 до 31; +- месяц — это целое число от 1 до 12; +- год — это целое число от 1950 до 2300. + +Проверьте, что заданные три числа соответствуют корректной дате (в современном григорианском календаре). + +Напоминаем, что в соответствии с современным календарём год считает високосным, если для этого года верно хотя бы одно из утверждений: +- делится на 4, но при этом не делится на 100; +- делится на 400. + +Например, годы 2012 и 2000 являются високосными, но годы 1999, 2022 и 2100 - нет. + +### Входные данные + +В первой строке записано целое число `t` (`1 ≤ t ≤ 1000`) — количество наборов входных данных в тесте. + +Наборы входных данных в тесте являются независимыми. Друг на друга они никак не влияют. + +Каждый набор входных данных задаётся одной строкой, в которой записаны три целых числа `dd`, `mm`, `yy` (`1 ≤ d ≤ 31`,`1 ≤ m ≤ 12`,`1950 ≤ y ≤ 2300`) — день, месяц и год даты для проверки. + +### Выходные данные + +Для каждого набора входных данных в отдельной строке выведите: +- `YES`, если соответствующая дата является корректной (т.е. существует такая дата в современном календаре); +- `NO` в противном случае. + +#### Пример 1 + +| Ввод | Вывод | +|------------|-------| +| 10 | | +| 10 9 2022 | YES | +| 21 9 2022 | YES | +| 29 2 2022 | NO | +| 31 2 2022 | NO | +| 29 2 2000 | YES | +| 29 2 2100 | NO | +| 31 11 1999 | NO | +| 31 12 1999 | YES | +| 29 2 2024 | YES | +| 29 2 2023 | NO | diff --git a/on-check-date/main.go b/on-check-date/main.go new file mode 100644 index 0000000..ef43533 --- /dev/null +++ b/on-check-date/main.go @@ -0,0 +1,62 @@ +package main + +import ( + "fmt" + "log" + "time" +) + +const ( + formatDate = "02.01.2006" +) + +func main() { + datesPackage := parseDates() + for _, kitDates := range datesPackage { + if isValidKitDates(kitDates) { + showMessage("YES") + } else { + showMessage("NO") + } + } +} + +func parseDates() [][]int { + var datesPackage [][]int + var err error + var countKitDates int + + _, err = fmt.Scan(&countKitDates) + if err != nil { + log.Println(err) + } + + for i := 0; i < countKitDates; i++ { + var day, month, year int + var kitDates []int + _, err = fmt.Scan(&day, &month, &year) + if err != nil { + log.Println(err) + } + + kitDates = append(kitDates, day, month, year) + datesPackage = append(datesPackage, kitDates) + } + + return datesPackage +} + +func isValidKitDates(kitDates []int) bool { + day := kitDates[0] + month := kitDates[1] + year := kitDates[2] + + date := fmt.Sprintf("%02d.%02d.%d", day, month, year) + _, err := time.Parse(formatDate, date) + + return err == nil +} + +func showMessage(msg string) { + fmt.Printf("%s\n", msg) //nolint:forbidigo - it's not debug +} diff --git a/on-check-date/main_test.go b/on-check-date/main_test.go new file mode 100644 index 0000000..483aa84 --- /dev/null +++ b/on-check-date/main_test.go @@ -0,0 +1,72 @@ +package main + +import "testing" + +func Test_isValidKitDates(t *testing.T) { + type args struct { + kitDates []int + } + tests := []struct { + name string + args args + want bool + }{ + { + name: "Example 1", + args: args{[]int{10, 9, 2022}}, + want: true, + }, + { + name: "Example 2", + args: args{[]int{21, 9, 2022}}, + want: true, + }, + { + name: "Example 3", + args: args{[]int{29, 2, 2022}}, + want: false, + }, + { + name: "Example 4", + args: args{[]int{31, 2, 2022}}, + want: false, + }, + { + name: "Example 5", + args: args{[]int{29, 2, 2020}}, + want: true, + }, + { + name: "Example 6", + args: args{[]int{29, 2, 2100}}, + want: false, + }, + { + name: "Example 7", + args: args{[]int{31, 11, 1999}}, + want: false, + }, + { + name: "Example 8", + args: args{[]int{31, 12, 1999}}, + want: true, + }, + { + name: "Example 9", + args: args{[]int{29, 2, 2024}}, + want: true, + }, + { + name: "Example 10", + args: args{[]int{29, 2, 2023}}, + want: false, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := isValidKitDates(tt.args.kitDates); got != tt.want { + t.Errorf("isValidKitDates() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/on-sea-battle/README.md b/on-sea-battle/README.md new file mode 100644 index 0000000..53a8447 --- /dev/null +++ b/on-sea-battle/README.md @@ -0,0 +1,45 @@ +# Тренировочный раунд Route 256: Junior Go-разработчик + +## 1. Морской бой + +| Показатель | значение | +|----------------------|--------------------| +| Ограничение времени | 2 000 Мс | +| Ограничение памяти | 512Mb | +| Ввод | стандартный ввод | +| Вывод | стандартный вывод | + +Вы участвуете в разработке подсистемы проверки поля для игры <<Морской бой>>. Вам требуется написать проверку корректности количества кораблей на поле, учитывая их размеры. Напомним, что на поле должны быть: +- четыре однопалубных корабля, +- три двухпалубных корабля, +- два трёхпалубных корабля, +- один четырёхпалубный корабль. + +Вам заданы 1010 целых чисел от 11 до 44. Проверьте, что заданные размеры соответствуют требованиям выше. + +### Входные данные + +В первой строке записано целое число `t` (`1 ≤ t ≤ 1000`) — количество наборов входных данных в тесте. + +Наборы входных данных в тесте независимы. Друг на друга они никак не влияют. + +Каждый набор входных данных состоит из одной строки, которая содержит `10` целых чисел `a1`,`a2`,…,`a10` (`1 ≤ a i ≤4`) — размеры кораблей на поле в произвольном порядке. + +Обратите внимание, что уже гарантируется, что кораблей на поле ровно `10` и их размеры от `1` до `4`, включительно. Вам необходимо проверить, что количество кораблей каждого типа соответствует правилам игры. + +### Выходные данные + +Для каждого набора входных данных в отдельной строке выведите: +- `YES`, если заданные размеры кораблей на поле соответствуют правилам игры; +- `NO` в противном случае. + +#### Пример 1 + +| Ввод | Вывод | +|---------------------|-------| +| 5 | | +| 2 1 3 1 2 3 1 1 4 2 | YES | +| 1 1 1 2 2 2 3 3 3 4 | NO | +| 1 1 1 1 2 2 2 3 3 4 | YES | +| 4 3 3 2 2 2 1 1 1 1 | YES | +| 4 4 4 4 4 4 4 4 4 4 | NO | diff --git a/on-sea-battle/main.go b/on-sea-battle/main.go new file mode 100644 index 0000000..c6d9611 --- /dev/null +++ b/on-sea-battle/main.go @@ -0,0 +1,83 @@ +package main + +import ( + "fmt" + "log" +) + +const ( + oneDeckShip = 1 + twoDeckShip = 2 + threeDeckShip = 3 + fourDeckShip = 4 + + countOneDeckShip = 4 + countTwoDeckShip = 3 + countThreeDeckShip = 2 + countFourDeckShip = 1 +) + +func main() { + shipsPackage := parseShips() + for _, kitShips := range shipsPackage { + if isValidKitShips(kitShips) { + showMessage("YES") + } else { + showMessage("NO") + } + } +} + +func parseShips() [][]int { + var shipsPackage [][]int + var err error + var countKitShips int + + _, err = fmt.Scan(&countKitShips) + if err != nil { + log.Println(err) + } + + for i := 0; i < countKitShips; i++ { + var ship1, ship2, ship3, ship4, ship5, ship6, ship7, ship8, ship9, ship10 int + var kitShips []int + _, err = fmt.Scan(&ship1, &ship2, &ship3, &ship4, &ship5, &ship6, &ship7, &ship8, &ship9, &ship10) + if err != nil { + log.Println(err) + } + + kitShips = append(kitShips, ship1, ship2, ship3, ship4, ship5, ship6, ship7, ship8, ship9, ship10) + shipsPackage = append(shipsPackage, kitShips) + } + + return shipsPackage +} + +func isValidKitShips(kitShips []int) bool { + var sumOneDeckShip, sumTwoDeckShip, sumThreeDeckShip, sumFourDeckShip int + + for _, ship := range kitShips { + switch ship { + case oneDeckShip: + sumOneDeckShip++ + case twoDeckShip: + sumTwoDeckShip++ + case threeDeckShip: + sumThreeDeckShip++ + case fourDeckShip: + sumFourDeckShip++ + default: + return false + } + } + + if sumOneDeckShip != countOneDeckShip || sumTwoDeckShip != countTwoDeckShip || sumThreeDeckShip != countThreeDeckShip || sumFourDeckShip != countFourDeckShip { + return false + } + + return true +} + +func showMessage(msg string) { + fmt.Printf("%s\n", msg) //nolint:forbidigo - it's not debug +} diff --git a/tf-array/Makefile b/tf-array/Makefile deleted file mode 100644 index af9545c..0000000 --- a/tf-array/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-array -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-array/go.mod b/tf-array/go.mod deleted file mode 100644 index fcedd6d..0000000 --- a/tf-array/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/tf-array -go 1.21.5 diff --git a/tf-array/golangci.yml b/tf-array/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-array/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-cost-internet/Makefile b/tf-cost-internet/Makefile deleted file mode 100644 index 16696ad..0000000 --- a/tf-cost-internet/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-cost-internet -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-cost-internet/go.mod b/tf-cost-internet/go.mod deleted file mode 100644 index 1b833fb..0000000 --- a/tf-cost-internet/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/tf-cost-internet - -go 1.21.5 diff --git a/tf-cost-internet/golangci.yml b/tf-cost-internet/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-cost-internet/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-cutting-roll/Makefile b/tf-cutting-roll/Makefile deleted file mode 100644 index 4b72603..0000000 --- a/tf-cutting-roll/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-cutting-roll -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-cutting-roll/go.mod b/tf-cutting-roll/go.mod deleted file mode 100644 index c840659..0000000 --- a/tf-cutting-roll/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/tf-cutting-roll - -go 1.21.5 diff --git a/tf-cutting-roll/golangci.yml b/tf-cutting-roll/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-cutting-roll/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-investments/Makefile b/tf-investments/Makefile deleted file mode 100644 index 23244ae..0000000 --- a/tf-investments/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-investments -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-investments/go.mod b/tf-investments/go.mod deleted file mode 100644 index b385dca..0000000 --- a/tf-investments/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/tf-investments -go 1.21.5 diff --git a/tf-investments/golangci.yml b/tf-investments/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-investments/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-kids/Makefile b/tf-kids/Makefile deleted file mode 100644 index 2077979..0000000 --- a/tf-kids/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-kids -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-kids/go.mod b/tf-kids/go.mod deleted file mode 100644 index 3192e23..0000000 --- a/tf-kids/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/tf-kids -go 1.21.5 diff --git a/tf-kids/golangci.yml b/tf-kids/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-kids/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-present/Makefile b/tf-present/Makefile deleted file mode 100644 index e1b74ef..0000000 --- a/tf-present/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-present -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-present/go.mod b/tf-present/go.mod deleted file mode 100644 index c684d05..0000000 --- a/tf-present/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/tf-present -go 1.21.5 diff --git a/tf-present/golangci.yml b/tf-present/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-present/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-signboard/Makefile b/tf-signboard/Makefile deleted file mode 100644 index 8c50796..0000000 --- a/tf-signboard/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-signboard -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-signboard/go.mod b/tf-signboard/go.mod deleted file mode 100644 index a0d9dde..0000000 --- a/tf-signboard/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/tf-signboard -go 1.21.5 diff --git a/tf-signboard/golangci.yml b/tf-signboard/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-signboard/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-sociality/Makefile b/tf-sociality/Makefile deleted file mode 100644 index 3414e14..0000000 --- a/tf-sociality/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/tf-sociality -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-sociality/go.mod b/tf-sociality/go.mod deleted file mode 100644 index 70e26df..0000000 --- a/tf-sociality/go.mod +++ /dev/null @@ -1,2 +0,0 @@ -module github.com/skosovsky/algo/tf-sociality -go 1.21.5 diff --git a/tf-sociality/golangci.yml b/tf-sociality/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-sociality/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/tf-sum/Makefile b/tf-sum/Makefile deleted file mode 100644 index 379a03c..0000000 --- a/tf-sum/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/ya-details -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/tf-sum/go.mod b/tf-sum/go.mod deleted file mode 100644 index 8e3e844..0000000 --- a/tf-sum/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/tf-sum - -go 1.21.5 diff --git a/tf-sum/golangci.yml b/tf-sum/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/tf-sum/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/ya-details/go.mod b/ya-details/go.mod deleted file mode 100644 index 8f2fa08..0000000 --- a/ya-details/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/ya-details - -go 1.21.4 diff --git a/ya-details/golangci.yml b/ya-details/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/ya-details/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/ya-details/makefile b/ya-details/makefile deleted file mode 100644 index 284dcc7..0000000 --- a/ya-details/makefile +++ /dev/null @@ -1,30 +0,0 @@ -APP=algo/ya-details -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/yr-channels-bug/Makefile b/yr-channels-bug/Makefile deleted file mode 100644 index d8e9f5a..0000000 --- a/yr-channels-bug/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -APP=algo/yr-channels-bug -.PHONY: help -help: Makefile ## Show this help - @echo - @echo "Choose a command run in "$(APP)":" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | sed -e 's/\(\:.*\#\#\)/\:\ /' | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -.PHONY: build -build: ## Build an application - @echo "Building ${APP} ..." - mkdir -p build - go build -o build/${APP} main.go - -run: ## Run an application - @echo "Starting ${APP} ..." - go run main.go - -test: ## Run an application - @echo "Testing ${APP} ..." - go test - -bench: ## Run an application - @echo "Benchmarking ${APP} ..." - go test -bench=. . - -clean: ## Clean a garbage - @echo "Cleaning" - go clean - rm -rf build - -lint: ## Check a code by golangci-lint - @echo "Linter checking..." - golangci-lint run -c golangci.yml ./... diff --git a/yr-channels-bug/go.mod b/yr-channels-bug/go.mod deleted file mode 100644 index 0ed92f2..0000000 --- a/yr-channels-bug/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/yr-channels-bug - -go 1.21.5 diff --git a/yr-channels-bug/golangci.yml b/yr-channels-bug/golangci.yml deleted file mode 100644 index 6ff473a..0000000 --- a/yr-channels-bug/golangci.yml +++ /dev/null @@ -1,160 +0,0 @@ -linters-settings: - depguard: - # new configuration - rules: - logger: - deny: - # logging is allowed only by logutils.Log, - # logrus is allowed to use only in logutils package. - - pkg: "github.com/sirupsen/logrus" - desc: logging is allowed only by logutils.Log - dupl: - threshold: 100 - funlen: - lines: -1 # the number of lines (code + empty lines) is not a right metric and leads to code without empty line or one-liner. - statements: 50 - goconst: - min-len: 2 - min-occurrences: 3 - gocritic: - enabled-tags: - - diagnostic - - experimental - - opinionated - - performance - - style - disabled-checks: - - dupImport # https://github.com/go-critic/go-critic/issues/845 - - ifElseChain - - octalLiteral - - whyNoLint - gocyclo: - min-complexity: 15 - gofmt: - rewrite-rules: - - pattern: 'interface{}' - replacement: 'any' - goimports: - local-prefixes: github.com/golangci/golangci-lint - gomnd: - # don't include the "operation" and "assign" - checks: - - argument - - case - - condition - - return - ignored-numbers: - - '0' - - '1' - - '2' - - '3' - ignored-functions: - - strings.SplitN - - govet: - check-shadowing: true - settings: - printf: - funcs: - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf - - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf - lll: - line-length: 140 - misspell: - locale: US - nolintlint: - allow-unused: false # report any unused nolint directives - require-explanation: false # don't require an explanation for nolint directives - require-specific: false # don't require nolint directives to be specific about which linter is being skipped - revive: - rules: - - name: unexported-return - disabled: true - - name: unused-parameter - -linters: - disable-all: true - enable: - - bodyclose - - depguard - - dogsled - - dupl - - errcheck - - exportloopref - - funlen - - gocheckcompilerdirectives - - gochecknoinits - - goconst - - gocritic - - gocyclo - - gofmt - - goimports - - gomnd - - goprintffuncname - - gosec - - gosimple - - govet - - ineffassign - - lll - - misspell - - nakedret - - noctx - - nolintlint - - revive - - staticcheck - - stylecheck - - typecheck - - unconvert - - unparam - - unused - - whitespace - - # don't enable: - # - asciicheck - # - scopelint - # - gochecknoglobals - # - gocognit - # - godot - # - godox - # - goerr113 - # - interfacer - # - maligned - # - nestif - # - prealloc - # - testpackage - # - wsl - -issues: - # Excluding configuration per-path, per-linter, per-text and per-source - exclude-rules: - - path: _test\.go - linters: - - gomnd - - - path: pkg/golinters/errcheck.go - text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead" - - path: pkg/commands/run.go - text: "SA1019: e.cfg.Run.Deadline is deprecated: Deadline exists for historical compatibility and should not be used." - - - path: pkg/golinters/gofumpt.go - text: "SA1019: settings.LangVersion is deprecated: use the global `run.go` instead." - - path: pkg/golinters/staticcheck_common.go - text: "SA1019: settings.GoVersion is deprecated: use the global `run.go` instead." - - path: pkg/lint/lintersdb/manager.go - text: "SA1019: (.+).(GoVersion|LangVersion) is deprecated: use the global `run.go` instead." - - path: pkg/golinters/unused.go - text: "rangeValCopy: each iteration copies 160 bytes \\(consider pointers or indexing\\)" - - path: test/(fix|linters)_test.go - text: "string `gocritic.go` has 3 occurrences, make it a constant" - -run: - timeout: 5m - skip-dirs: - - test/testdata_etc # test files - - internal/cache # extracted from Go code - - internal/renameio # extracted from Go code - - internal/robustio # extracted from Go code diff --git a/yr-monotony-slice/go.mod b/yr-monotony-slice/go.mod deleted file mode 100644 index 5bfbb46..0000000 --- a/yr-monotony-slice/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/skosovsky/algo/yr-monotony-slice - -go 1.21.4