[#23] pre-commit: Add initial configuration

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-03-03 12:29:33 +03:00
parent 94476f9055
commit b761fd8070
22 changed files with 41 additions and 22 deletions

2
.gitignore vendored
View file

@ -20,4 +20,4 @@ vendor/
# coverage # coverage
coverage.txt coverage.txt
coverage.html coverage.html

19
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,19 @@
ci:
autofix_prs: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: check-json
- id: check-xml
- id: check-yaml
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
exclude: ".key$"

2
Makefile Normal file → Executable file
View file

@ -37,4 +37,4 @@ help:
@echo '' @echo ''
@echo ' Targets:' @echo ' Targets:'
@echo '' @echo ''
@awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u @awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | grep -v 'IGNORE' | sort -u

View file

@ -54,7 +54,7 @@ err := c.Dial(prmDial)
if err != nil { if err != nil {
return return
} }
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second) ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
defer cancel() defer cancel()
@ -98,7 +98,7 @@ Contains CRUSH-like implementation of container node selection algorithm. Releva
are described in this paper http://ceur-ws.org/Vol-2344/short10.pdf . Note that it can be are described in this paper http://ceur-ws.org/Vol-2344/short10.pdf . Note that it can be
outdated in some details. outdated in some details.
`netmap/json_tests` subfolder contains language-agnostic tests for selection algorithm. `netmap/json_tests` subfolder contains language-agnostic tests for selection algorithm.
```go ```go
import ( import (
@ -110,7 +110,7 @@ func placementNodes(addr *object.Address, p *netmap.PlacementPolicy, frostfsNode
// Convert list of nodes in FrostFS API format to the intermediate representation. // Convert list of nodes in FrostFS API format to the intermediate representation.
nodes := netmap.NodesFromInfo(nodes) nodes := netmap.NodesFromInfo(nodes)
// Create new netmap (errors are skipped for the sake of clarity). // Create new netmap (errors are skipped for the sake of clarity).
nm, _ := NewNetmap(nodes) nm, _ := NewNetmap(nodes)
// Calculate nodes of container. // Calculate nodes of container.
@ -131,4 +131,4 @@ Contain simple API wrappers.
Wrapper over `zap.Logger` which is used across FrostFS codebase. Wrapper over `zap.Logger` which is used across FrostFS codebase.
### util ### util
Utilities for working with signature-related code. Utilities for working with signature-related code.

View file

@ -15,4 +15,4 @@ Field|Description
`pivot`|Optional pivot to use in container node selection. `pivot`|Optional pivot to use in container node selection.
`result`|List of lists of node-indices corresponding to each replica in the placement policy. `result`|List of lists of node-indices corresponding to each replica in the placement policy.
`error`|Error that should be raised for this specific test. The actual strings are used in SDK, other implementation may simply check that error has occurred. `error`|Error that should be raised for this specific test. The actual strings are used in SDK, other implementation may simply check that error has occurred.
`placement`|Optional field containing another test for selecting placement nodes for an object. Can contain `pivot`, `result` and `error` fields with the same meaning as above. Note that if `pivot` is omitted, empty value should be used. `placement`|Optional field containing another test for selecting placement nodes for an object. Can contain `pivot`, `result` and `error` fields with the same meaning as above. Note that if `pivot` is omitted, empty value should be used.

View file

@ -97,4 +97,4 @@
] ]
} }
} }
} }

View file

@ -98,4 +98,4 @@
] ]
} }
} }
} }

View file

@ -156,4 +156,4 @@
] ]
} }
} }
} }

View file

@ -384,4 +384,4 @@
"error": "not enough nodes" "error": "not enough nodes"
} }
} }
} }

View file

@ -80,4 +80,4 @@
"error": "not enough nodes" "error": "not enough nodes"
} }
} }
} }

View file

@ -412,4 +412,4 @@
"error": "not enough nodes" "error": "not enough nodes"
} }
} }
} }

View file

@ -162,4 +162,4 @@
} }
} }
} }
} }

View file

@ -106,4 +106,4 @@
] ]
} }
} }
} }

View file

@ -189,4 +189,4 @@
] ]
} }
} }
} }

View file

@ -92,4 +92,4 @@
] ]
} }
} }
} }

View file

@ -329,4 +329,4 @@
] ]
} }
} }
} }

View file

@ -110,4 +110,4 @@
"error": "not enough nodes" "error": "not enough nodes"
} }
} }
} }

View file

@ -114,4 +114,4 @@
] ]
} }
} }
} }

View file

@ -101,4 +101,4 @@
"error": "not enough nodes" "error": "not enough nodes"
} }
} }
} }

View file

@ -251,4 +251,4 @@
"error": "not enough nodes" "error": "not enough nodes"
} }
} }
} }

Binary file not shown.

Binary file not shown.