Showing 71 of 107 total issues
Function TestUploadArchive
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestUploadArchive(t *testing.T) {
for _, network := range []string{"unix", "tcp", "dns"} {
t.Run(fmt.Sprintf("via %s network", network), func(t *testing.T) {
gitalyAddress, testServer := testserver.StartGitalyServer(t, network)
t.Log(fmt.Sprintf("Server address: %s", gitalyAddress))
Function TestExecuteNoEOFSent
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestExecuteNoEOFSent(t *testing.T) {
who := "key-1"
requests := []testserver.TestRequestHandler{
{
Function TestScanner
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestScanner(t *testing.T) {
largestPacket := "ffff" + largestString
testCases := []struct {
desc string
in string
Function TestExecuteEOFSent
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestExecuteEOFSent(t *testing.T) {
who := "key-1"
requests := []testserver.TestRequestHandler{
{
Method mock_server
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mock_server(server)
server.mount_proc('/geo/proxy_git_ssh/info_refs_upload_pack') do |req, res|
res.content_type = 'application/json'
res.status = 200
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method mock_server
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mock_server(server)
server.mount_proc('/geo/proxy_git_ssh/info_refs_receive_pack') do |req, res|
res.content_type = 'application/json'
res.status = 200
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method GitlabBackend.parseAndCheckBatchArgs
has 9 return statements (exceeds 4 allowed). Open
func (b *GitlabBackend) parseAndCheckBatchArgs(op, oid, id, token string) (href string, headers map[string]string, err error) {
if id == "" {
return "", nil, &errCustom{
err: transfer.ErrParseError,
message: "missing id",
Function pktLineSplitter
has 8 return statements (exceeds 4 allowed). Open
func pktLineSplitter(data []byte, atEOF bool) (advance int, token []byte, err error) {
if len(data) < 4 {
if atEOF && len(data) > 0 {
return 0, nil, fmt.Errorf("pktLineSplitter: incomplete length prefix on %q", data)
}
Method Client.Lock
has 7 return statements (exceeds 4 allowed). Open
func (c *Client) Lock(path, refname string) (*Lock, error) {
var ref *batchRef
if refname != "" {
ref = &batchRef{
Name: refname,
Method mock_server
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def mock_server(server)
server.mount_proc('/api/v4/internal/discover') do |req, res|
identifier = req.query['key_id'] || req.query['username'] || req.query['user_id']
known_identifiers = %w(10 someuser 100)
if known_identifiers.include?(identifier)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method Command.Execute
has 6 return statements (exceeds 4 allowed). Open
func (c *Command) Execute(ctx context.Context) (context.Context, error) {
args := c.Args.SshArgs
if len(args) != 2 {
return ctx, disallowedcommand.Error
}
Method Command.Execute
has 6 return statements (exceeds 4 allowed). Open
func (c *Command) Execute(ctx context.Context) (context.Context, error) {
args := c.Args.SshArgs
if len(args) != 2 {
return ctx, disallowedcommand.Error
}
Function Audit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func Audit(ctx context.Context, commandType commandargs.CommandType, c *config.Config, response *accessverifier.Response, packfileStats *pb.PackfileNegotiationStatistics) {
Function writeCommandArgsAndTextData
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func writeCommandArgsAndTextData(t *testing.T, pl *pktline.Pktline, command string, args []string, data []string) {
Method Client.GetPersonalAccessToken
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (c *Client) GetPersonalAccessToken(ctx context.Context, args *commandargs.Shell, name string, scopes *[]string, expiresAt string) (*Response, error) {
Function writeCommandArgsAndBinaryData
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func writeCommandArgsAndBinaryData(t *testing.T, pl *pktline.Pktline, command string, args []string, data [][]byte) {
Method Client.getRequestBody
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (c *Client) getRequestBody(ctx context.Context, args *commandargs.Shell, name string, scopes *[]string, expiresAt string) (*RequestBody, error) {
Function listLocks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func listLocks(cursor string, limit int, refspec string, id string, path string) (locks []*LockInfo, nextCursor string) {
Method Client.Audit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (c *Client) Audit(ctx context.Context, username string, action commandargs.CommandType, repo string, packfileStats *pb.PackfileNegotiationStatistics) error {
Method Client.Batch
has 5 return statements (exceeds 4 allowed). Open
func (c *Client) Batch(operation string, reqObjects []*BatchObject, ref string, reqHashAlgo string) (*BatchResponse, error) {
// FIXME: This causes tests to fail
// if ref == "" {
// return nil, errors.New("A ref must be specified.")
// }