vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

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

        <div className="text-sm">
          <div className="text-gray-10 dark:text-gray-dark-10">
            {t("pages.services.list.tableHeader.cmd")}
          </div>
          {service.cmd ? service.cmd : "-"}
Severity: Major
Found in ui/src/pages/namespace/Services/Detail/Header.tsx and 2 other locations - About 1 hr to fix
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 53..58
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 75..80

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 61.

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

  page.on("dialog", async (dialog) => {
    await expect(dialog.type()).toBe("beforeunload");
    dialogTriggered = true;
    await dialog.accept();
  });
Severity: Major
Found in ui/e2e/explorer/workflow/codeEditor.spec.ts and 2 other locations - About 1 hr to fix
ui/e2e/explorer/workflow/codeEditor.spec.ts on lines 300..304
ui/e2e/explorer/workflow/codeEditor.spec.ts on lines 323..327

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 61.

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

    {
      value: "tokens",
      active: isPermissionsTokenPage,
      icon: <KeyRound aria-hidden="true" />,
      title: t("pages.permissions.tabs.tokens"),
Severity: Major
Found in ui/src/pages/namespace/Permissions/index.tsx and 1 other location - About 1 hr to fix
ui/src/pages/namespace/Permissions/index.tsx on lines 35..44

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 61.

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

      {editItem && (
        <Edit
          unallowedNames={allNames.filter((name) => name !== editItem.name)}
          item={editItem}
          onSuccess={() => {
Severity: Major
Found in ui/src/pages/namespace/Settings/Variables/index.tsx and 1 other location - About 1 hr to fix
ui/src/pages/namespace/Explorer/Workflow/Settings/Variables/index.tsx on lines 189..197

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 61.

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

        <div className="text-sm">
          <div className="text-gray-10 dark:text-gray-dark-10">
            {t("pages.services.list.tableHeader.image")}
          </div>
          {service.image ? service.image : "-"}
Severity: Major
Found in ui/src/pages/namespace/Services/Detail/Header.tsx and 2 other locations - About 1 hr to fix
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 75..80
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 81..86

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 61.

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

        <div className="text-sm">
          <div className="text-gray-10 dark:text-gray-dark-10">
            {t("pages.services.list.tableHeader.size")}
          </div>
          {service.size ? service.size : "-"}
Severity: Major
Found in ui/src/pages/namespace/Services/Detail/Header.tsx and 2 other locations - About 1 hr to fix
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 53..58
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 81..86

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 61.

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

            <ul data-testid="itemsList">
              {currentItems.map((item) => (
                <li key={item.id}>{item.id}</li>
              ))}
            </ul>
ui/src/components/PaginationProvider/index.stories.tsx on lines 86..90

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 61.

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

Function buildService has 57 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func buildService(c *core.Config, sv *core.ServiceFileData, registrySecrets []corev1.LocalObjectReference) (*servingv1.Service, error) {
    containers, err := buildContainers(c, sv)
    if err != nil {
        return nil, err
    }
Severity: Minor
Found in pkg/service/helper.go - About 1 hr to fix

    Method manager.runCycle has 57 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (m *manager) runCycle() []error {
        if !m.servicesListHasBeenSet {
            return nil
        }
        // clone the list
    Severity: Minor
    Found in pkg/service/manager.go - About 1 hr to fix

      Function RoutesDetailPage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const RoutesDetailPage = () => {
        const pages = usePages();
        const { routePath } = pages.gateway.useParams();
        const { data, isAllowed, isFetched, noPermissionMessage } = useRoute({
          routePath: routePath ?? "",
      Severity: Minor
      Found in ui/src/pages/namespace/Gateway/Routes/Detail/index.tsx - About 1 hr to fix

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

        func (s sqlLogNewStore) GetStartingIDUntilTimeInstance(ctx context.Context, track string, lastID int, t time.Time) ([]core.LogEntry, error) {
            query := `
                SELECT id, time, tag, data
                FROM fluentbit
                WHERE tag LIKE ? AND id > ? time <= ?
        Severity: Major
        Found in pkg/datastore/datastoresql/logstore_new.go and 1 other location - About 1 hr to fix
        pkg/datastore/datastoresql/logstore_new.go on lines 98..112

        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 146.

        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

        func (s sqlLogNewStore) GetStartingIDUntilTime(ctx context.Context, track string, lastID int, t time.Time) ([]core.LogEntry, error) {
            query := `
                SELECT id, time, tag, data
                FROM fluentbit
                WHERE tag = ? AND id > ? time <= ?
        Severity: Major
        Found in pkg/datastore/datastoresql/logstore_new.go and 1 other location - About 1 hr to fix
        pkg/datastore/datastoresql/logstore_new.go on lines 114..128

        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 146.

        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

        Function initLegacyServer has 13 return statements (exceeds 4 allowed).
        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 1 hr to fix

          Method Pubsub.flush has a Cognitive Complexity of 26 (exceeds 20 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

          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 forEachLogic.processActionResults has 13 return statements (exceeds 4 allowed).
          Open

          func (logic *forEachLogic) 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/foreach.go - About 1 hr to fix

            Method instController.getPagination has a Cognitive Complexity of 26 (exceeds 20 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: 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

            Method nsController.update has 13 return statements (exceeds 4 allowed).
            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 1 hr to fix

              Method eventsController.registerCoudEvent has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
              Open

              func (c *eventsController) registerCoudEvent(w http.ResponseWriter, r *http.Request) {
                  ns := extractContextNamespace(r)
                  cType := r.Header.Get("Content-type")
                  limit := int64(1024 * 1024 * 32)
              
              
              Severity: Minor
              Found in pkg/api/events.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 RootQuery.CreateFile has 13 return statements (exceeds 4 allowed).
              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: Major
              Found in pkg/filestore/filestoresql/root_query.go - About 1 hr to fix

                Function LoadResource has 13 return statements (exceeds 4 allowed).
                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: Major
                Found in pkg/model/resources.go - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language