vorteil/direktiv

View on GitHub

Showing 425 of 1,264 total issues

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 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 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 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 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

          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 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 jq has 5 return statements (exceeds 4 allowed).
            Open

            func jq(input interface{}, command string) ([]interface{}, error) {
                data, err := json.Marshal(input)
                if err != nil {
                    return nil, err
                }
            Severity: Major
            Found in pkg/jqer/jqer.go - About 35 mins to fix

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

              func (s *sqlEventListenerStore) Append(ctx context.Context, listener *datastore.EventListener) error {
                  q := `INSERT INTO event_listeners
                   (id, namespace_id, namespace, created_at, updated_at, deleted, received_events, trigger_type, events_lifespan, event_types, trigger_info, metadata, event_context_filters) 
                    VALUES ( $1 , $2 , $3 , $4 , $5 , $6 , $7 , $8 , $9 , $10 , $11, $12, $13);`
              
              
              Severity: Major
              Found in pkg/datastore/datastoresql/eventstore_listener.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

                  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

                    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

                      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

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

                      const ExplorerPage: FC = () => {
                        const pages = usePages();
                        const namespace = useNamespace();
                        const { path } = pages.explorer.useParams();
                        const { data, isSuccess, isFetched, isAllowed, noPermissionMessage } =
                      Severity: Minor
                      Found in ui/src/pages/namespace/Explorer/Tree/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 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

                      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

                          if (!servicesList) return null;
                        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

                              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

                                return (
                                  <Card className="m-5 flex grow">
                                    <NoPermissions>{noPermissionMessage}</NoPermissions>
                                  </Card>
                                );
                            Severity: Major
                            Found in ui/src/pages/namespace/Explorer/Consumer/index.tsx - 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/Endpoint/index.tsx - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language