vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Method logController.stream has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
Open

func (m logController) stream(w http.ResponseWriter, r *http.Request) {
    // cursor is set to multiple seconds before the current time to mitigate data loss
    // that may occur due to delays between submitting and processing the request, or when a sequence of client requests is necessary.
    cursor := time.Now().UTC().Add(-time.Second * 3)

Severity: Minor
Found in pkg/api/plattformlogs.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

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

func writeFileStoreError(w http.ResponseWriter, err error) {
    if errors.Is(err, filestore.ErrNotFound) {
        writeError(w, &Error{
            Code:    "resource_not_found",
            Message: "filesystem path is not found",
Severity: Major
Found in pkg/api/errors.go - About 35 mins to fix

    Method logController.mountRouter has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
    Open

    func (m *logController) mountRouter(r chi.Router) {
        r.Get("/subscribe", m.stream)
    
        r.Get("/", func(w http.ResponseWriter, r *http.Request) {
            params := extractLogRequestParams(r)
    Severity: Minor
    Found in pkg/api/plattformlogs.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 ActionDefinition.Validate has 5 return statements (exceeds 4 allowed).
    Open

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

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

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

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

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

          Method seeWorker.start has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
          Open

          func (lw *seeWorker) start(ctx context.Context) {
              go func() {
                  ticker := time.NewTicker(lw.Interval)
                  defer ticker.Stop()
                  defer close(lw.Ch)
          Severity: Minor
          Found in pkg/api/sse_helper.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

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

          func LoadInstanceTelemetryInfo(data []byte) (*InstanceTelemetryInfo, error) {
              m := make(map[string]interface{})
          
              err := json.Unmarshal(data, &m)
              if err != nil {
          Severity: Major
          Found in pkg/engine/telemetry-info.go - About 35 mins to fix

            Method sqlEventListenerStore.Get has 5 return statements (exceeds 4 allowed).
            Open

            func (s *sqlEventListenerStore) Get(ctx context.Context, namespace uuid.UUID, limit int, offset int) ([]*datastore.EventListener, int, error) {
                q := `SELECT 
                id, namespace_id, namespace, created_at, updated_at, deleted, received_events, trigger_type, events_lifespan, event_types, trigger_info, metadata, event_context_filters
                FROM event_listeners WHERE namespace_id = $1 `
                q += " ORDER BY created_at DESC "
            Severity: Major
            Found in pkg/datastore/datastoresql/eventstore_listener.go - About 35 mins to fix

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

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

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

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

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

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

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

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

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

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

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

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

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

                          const ServicePage: FC = () => {
                            const pages = usePages();
                            const { path } = pages.explorer.useParams();
                            const namespace = useNamespace();
                            const { segments } = analyzePath(path);
                          Severity: Minor
                          Found in ui/src/pages/namespace/Explorer/Service/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

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

                          const FileViewer = ({ file }: { file: BaseFileSchemaType }) => {
                            const { t } = useTranslation();
                            const theme = useTheme();
                            const { data } = useFile({ path: file.path });
                          
                          
                          Severity: Minor
                          Found in ui/src/pages/namespace/Explorer/Tree/components/modals/FileViewer.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

                          Avoid too many return statements within this function.
                          Open

                            return [...startSegment, ...activeSegment, ...endSegment];
                          Severity: Major
                          Found in ui/src/components/Pagination/describePagination.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return (
                                  <Card className="m-5 flex grow">
                                    <NoPermissions>{noPermissionMessage}</NoPermissions>
                                  </Card>
                                );
                            Severity: Major
                            Found in ui/src/pages/namespace/Explorer/Service/index.tsx - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                if (!servicesList) return null;
                              Severity: Major
                              Found in ui/src/pages/namespace/Explorer/Service/index.tsx - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language