vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Method SubflowFunctionDefinition.Validate has 5 return statements (exceeds 4 allowed).
Open

func (o *SubflowFunctionDefinition) Validate() error {
    if o == nil {
        return nil
    }

Severity: Major
Found in pkg/model/function-subflow.go - About 35 mins to fix

    Method SwitchState.Validate has 5 return statements (exceeds 4 allowed).
    Open

    func (o *SwitchState) Validate() error {
        if err := o.commonValidate(); err != nil {
            return err
        }
    
    
    Severity: Major
    Found in pkg/model/state-switch.go - About 35 mins to fix

      Method sqlSecretsStore.Set has 5 return statements (exceeds 4 allowed).
      Open

      func (s sqlSecretsStore) Set(ctx context.Context, secret *datastore.Secret) error {
          var res *gorm.DB
          x, err := s.Get(ctx, secret.Namespace, secret.Name)
          //nolint:nestif
          if errors.Is(err, datastore.ErrNotFound) {
      Severity: Major
      Found in pkg/datastore/datastoresql/secrets.go - About 35 mins to fix

        Function renderServiceManager has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
        Open

        func renderServiceManager(db *database.SQLStore, serviceManager core.ServiceManager) {
            ctx := context.Background()
            slog := slog.With("subscriber", "services file watcher")
        
            fStore, dStore := db.FileStore(), db.DataStore()
        Severity: Minor
        Found in pkg/cmd/main.go - About 35 mins 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

        Method NamespacedFunctionDefinition.Validate has 5 return statements (exceeds 4 allowed).
        Open

        func (o *NamespacedFunctionDefinition) Validate() error {
            if o == nil {
                return nil
            }
        
        
        Severity: Major
        Found in pkg/model/function-namespaced.go - About 35 mins to fix

          Method SetterState.Validate has 5 return statements (exceeds 4 allowed).
          Open

          func (o *SetterState) Validate() error {
              if err := o.commonValidate(); err != nil {
                  return err
              }
          
          
          Severity: Major
          Found in pkg/model/state-setter.go - About 35 mins to fix

            Method instController.getPagination has 5 return statements (exceeds 4 allowed).
            Open

            func (e *instController) getPagination(r *http.Request) (*paginationOptions, error) {
                opts := new(paginationOptions)
            
                x := r.URL.Query().Get("limit")
                if x != "" {
            Severity: Major
            Found in pkg/api/instances.go - About 35 mins to fix

              Function ParseEndpointFile has 5 return statements (exceeds 4 allowed).
              Open

              func ParseEndpointFile(ns string, filePath string, data []byte) Endpoint {
                  res := &EndpointFile{}
                  err := yaml.Unmarshal(data, res)
                  if err != nil {
                      return Endpoint{
              Severity: Major
              Found in pkg/core/gateway.go - About 35 mins to fix

                Method GetterState.Validate has 5 return statements (exceeds 4 allowed).
                Open

                func (o *GetterState) Validate() error {
                    if err := o.commonValidate(); err != nil {
                        return err
                    }
                
                
                Severity: Major
                Found in pkg/model/state-getter.go - About 35 mins to fix

                  Function InitTelemetry has 5 return statements (exceeds 4 allowed).
                  Open

                  func InitTelemetry(cirCtx context.Context, addr string, svcName, imName string) (func(), error) {
                      slog.Debug("Initializing telemetry.", "instrumentationName", imName)
                      instrumentationName = imName
                  
                      // Setup context propagation format
                  Severity: Major
                  Found in pkg/tracing/telemetry.go - About 35 mins to fix

                    Method fsController.readRaw has 5 return statements (exceeds 4 allowed).
                    Open

                    func (e *fsController) readRaw(w http.ResponseWriter, r *http.Request) {
                        ns := extractContextNamespace(r)
                    
                        db, err := e.db.BeginTx(r.Context())
                        if err != nil {
                    Severity: Major
                    Found in pkg/api/filesystem.go - About 35 mins to fix

                      Method fsController.read has 5 return statements (exceeds 4 allowed).
                      Open

                      func (e *fsController) read(w http.ResponseWriter, r *http.Request) {
                          // handle raw file read.
                          if r.URL.Query().Get("raw") == "true" {
                              e.readRaw(w, r)
                              return
                      Severity: Major
                      Found in pkg/api/filesystem.go - About 35 mins to fix

                        Method varController.getRaw has 5 return statements (exceeds 4 allowed).
                        Open

                        func (e *varController) getRaw(w http.ResponseWriter, r *http.Request) {
                            id, err := uuid.Parse(chi.URLParam(r, "variableID"))
                            if err != nil {
                                w.WriteHeader(http.StatusBadRequest)
                                return
                        Severity: Major
                        Found in pkg/api/variables.go - About 35 mins to fix

                          Function Authdialog has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const Authdialog = () => {
                            const { t } = useTranslation();
                            const [showKey, setShowKey] = useState(false);
                            const { setApiKey: storeApiKey } = useApiActions();
                            const apiKeyFromLocalStorage = useApiKey();
                          Severity: Minor
                          Found in ui/src/components/Authdialog/index.tsx - About 35 mins 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

                          Method FileQuery.SetData has 5 return statements (exceeds 4 allowed).
                          Open

                          func (q *FileQuery) SetData(ctx context.Context, data []byte) (string, error) {
                              if q.file.Typ == filestore.FileTypeDirectory {
                                  return "", filestore.ErrFileTypeIsDirectory
                              }
                          
                          
                          Severity: Major
                          Found in pkg/filestore/filestoresql/file_query.go - About 35 mins to fix

                            Method fsController.delete has 5 return statements (exceeds 4 allowed).
                            Open

                            func (e *fsController) delete(w http.ResponseWriter, r *http.Request) {
                                ns := extractContextNamespace(r)
                            
                                db, err := e.db.BeginTx(r.Context())
                                if err != nil {
                            Severity: Major
                            Found in pkg/api/filesystem.go - About 35 mins to fix

                              Function extractEventFilterParams has 5 return statements (exceeds 4 allowed).
                              Open

                              func extractEventFilterParams(r *http.Request) ([]string, error) {
                                  params := make([]string, 0)
                                  if v := chi.URLParam(r, "namespace"); v != "" {
                                      params = append(params, "namespace")
                                      params = append(params, v)
                              Severity: Major
                              Found in pkg/api/events.go - About 35 mins to fix

                                Method secretsController.update has 5 return statements (exceeds 4 allowed).
                                Open

                                func (e *secretsController) update(w http.ResponseWriter, r *http.Request) {
                                    ns := extractContextNamespace(r)
                                    secretName := chi.URLParam(r, "secretName")
                                
                                    db, err := e.db.BeginTx(r.Context())
                                Severity: Major
                                Found in pkg/api/secrets.go - About 35 mins to fix

                                  Method sqlNamespacesStore.Create has 5 return statements (exceeds 4 allowed).
                                  Open

                                  func (s *sqlNamespacesStore) Create(ctx context.Context, namespace *datastore.Namespace) (*datastore.Namespace, error) {
                                      const nameRegex = `^(([a-z][a-z0-9_\-\.]*[a-z0-9])|([a-z]))$`
                                      matched, _ := regexp.MatchString(nameRegex, namespace.Name)
                                      if !matched {
                                          return nil, datastore.ErrInvalidNamespaceName
                                  Severity: Major
                                  Found in pkg/datastore/datastoresql/namespaces.go - About 35 mins to fix

                                    Function ParseStateType has 5 return statements (exceeds 4 allowed).
                                    Open

                                    func ParseStateType(s string) (StateType, error) {
                                        if s == "" {
                                            return 0, fmt.Errorf("type must be one of %v", stateTypeStrings)
                                        }
                                    
                                    
                                    Severity: Major
                                    Found in pkg/model/enums.go - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language