vorteil/direktiv

View on GitHub

Showing 407 of 1,235 total issues

Method instController.list has 105 lines of code (exceeds 50 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: Major
Found in pkg/api/instances.go - About 3 hrs to fix

    Method nsController.update has 105 lines of code (exceeds 50 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: Major
    Found in pkg/api/namespaces.go - About 3 hrs to fix

      Function Header has 79 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Header = () => {
        const pages = usePages();
        const namespace = useNamespace();
        const { routePath } = pages.gateway.useParams();
        const { data: route } = useRoute({
      Severity: Major
      Found in ui/src/pages/namespace/Gateway/Routes/Detail/Header.tsx - About 3 hrs to fix

        Function buildRouter has 101 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func buildRouter(endpoints []core.Endpoint, consumers []core.Consumer) *router {
            serveMux := http.NewServeMux()
        
            checkUniqueGatewayPaths := map[string]string{}
        
        
        Severity: Major
        Found in pkg/gateway/router.go - About 3 hrs to fix

          Method fsController.updateFile has 100 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (e *fsController) updateFile(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 3 hrs to fix

            Function initLegacyServer has 99 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func initLegacyServer(circuit *core.Circuit, config *core.Config, db *gorm.DB, dbManager *database.SQLStore) (*server, error) {
                srv := new(server)
                srv.ID = uuid.New()
                srv.initJQ()
                srv.config = config
            Severity: Major
            Found in pkg/flow/server.go - About 2 hrs to fix

              Function recurseIntoString has 95 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func recurseIntoString(data interface{}, s string) ([]interface{}, error) {
                  out := make([]interface{}, 0)
              
                  if TrimWhitespaceOnQueryStrings {
                      s = strings.TrimSpace(s)
              Severity: Major
              Found in pkg/jqer/jqer.go - About 2 hrs to fix

                Function Default has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const Default = () => {
                  const [pageSize, setPageSize] = useState(3);
                  return (
                    <div
                      className="flex flex-col items-center space-y-5 p-5
                Severity: Major
                Found in ui/src/components/PaginationProvider/index.stories.tsx - About 2 hrs to fix

                  Method instanceMemory.GetVariables has a Cognitive Complexity of 35 (exceeds 20 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 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 jxController.handler has 92 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func (c *jxController) handler(w http.ResponseWriter, r *http.Request) {
                      data, err := io.ReadAll(r.Body)
                      if err != nil {
                          return
                      }
                  Severity: Major
                  Found in pkg/api/jx.go - About 2 hrs to fix

                    Function SendEvent has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const SendEvent = () => {
                      const [body, setBody] = useState<string | undefined>(exampleEvent);
                      const [isOpen, setIsOpen] = useState(false);
                      const theme = useTheme();
                      const { t } = useTranslation();
                    Severity: Major
                    Found in ui/src/pages/namespace/Events/History/SendEvent.tsx - About 2 hrs to fix

                      Function PermissionsPage has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const PermissionsPage = () => {
                        const pages = usePages();
                        const permissions = pages.permissions;
                      
                        const namespace = useNamespace();
                      Severity: Major
                      Found in ui/src/pages/namespace/Permissions/index.tsx - About 2 hrs to fix

                        File codeEditor.spec.ts has 276 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { createNamespace, deleteNamespace } from "../../utils/namespace";
                        import { expect, test } from "@playwright/test";
                        
                        import { createWorkflow } from "../../utils/workflow";
                        import { faker } from "@faker-js/faker";
                        Severity: Minor
                        Found in ui/e2e/explorer/workflow/codeEditor.spec.ts - About 2 hrs to fix

                          Method getterLogic.Run has a Cognitive Complexity of 34 (exceeds 20 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: Minor
                          Found in pkg/flow/states/getter.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 instanceMemory.SetVariables has a Cognitive Complexity of 34 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (im *instanceMemory) SetVariables(ctx context.Context, vars []states.VariableSetter) error {
                              tx, err := im.engine.flow.beginSQLTx(ctx)
                              if err != nil {
                                  return err
                              }
                          Severity: Minor
                          Found in pkg/flow/temporary.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 generateGetInstancesFilters has 89 lines of code (exceeds 50 allowed). Consider refactoring.
                          Open

                          func generateGetInstancesFilters(opts *instancestore.ListOpts) ([]string, []interface{}, error) {
                              if opts == nil {
                                  return []string{}, []interface{}{}, nil
                              }
                          
                          
                          Severity: Major
                          Found in pkg/instancestore/instancestoresql/sql_builders.go - About 2 hrs to fix

                            Method engine.doKnativeHTTPRequest has 88 lines of code (exceeds 50 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: Major
                            Found in pkg/flow/temporary.go - About 2 hrs to fix

                              Function Layout has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const Layout = () => {
                                const { data: version } = useVersion();
                                const namespace = useNamespace();
                                const { setNamespace } = useNamespaceActions();
                                const { namespace: namespaceFromUrl } = useParams();
                              Severity: Major
                              Found in ui/src/pages/namespace/Layout.tsx - About 2 hrs to fix

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

                                import { Plus, X } from "lucide-react";
                                import { Popover, PopoverContent, PopoverTrigger } from "~/design/Popover";
                                
                                import Button from "~/design/Button";
                                import { ButtonBar } from "~/design/ButtonBar";
                                Severity: Minor
                                Found in ui/src/pages/namespace/Events/History/components/Filters/index.tsx - About 2 hrs to fix

                                  File index.spec.ts has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import { createNamespace, deleteNamespace } from "../utils/namespace";
                                  import { expect, test } from "@playwright/test";
                                  
                                  import { createRegistries } from "../utils/registries";
                                  import { createSecrets } from "../utils/secrets";
                                  Severity: Minor
                                  Found in ui/e2e/settings/index.spec.ts - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language