vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            <TooltipProvider>
              <Tooltip>
                <TooltipTrigger>
                  <HelpCircle className="ml-1 h-4 w-4" />
                </TooltipTrigger>
Severity: Major
Found in ui/src/pages/namespace/Services/Detail/Header.tsx and 1 other location - About 1 hr to fix
ui/src/pages/namespace/Explorer/Service/ServiceEditor/Form/index.tsx on lines 90..99

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  const {
    handleSubmit,
    formState: { errors },
    control,
  } = useForm<AclFormSchemaType>({
ui/src/pages/namespace/Explorer/Endpoint/EndpointEditor/Form/plugins/Inbound/HeaderManipulationForm/index.tsx on lines 37..50

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 72.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                            {noResults && (
                              <TableRow className="hover:bg-inherit dark:hover:bg-inherit">
                                <TableCell colSpan={6}>
                                  <NoResult icon={Layers}>
                                    {t("pages.services.list.empty.title")}
                Severity: Major
                Found in ui/src/pages/namespace/Services/List/Table.tsx and 1 other location - About 1 hr to fix
                ui/src/pages/namespace/Mirror/Detail/index.tsx on lines 103..111

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                  {noResults && (
                                    <TableRow className="hover:bg-inherit dark:hover:bg-inherit">
                                      <TableCell colSpan={4}>
                                        <NoResult icon={GitCompare}>
                                          {t("pages.mirror.syncs.list.noResults")}
                Severity: Major
                Found in ui/src/pages/namespace/Mirror/Detail/index.tsx and 1 other location - About 1 hr to fix
                ui/src/pages/namespace/Services/List/Table.tsx on lines 69..77

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                        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

                        Similar blocks of code found in 4 locations. Consider refactoring.
                        Open

                            {
                              value: "editor",
                              active: isWorkflowEditorPage,
                              icon: <Code2 aria-hidden="true" />,
                              title: t("pages.explorer.workflow.menu.fileContent"),
                        Severity: Major
                        Found in ui/src/pages/namespace/Explorer/Workflow/index.tsx and 3 other locations - About 1 hr to fix
                        ui/src/pages/namespace/Explorer/Workflow/index.tsx on lines 70..80
                        ui/src/pages/namespace/Explorer/Workflow/index.tsx on lines 81..91
                        ui/src/pages/namespace/Explorer/Workflow/index.tsx on lines 92..102

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 70.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 4 locations. Consider refactoring.
                        Open

                            {
                              value: "settings",
                              active: isWorkflowSettingsPage,
                              icon: <Settings aria-hidden="true" />,
                              title: t("pages.explorer.workflow.menu.settings"),
                        Severity: Major
                        Found in ui/src/pages/namespace/Explorer/Workflow/index.tsx and 3 other locations - About 1 hr to fix
                        ui/src/pages/namespace/Explorer/Workflow/index.tsx on lines 59..69
                        ui/src/pages/namespace/Explorer/Workflow/index.tsx on lines 70..80
                        ui/src/pages/namespace/Explorer/Workflow/index.tsx on lines 81..91

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 70.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                          test("invalid json", () => {
                            expect(prettifyJsonString("")).toMatchInlineSnapshot('"{}"');
                            expect(prettifyJsonString("no json")).toMatchInlineSnapshot('"{}"');
                            expect(prettifyJsonString('{"some": "invalidJson')).toMatchInlineSnapshot(
                              '"{}"'
                        Severity: Major
                        Found in ui/src/util/__tests__/utils.test.ts and 2 other locations - About 1 hr to fix
                        ui/src/pages/namespace/Explorer/Tree/__tests__/utils.test.ts on lines 10..14
                        ui/src/pages/namespace/Explorer/Tree/__tests__/utils.test.ts on lines 16..20

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 70.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language