vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Method engine.Transition has 82 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (engine *engine) Transition(ctx context.Context, im *instanceMemory, nextState string, attempt int) *states.Transition {
    ctx, cleanup, err := tracing.NewSpan(ctx, "engine transitions: "+nextState)
    if err != nil {
        slog.Debug("transition failed to init telemetry", "error", err)
    }
Severity: Major
Found in pkg/flow/engine.go - About 2 hrs to fix

    Function EndpointPage has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const EndpointPage: FC = () => {
      const pages = usePages();
      const { path } = pages.explorer.useParams();
      const namespace = useNamespace();
      const { segments } = analyzePath(path);
    Severity: Major
    Found in ui/src/pages/namespace/Explorer/Endpoint/index.tsx - About 2 hrs to fix

      Function JqState has a Cognitive Complexity of 32 (exceeds 20 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 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

      Method events.handleEvent has 81 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (events *events) handleEvent(ctx context.Context, ns *datastore.Namespace, ce *cloudevents.Event) error {
          ctx = tracing.WithTrack(tracing.AddNamespace(ctx, ns.Name), tracing.BuildNamespaceTrack(ns.Name))
          ctx, end, err := tracing.NewSpan(ctx, "handling event-messages")
          if err != nil {
              slog.Debug("GetListenersByTopic failed to init telemetry", "error", err)
      Severity: Major
      Found in pkg/flow/events.go - About 2 hrs to fix

        Method getterLogic.Run has 81 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (logic *getterLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
            err := scheduleOnce(logic, wakedata)
            if err != nil {
                return nil, err
            }
        Severity: Major
        Found in pkg/flow/states/getter.go - About 2 hrs to fix

          Method instController.getPagination has 81 lines of code (exceeds 50 allowed). Consider refactoring.
          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 2 hrs to fix

            Function ConsumerTable has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const ConsumerTable = () => {
              const { t } = useTranslation();
              const {
                data: consumerList,
                isSuccess,
            Severity: Major
            Found in ui/src/pages/namespace/Gateway/Consumers/Table/index.tsx - About 2 hrs to fix

              Function ServicesListPage has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const ServicesListPage = () => {
                const { t } = useTranslation();
                const {
                  data: serviceList,
                  isFetching,
              Severity: Major
              Found in ui/src/pages/namespace/Services/List/index.tsx - About 2 hrs to fix

                Function generateActionInput has 80 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func generateActionInput(ctx context.Context, args *generateActionInputArgs) ([]byte, []model.FunctionFileDefinition, error) {
                    var err error
                    var input interface{}
                
                    input, err = jqObject(args.Source, "jq(.)") //nolint:contextcheck
                Severity: Major
                Found in pkg/flow/states/action-helpers.go - About 2 hrs to fix

                  Method LocalServer.varHandler has 79 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (srv *LocalServer) varHandler(w http.ResponseWriter, r *http.Request) {
                      actionId := r.URL.Query().Get("aid")
                  
                      srv.requestsLock.Lock()
                      req, ok := srv.requests[actionId]
                  Severity: Major
                  Found in cmd/sidecar/local-server.go - About 2 hrs to fix

                    Function NamespaceSelector has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const NamespaceSelector = () => {
                      const pages = usePages();
                      const { t } = useTranslation();
                      const namespace = useNamespace();
                    
                    
                    Severity: Major
                    Found in ui/src/components/Breadcrumb/NamespaceSelector.tsx - About 2 hrs to fix

                      Function NoMirror has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const NoMirror = () => {
                        const { t } = useTranslation();
                      
                        const docsUrl = "https://docs.direktiv.io/environment/git/";
                        const examplesUrl = "https://github.com/direktiv/direktiv-examples";
                      Severity: Major
                      Found in ui/src/pages/namespace/Mirror/NoMirror/index.tsx - About 2 hrs to fix

                        Function ServicePage has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const ServicePage: FC = () => {
                          const pages = usePages();
                          const { path } = pages.explorer.useParams();
                          const namespace = useNamespace();
                          const { segments } = analyzePath(path);
                        Severity: Major
                        Found in ui/src/pages/namespace/Explorer/Service/index.tsx - About 2 hrs to fix

                          File index.tsx has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import {
                            BookOpen,
                            FileInput,
                            FileOutput,
                            Play,
                          Severity: Minor
                          Found in ui/src/pages/namespace/JqPlayground/index.tsx - About 2 hrs to fix

                            Function Logs has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const Logs = () => {
                              const { t } = useTranslation();
                            
                              const {
                                data: logLines = [],
                            Severity: Major
                            Found in ui/src/pages/namespace/Monitoring/Logs/index.tsx - About 2 hrs to fix

                              Function ListenersList has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const ListenersList = () => {
                                const [offset, setOffset] = useState(0);
                                const { data, isFetched, isAllowed, noPermissionMessage } = useEventListeners(
                                  { limit: pageSize, offset }
                                );
                              Severity: Major
                              Found in ui/src/pages/namespace/Events/Listeners/index.tsx - About 2 hrs to fix

                                Function generateActionInput has a Cognitive Complexity of 31 (exceeds 20 allowed). Consider refactoring.
                                Open

                                func generateActionInput(ctx context.Context, args *generateActionInputArgs) ([]byte, []model.FunctionFileDefinition, error) {
                                    var err error
                                    var input interface{}
                                
                                    input, err = jqObject(args.Source, "jq(.)") //nolint:contextcheck
                                Severity: Minor
                                Found in pkg/flow/states/action-helpers.go - 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 getValidNumber has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function getValidNumber(
                                  value: string,
                                  { max, min = 0, loop = false }: GetValidNumberConfig
                                ) {
                                  let numericValue = parseInt(value, 10);
                                Severity: Minor
                                Found in ui/src/design/Timepicker/utils.ts - 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 InitPubSub has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func InitPubSub(notifier Notifier, database string) (*Pubsub, error) {
                                    reportProblem := func(ev pq.ListenerEventType, err error) {
                                        if err != nil {
                                            slog.Error("PubSub listener encountered an error.", "error", err, "event_type", ev)
                                
                                
                                Severity: Major
                                Found in pkg/flow/pubsub/pubsub.go - About 2 hrs to fix

                                  Function NewMain has 77 lines of code (exceeds 50 allowed). Consider refactoring.
                                  Open

                                  func NewMain(circuit *core.Circuit, args *NewMainArgs) error {
                                      // Create service manager
                                      var err error
                                      var serviceManager core.ServiceManager
                                      if !args.Config.DisableServices {
                                  Severity: Major
                                  Found in pkg/cmd/main.go - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language