Showing 46 of 1,879 total issues
Function TestSSL
has 215 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestSSL(t *testing.T) {
testCases := []TestCase{
{
Definition: Definition{
Function TestSSL
has 212 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestSSL(t *testing.T) {
testCases := []TestCase{
{
Definition: Definition{
Method ServiceConnector.Connect
has a Cognitive Complexity of 58 (exceeds 20 allowed). Consider refactoring. Open
func (h *ServiceConnector) Connect(
credentialValuesByID connector.CredentialValuesByID,
) error {
var err error
var serverConfig ServerConfig
- 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
File protocol.go
has 651 lines of code (exceeds 500 allowed). Consider refactoring. Open
/*
MIT License
Copyright (c) 2017 Aleksandr Fedotov
Function TestProxyService_Start
has 178 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestProxyService_Start(t *testing.T) {
t.Run("stopped proxy service cannot be restarted", func(t *testing.T) {
connector := mock.NewConnector()
credentialRetriever := mock.NewCredentialRetriever()
listener := mock.NewListener()
Function Test_Config
has 165 lines of code (exceeds 70 allowed). Consider refactoring. Open
func Test_Config(t *testing.T) {
t.Run("Reports absence of handlers", func(t *testing.T) {
yaml := `
---
`
Function GenerateConfigurations
has a Cognitive Complexity of 45 (exceeds 20 allowed). Consider refactoring. Open
func GenerateConfigurations() (config_v2.Config, LiveConfigurations) {
// initialised with health-check listener and handler
secretlessConfig := config_v2.Config{
Services: []*config_v2.Service{
{
- 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 TestAllAvailablePlugins
has 140 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestAllAvailablePlugins(t *testing.T) {
t.Run("Assembles internal and external plugins", func(t *testing.T) {
allPlugins, err := AllAvailablePluginsWithOptions(
"",
"",
Function GenerateConfigurations
has 127 lines of code (exceeds 70 allowed). Consider refactoring. Open
func GenerateConfigurations() (config_v2.Config, LiveConfigurations) {
// initialised with health-check listener and handler
secretlessConfig := config_v2.Config{
Services: []*config_v2.Service{
{
Method AuthenticationHandshake.handleBackendAuthResponse
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
func (h *AuthenticationHandshake) handleBackendAuthResponse() {
if h.err != nil {
return
}
- 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 Test_Health
has 124 lines of code (exceeds 70 allowed). Consider refactoring. Open
func Test_Health(t *testing.T) {
t.Run("When nothing is proactively done", func(t *testing.T) {
t.Run("Shows not ready", func(t *testing.T) {
callEnableHealthCheck()
assertHealthStatusCodeIsBad(ReadyEndpoint, t)
Logger
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
type Logger struct {
BackingLogger *stdlib_log.Logger
IsDebug bool
prefix string
}
Function TestConfigEnv
has 115 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestConfigEnv(t *testing.T) {
// Shared mocks and doubles
logger := loggermock.NewLogger()
File protocol_test.go
has 531 lines of code (exceeds 500 allowed). Consider refactoring. Open
/*
MIT License
Copyright (c) 2017 Aleksandr Fedotov
Function TestSingleUseConnector_Connect
has 110 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestSingleUseConnector_Connect(t *testing.T) {
t.Run("singleUseConnector.driver#Connect success", func(t *testing.T) {
expectedBackendConn := mock.DefaultMSSQLConnectorCtor.BackendConn
connector := newSingleUseConnectorWithOptions(
Function process_log
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def process_log(logfile_path, baseline_backend):
percentages = {}
baselines = []
with open(logfile_path) as log_file:
for line in log_file:
- 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 TestEssentials
has 99 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestEssentials(t *testing.T) {
testCases := []Definition{
{
Description: "with username, wrong password",
ShouldPass: true,
Function TestEssentials
has 98 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestEssentials(t *testing.T) {
testCases := []Definition{
{
Description: "with username, wrong password",
ShouldPass: true,
Method ServiceConnector.Connect
has 92 lines of code (exceeds 70 allowed). Consider refactoring. Open
func (h *ServiceConnector) Connect(
credentialValuesByID connector.CredentialValuesByID,
) error {
var err error
var serverConfig ServerConfig
Function TestExternalPlugins
has 89 lines of code (exceeds 70 allowed). Consider refactoring. Open
func TestExternalPlugins(t *testing.T) {
t.Run("Assembles external plugins", func(t *testing.T) {
externalPlugins, err := ExternalPluginsWithOptions(
"",
"",