vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Function Filters has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

const Filters = ({ filters, onUpdate }: FiltersProps) => {
  const { t } = useTranslation();

  // activeMenu controls which popover component is opened (there are
  // separate popovers triggered by the respective buttons)
Severity: Minor
Found in ui/src/pages/namespace/Instances/components/Filters/index.tsx - About 1 hr 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 InstancesBreadcrumb has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const InstancesBreadcrumb = () => {
  const pages = usePages();
  const namespace = useNamespace();
  const { isInstancePage, isInstanceDetailPage, instance } =
    pages.instances.useParams();
Severity: Minor
Found in ui/src/components/Breadcrumb/InstancesBreadcrumb.tsx - About 1 hr to fix

    Method JSOutboundPlugin.Execute has 67 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (js *JSOutboundPlugin) Execute(w http.ResponseWriter, r *http.Request) *http.Request {
        var (
            err error
            b   []byte
        )
    Severity: Minor
    Found in pkg/gateway/plugins/outbound/js_outbound.go - About 1 hr to fix

      Method nsController.create has 67 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (e *nsController) create(w http.ResponseWriter, r *http.Request) {
          // Parse request.
      
          req := struct {
              Name   string `json:"name"`
      Severity: Minor
      Found in pkg/api/namespaces.go - About 1 hr to fix

        Function useParams has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              useParams: () => {
                const { "*": path, namespace } = useParams();
                const [, , thirdLvl, fourthLvl] = useMatches(); // first level is namespace level
                const [searchParams] = useSearchParams();
        
        
        Severity: Minor
        Found in ui/src/util/router/pages.tsx - About 1 hr to fix

          Function MirrorBreadcrumb has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const MirrorBreadcrumb = () => {
            const pages = usePages();
            const namespace = useNamespace();
            const { isMirrorPage, isSyncDetailPage, sync } = pages.mirror.useParams();
            const { icon: Icon } = pages.mirror;
          Severity: Minor
          Found in ui/src/components/Breadcrumb/MirrorBreadcrumb.tsx - About 1 hr to fix

            Function ExplorerHeader has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ExplorerHeader: FC = () => {
              const pages = usePages();
              const namespace = useNamespace();
              const { path } = pages.explorer.useParams();
            
            
            Severity: Minor
            Found in ui/src/pages/namespace/Explorer/Tree/Header.tsx - About 1 hr to fix

              Function InputOutput has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const InputOutput = () => {
                const instanceId = useInstanceId();
                const { data } = useInstanceDetails({ instanceId });
                const tabs = ["input", "output"] as const;
              
              
              Severity: Minor
              Found in ui/src/pages/namespace/Instances/Detail/Main/InputOutput/index.tsx - About 1 hr to fix

                Method parallelLogic.processActionResults has 18 return statements (exceeds 4 allowed).
                Open

                func (logic *parallelLogic) processActionResults(ctx context.Context, children []*ChildInfo, results *actionResultPayload) (*Transition, error) {
                    var err error
                
                    var found bool
                    var idx int
                Severity: Major
                Found in pkg/flow/states/parallel.go - About 1 hr to fix

                  Method fsController.createFile has 66 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

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

                    Function JqState has 65 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func JqState(l *lexer.L) lexer.StateFunc {
                        src := make([]string, 3)
                        var jdxJ int
                    
                        mover := func(rewind int, forward bool) {
                    Severity: Minor
                    Found in pkg/jqer/jqer.go - About 1 hr to fix

                      Function useApiCommandTemplate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export const useApiCommandTemplate = (namespace: string, workflow: string) => {
                        const baseUrl = window.location.origin;
                        const memoizedTemplates: TemplateType[] = useMemo(
                          () => [
                            {
                      Severity: Minor
                      Found in ui/src/pages/namespace/Explorer/Workflow/ApiCommands/utils.ts - About 1 hr to fix

                        Method engine.doKnativeHTTPRequest has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (engine *engine) doKnativeHTTPRequest(ctx context.Context,
                            ar *functionRequest, arReq *enginerefactor.ActionRequest,
                        ) {
                            ctx, spanEnd, err := tracing.NewSpan(ctx, "executing knative request to action")
                            if err != nil {
                        Severity: Minor
                        Found in pkg/flow/temporary.go - About 1 hr 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 nsController.update has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring.
                        Open

                        func (e *nsController) update(w http.ResponseWriter, r *http.Request) {
                            name := chi.URLParam(r, "name")
                        
                            db, err := e.db.BeginTx(r.Context())
                            if err != nil {
                        Severity: Minor
                        Found in pkg/api/namespaces.go - About 1 hr 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 appendEventListenersToDB has 64 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func appendEventListenersToDB(ctx context.Context, nsID uuid.UUID, nsName string, file *filestore.File, lifespan time.Duration, ms *muxStart, tx *database.SQLStore) error {
                            fEv := &datastore.EventListener{
                                ID:                       uuid.New(),
                                CreatedAt:                time.Now().UTC(),
                                UpdatedAt:                time.Now().UTC(),
                        Severity: Minor
                        Found in pkg/flow/db-events.go - About 1 hr to fix

                          Function ScrollContainer has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const ScrollContainer = () => {
                            const instanceId = useInstanceId();
                            const { data: instanceDetailsData } = useInstanceDetails({ instanceId });
                            const isStreaming = instanceDetailsData?.status === "pending";
                            const {

                            Method engine.EventsInvoke has 63 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (engine *engine) EventsInvoke(tctx context.Context, workflowID uuid.UUID, events ...*cloudevents.Event) {
                                ctx := context.Background()
                            
                                tx, err := engine.flow.beginSQLTx(ctx)
                                if err != nil {
                            Severity: Minor
                            Found in pkg/flow/engine.go - About 1 hr to fix

                              Function PermissionsHint has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const PermissionsHint = () => {
                                const { data: availablePermissions } = usePermissionKeys();
                                const permissionsAvailable = (availablePermissions ?? []).length > 0;
                                const { t } = useTranslation();
                                return (
                              Severity: Minor
                              Found in ui/src/pages/namespace/Permissions/components/PermissionsHint.tsx - About 1 hr to fix

                                Method instController.handleWait has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (e *instController) handleWait(ctx context.Context, w http.ResponseWriter, r *http.Request, data *instancestore.InstanceData) {
                                    var err error
                                
                                    id := data.ID
                                    dt := time.Millisecond * 100
                                Severity: Minor
                                Found in pkg/api/instances.go - About 1 hr to fix

                                  Function LoadResource has 62 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func LoadResource(data []byte) (interface{}, error) {
                                      m := make(map[string]interface{})
                                      err := yaml.Unmarshal(data, &m)
                                      if err != nil {
                                          return nil, fmt.Errorf("%w: %w", ErrNotDirektivAPIResource, err)
                                  Severity: Minor
                                  Found in pkg/model/resources.go - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language