vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Function EventsPage has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const EventsPage = () => {
  const pages = usePages();
  const namespace = useNamespace();
  const { t } = useTranslation();
  const { isEventsHistoryPage, isEventsListenersPage } =
Severity: Major
Found in ui/src/pages/namespace/Events/index.tsx - About 2 hrs to fix

    Function GatewayPage has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method engine.newIsolateRequest has 75 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (engine *engine) newIsolateRequest(im *instanceMemory, stateID string, timeout int,
          fn model.FunctionDefinition, inputData []byte,
          uid uuid.UUID, async bool, files []model.FunctionFileDefinition, iterator int,
      ) (*functionRequest, *enginerefactor.ActionRequest, error) {
          ar := new(functionRequest)
      Severity: Minor
      Found in pkg/flow/temporary.go - About 2 hrs to fix

        Method instanceDataQuery.UpdateInstanceData has 74 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (q *instanceDataQuery) UpdateInstanceData(ctx context.Context, args *instancestore.UpdateInstanceDataArgs) error {
            var vals []interface{}
            var clauses []string
            query := fmt.Sprintf("UPDATE %s", table)
        
        
        Severity: Minor
        Found in pkg/instancestore/instancestoresql/instance_data_query.go - About 1 hr to fix

          Function UpdateWorkflow has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export const UpdateWorkflow = () => {
            const [workflow, setWorkflow] = useState(exampleWorkflow);
            const [orientation, setOrientation] = useState<Orientation>("horizontal");
          
            return (
          Severity: Minor
          Found in ui/src/design/WorkflowDiagram/index.stories.tsx - About 1 hr to fix

            Function useEventSource has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            export const useEventSource = ({
              url,
              apiKey,
              onOpen,
              onMessage,
            Severity: Minor
            Found in ui/src/api/streaming.ts - 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 setterLogic.Run has 72 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (logic *setterLogic) Run(ctx context.Context, wakedata []byte) (*Transition, error) {
                err := scheduleOnce(logic, wakedata)
                if err != nil {
                    return nil, err
                }
            Severity: Minor
            Found in pkg/flow/states/setter.go - About 1 hr to fix

              Method logController.mountRouter has 72 lines of code (exceeds 50 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 1 hr to fix

                Method instanceMemory.GetVariables has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (im *instanceMemory) GetVariables(ctx context.Context, vars []states.VariableSelector) ([]states.Variable, error) {
                    x := make([]states.Variable, 0)
                
                    tx, err := im.engine.flow.beginSQLTx(ctx)
                    if err != nil {
                Severity: Minor
                Found in pkg/flow/temporary.go - About 1 hr to fix

                  Method Pubsub.flush has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (pubsub *Pubsub) flush() {
                      slice := pubsub.buffer[:pubsub.bufferIdx]
                      clusterMessages := make([]string, pubsub.bufferIdx)
                      messageIndex := 0
                      pubsub.bufferIdx = 0
                  Severity: Minor
                  Found in pkg/flow/pubsub/pubsub.go - About 1 hr to fix

                    Method LocalServer.logHandler has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

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

                      Method flow.cronHandler has 71 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func (flow *flow) cronHandler(data []byte) {
                          ctx := context.Background()
                      
                          t := time.Now().Truncate(time.Minute).UTC()
                      
                      
                      Severity: Minor
                      Found in pkg/flow/routing.go - About 1 hr to fix

                        Function ConsumerPage has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const ConsumerPage: 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/Consumer/index.tsx - About 1 hr to fix

                          Function Run has 70 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func Run(circuit *core.Circuit) error {
                              config := &core.Config{}
                              if err := env.Parse(config); err != nil {
                                  return fmt.Errorf("parsing env variables: %w", err)
                              }
                          Severity: Minor
                          Found in pkg/flow/server.go - About 1 hr to fix

                            Method sqlRuntimeVariablesStore.Set has 70 lines of code (exceeds 50 allowed). Consider refactoring.
                            Open

                            func (s *sqlRuntimeVariablesStore) Set(ctx context.Context, variable *datastore.RuntimeVariable) (*datastore.RuntimeVariable, error) {
                                if variable.Name == "" {
                                    return nil, datastore.ErrInvalidRuntimeVariableName
                                }
                                if matched, _ := regexp.MatchString(datastore.RuntimeVariableNameRegexPattern, variable.Name); !matched {
                            Severity: Minor
                            Found in pkg/datastore/datastoresql/runtime_variables.go - About 1 hr to fix

                              Method JSInboundPlugin.Execute has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

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

                                Method RootQuery.CreateFile has 69 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func (q *RootQuery) CreateFile(ctx context.Context, path string, typ filestore.FileType, mimeType string, data []byte) (*filestore.File, error) {
                                    path, err := filestore.SanitizePath(path)
                                    if err != nil {
                                        return nil, fmt.Errorf("%w: %w", filestore.ErrInvalidPathParameter, err)
                                    }
                                Severity: Minor
                                Found in pkg/filestore/filestoresql/root_query.go - About 1 hr to fix

                                  Function ComplexWorkflowDiagram has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export const ComplexWorkflowDiagram = () => {
                                    const allStates = [
                                      "validate-input-2",
                                      "request-prediction",
                                      "evaluate-created-prediction",
                                  Severity: Minor
                                  Found in ui/src/design/WorkflowDiagram/index.stories.tsx - About 1 hr to fix

                                    Function WorkflowDiagram has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export default function WorkflowDiagram(props: WorkflowDiagramProps) {
                                      const {
                                        workflow,
                                        flow = [],
                                        instanceStatus = "pending",
                                    Severity: Minor
                                    Found in ui/src/design/WorkflowDiagram/index.tsx - About 1 hr to fix

                                      Method instController.list has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      func (e *instController) list(w http.ResponseWriter, r *http.Request) {
                                          ctx := r.Context()
                                          ns := extractContextNamespace(r)
                                      
                                          pagination, err := e.getPagination(r)
                                      Severity: Minor
                                      Found in pkg/api/instances.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language