Showing 59 of 80 total issues
Function initialize
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func initialize(t *testing.T) []testserver.TestRequestHandler {
handler := func(w http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body)
defer r.Body.Close()
Function initialize
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
func initialize(t *testing.T) {
requests = []testserver.TestRequestHandler{
{
Path: "/api/v4/internal/personal_access_token",
Handler: func(w http.ResponseWriter, r *http.Request) {
Method mock_server
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock_server(server)
server.mount_proc('/api/v4/internal/lfs_authenticate') do |req, res|
res.content_type = 'application/json'
key_id = req.query['key_id'] || req.query['user_id']
Function buildRequests
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func buildRequests(t *testing.T, relativeURLRoot string) []testserver.TestRequestHandler {
requests := []testserver.TestRequestHandler{
{
Path: "/api/v4/internal/hello",
Handler: func(w http.ResponseWriter, r *http.Request) {
Method mock_server
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def mock_server(server)
server.mount_proc('/api/v4/internal/two_factor_manual_otp_check') do |req, res|
res.content_type = 'application/json'
res.status = 200
Method session.handleShell
has 55 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *session) handleShell(ctx context.Context, req *ssh.Request) (context.Context, uint32, error) {
ctxlog := log.ContextLogger(ctx)
if req.WantReply {
if err := req.Reply(true, []byte{}); err != nil {
Function initialize
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func initialize(t *testing.T) {
requests = []testserver.TestRequestHandler{
{
Path: "/api/v4/internal/two_factor_recovery_codes",
Handler: func(w http.ResponseWriter, r *http.Request) {
Function TestLfsTransferBatchDownload
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestLfsTransferBatchDownload(t *testing.T) {
url, cmd, pl, _ := setup(t, "rw", "group/repo", "download")
wg := setupWaitGroupForExecute(t, cmd)
negotiateVersion(t, pl)
Function TestHandleExec
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestHandleExec(t *testing.T) {
testCases := []struct {
desc string
payload []byte
expectedErr error
Function main
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
command.CheckForVersionFlag(os.Args, Version, BuildTime)
flag.Parse()
Method serverConfig.get
has 53 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s *serverConfig) get(ctx context.Context) *ssh.ServerConfig {
var gssapiWithMICConfig *ssh.GSSAPIWithMICConfig
if s.cfg.Server.GSSAPI.Enabled {
gssApiServer, _ := NewGSSAPIServer(&s.cfg.Server.GSSAPI)
Method mock_server
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def mock_server(server)
server.mount_proc('/api/v4/internal/two_factor_recovery_codes') 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
Function setup
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func setup(t *testing.T) []testserver.TestRequestHandler {
waitInfinitely := make(chan struct{})
requests := []testserver.TestRequestHandler{
{
Path: "/api/v4/internal/two_factor_manual_otp_check",
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 TestExecuteEOFSent
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestExecuteEOFSent(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 TestExecuteNoEOFSent
has 51 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestExecuteNoEOFSent(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_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 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
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)
}