vorteil/direktiv

View on GitHub

Showing 1,235 of 1,235 total issues

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

export const createHttpServiceFile = ({
  scale = 1,
  size = "small",
}: CreateServiceFileParams = {}) => `direktiv_api: service/v1
image: gcr.io/direktiv/functions/http-request:1.0
Severity: Major
Found in ui/e2e/services/utils.ts and 1 other location - About 1 hr to fix
ui/e2e/services/utils.ts on lines 23..34

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

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

                  to={pages.explorer.createHref({
                    namespace: service.namespace,
                    path: service.filePath,
                    subpage:
                      service.type === "namespace-service"
Severity: Major
Found in ui/src/pages/namespace/Services/List/Row/index.tsx and 1 other location - About 1 hr to fix
ui/src/pages/namespace/Services/Detail/Header.tsx on lines 41..46

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

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 engine.getInstanceMemory has 11 return statements (exceeds 4 allowed).
Open

func (engine *engine) getInstanceMemory(ctx context.Context, id uuid.UUID) (*instanceMemory, error) {
    tx, err := engine.flow.beginSQLTx(ctx, &sql.TxOptions{
        Isolation: sql.LevelSerializable,
    })
    if err != nil {
Severity: Major
Found in pkg/flow/memory.go - About 1 hr to fix

    Method DirektivApplyer.apply has 11 return statements (exceeds 4 allowed).
    Open

    func (o *DirektivApplyer) apply(ctx context.Context, callbacks Callbacks, proc *datastore.MirrorProcess, parser *Parser, notes map[string]string) error {
        o.log = newPIDFormatLogger(callbacks.ProcessLogger(), proc.ID)
        o.callbacks = callbacks
        o.proc = proc
        o.parser = parser
    Severity: Major
    Found in pkg/mirror/apply.go - About 1 hr to fix

      Method sqlRuntimeVariablesStore.Set has 11 return statements (exceeds 4 allowed).
      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: Major
      Found in pkg/datastore/datastoresql/runtime_variables.go - About 1 hr to fix

        Function PaginationProvider has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        const PaginationProvider = <TArrayItem,>({
          children,
          items,
          pageSize: pageSizeProp,
        }: {
        Severity: Minor
        Found in ui/src/components/PaginationProvider/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

        Function WorkflowVariablePicker has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        const WorkflowVariablePicker = ({
          namespace: givenNamespace,
          workflowPath,
          defaultVariable,
          onChange,
        Severity: Minor
        Found in ui/src/components/WorkflowVariablepicker/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

        Function ArrayItem has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        export const ArrayItem: ArrayItemProps = ({
          defaultValue,
          renderItem,
          itemIsValid,
          onAdd,
        Severity: Minor
        Found in ui/src/components/Form/Array/ArrayItem.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

        Function Filters has a Cognitive Complexity of 10 (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/Events/History/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

        Function Instances has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        export const Instances = () => {
          const {
            data: dataSuccessfulInstances,
            isFetched: isFetchedSuccessfulInstances,
            isAllowed: isAllowedSuccessfulInstances,
        Severity: Minor
        Found in ui/src/pages/namespace/Monitoring/Instances/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

        Function ExplorerPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        const ExplorerPage: FC = () => {
          const pages = usePages();
          const namespace = useNamespace();
          const { path } = pages.explorer.useParams();
          const { data, isSuccess, isFetched, isAllowed, noPermissionMessage } =
        Severity: Minor
        Found in ui/src/pages/namespace/Explorer/Tree/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

        Method eventsAndLogic.Run has 52 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

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

          Method eventsController.registerCoudEvent has 52 lines of code (exceeds 50 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

            Function createVariables has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const createVariables = async (namespace: string, amount = 5) => {
              const variables = Array.from({ length: amount }, () => ({
                name: faker.internet.domainWord(),
                content: encode(faker.lorem.sentence()),
                mimeType:
            Severity: Minor
            Found in ui/e2e/utils/variables.ts - About 1 hr to fix

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

              export const statusToAlertVariant = (
                status: StatusSchemaType
              ): AlertVariant => {
                switch (status) {
                  case "True":
              Severity: Major
              Found in ui/src/pages/namespace/Services/components/utils.ts and 1 other location - About 1 hr to fix
              ui/src/pages/namespace/Services/components/utils.ts on lines 25..36

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

              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

                    <div className="mb-3 flex flex-row justify-between">
                      <h3 className="flex items-center gap-x-2 pb-2 pt-1 font-bold">
                        <AlertCircle className="h-5" />
                        {t("pages.settings.deleteNamespace.title")}
                      </h3>
              Severity: Major
              Found in ui/src/pages/namespace/Settings/DeleteNamespace/index.tsx and 1 other location - About 1 hr to fix
              ui/src/pages/namespace/Instances/List/index.tsx on lines 47..52

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

              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

              export const useSyncDetail = (id: string) =>
                useSyncs({
                  filter: (apiResponse) =>
                    apiResponse.data.find((sybcObj) => sybcObj.id === id),
                });
              Severity: Major
              Found in ui/src/api/syncs/query/get.ts and 1 other location - About 1 hr to fix
              ui/src/api/services/query/services.ts on lines 53..57

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

              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

              export const InstancesListResponseSchema = z.object({
                meta: z.object({
                  total: z.number(),
                }),
                data: z.array(InstanceSchema),
              Severity: Major
              Found in ui/src/api/instances/schema.ts and 1 other location - About 1 hr to fix
              ui/src/api/eventListeners/schema.ts on lines 61..66

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

              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

              export const useService = (service: string) =>
                useServices({
                  filter: (apiResponse) =>
                    apiResponse.data.find((serviceObj) => serviceObj.id === service),
                });
              Severity: Major
              Found in ui/src/api/services/query/services.ts and 1 other location - About 1 hr to fix
              ui/src/api/syncs/query/get.ts on lines 53..57

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

              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

              export const statusToBadgeIcon = (status: StatusSchemaType): BadgeIcon => {
                switch (status) {
                  case "True":
                    return "complete";
                  case "False":
              Severity: Major
              Found in ui/src/pages/namespace/Services/components/utils.ts and 1 other location - About 1 hr to fix
              ui/src/pages/namespace/Services/components/utils.ts on lines 38..51

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

              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