cyberark/secretless-broker

View on GitHub

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{
Severity: Major
Found in test/connector/tcp/pg/tests/ssl_test.go - About 6 hrs to fix

    Function TestSSL has 212 lines of code (exceeds 70 allowed). Consider refactoring.
    Open

    func TestSSL(t *testing.T) {
    
        testCases := []TestCase{
            {
                Definition: Definition{
    Severity: Major
    Found in test/connector/tcp/mysql/tests/ssl_test.go - About 6 hrs to fix

      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
      Severity: Minor
      Found in internal/plugin/connectors/ssh/service_connector.go - About 6 hrs to fix

      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
      
      
      Severity: Minor
      Found in internal/plugin/connectors/tcp/mysql/protocol/protocol.go - About 5 hrs to fix

        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()
        Severity: Major
        Found in internal/plugin/connectors/tcp/proxy_service_test.go - About 5 hrs to fix

          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 := `
          ---
          `
          Severity: Major
          Found in pkg/secretless/config/config_test.go - About 4 hrs to fix

            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{
                        {
            Severity: Minor
            Found in test/util/testutil/config_generator.go - About 4 hrs to fix

            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(
                        "",
                        "",
            Severity: Major
            Found in pkg/secretless/plugin/sharedobj/available_plugins_test.go - About 3 hrs to fix

              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{
                          {
              Severity: Major
              Found in test/util/testutil/config_generator.go - About 3 hrs to fix

                Method AuthenticationHandshake.handleBackendAuthResponse has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
                Open

                func (h *AuthenticationHandshake) handleBackendAuthResponse() {
                    if h.err != nil {
                        return
                    }
                
                
                Severity: Minor
                Found in internal/plugin/connectors/tcp/mysql/authentication_handshake.go - About 3 hrs to fix

                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)
                Severity: Major
                Found in internal/util/health_test.go - About 3 hrs to fix

                  Logger has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  type Logger struct {
                      BackingLogger *stdlib_log.Logger
                      IsDebug       bool
                      prefix        string
                  }
                  Severity: Minor
                  Found in internal/log/log.go - About 2 hrs to fix

                    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()
                    Severity: Major
                    Found in pkg/secretless/config/v2/config_env_test.go - About 2 hrs to fix

                      File protocol_test.go has 531 lines of code (exceeds 500 allowed). Consider refactoring.
                      Open

                      /*
                      MIT License
                      
                      Copyright (c) 2017 Aleksandr Fedotov
                      
                      
                      Severity: Minor
                      Found in internal/plugin/connectors/tcp/mysql/protocol/protocol_test.go - About 2 hrs to fix

                        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(
                        Severity: Major
                        Found in internal/plugin/connectors/tcp/mssql/connector_test.go - About 2 hrs to fix

                          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:
                          Severity: Minor
                          Found in bin/juxtaposer/aggregate.py - About 2 hrs to fix

                          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,
                          Severity: Major
                          Found in test/connector/tcp/pg/tests/essentials_test.go - About 2 hrs to fix

                            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,
                            Severity: Major
                            Found in test/connector/tcp/mysql/tests/essentials_test.go - About 2 hrs to fix

                              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
                              Severity: Major
                              Found in internal/plugin/connectors/ssh/service_connector.go - About 1 hr to fix

                                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(
                                            "",
                                            "",
                                Severity: Major
                                Found in pkg/secretless/plugin/sharedobj/external_plugins_test.go - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language