opcotech/elemo

View on GitHub

Showing 27 of 170 total issues

Method userService.Update has 8 return statements (exceeds 7 allowed).
Open

func (s *userService) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.User, error) {
    ctx, span := s.tracer.Start(ctx, "service.userService/Update")
    defer span.End()

    if expired, err := s.licenseService.Expired(ctx); expired || err != nil {
Severity: Major
Found in internal/service/user.go - About 35 mins to fix

    Method authController.LoginHandler has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    func (c *authController) LoginHandler(w http.ResponseWriter, r *http.Request) {
        ctx, span := c.tracer.Start(r.Context(), "transport.http.handler/LoginHandler")
        defer span.End()
    
        store, err := c.sessionManager.Start(r.Context(), w, r)
    Severity: Minor
    Found in internal/transport/http/auth.go - About 25 mins 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 PermissionRepository.HasPermission has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    func (r *PermissionRepository) HasPermission(ctx context.Context, subject, target model.ID, kinds ...model.PermissionKind) (bool, error) {
        ctx, span := r.tracer.Start(ctx, "repository.neo4j.PermissionRepository/HasPermission")
        defer span.End()
    
        hasCreatePermission := false
    Severity: Minor
    Found in internal/repository/neo4j/permission.go - About 25 mins 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 Project.Validate has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    func (p *Project) Validate() error {
        if err := validate.Struct(p); err != nil {
            return errors.Join(ErrInvalidProjectDetails, err)
        }
        if err := p.ID.Validate(); err != nil {
    Severity: Minor
    Found in internal/model/project.go - About 25 mins 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 Organization.Validate has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    func (o *Organization) Validate() error {
        if err := validate.Struct(o); err != nil {
            return errors.Join(ErrInvalidOrganizationDetails, err)
        }
        if err := o.ID.Validate(); err != nil {
    Severity: Minor
    Found in internal/model/organization.go - About 25 mins 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 organizationService.Update has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    func (s *organizationService) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Organization, error) {
        ctx, span := s.tracer.Start(ctx, "service.organizationService/Update")
        defer span.End()
    
        if expired, err := s.licenseService.Expired(ctx); expired || err != nil {
    Severity: Minor
    Found in internal/service/organization.go - About 25 mins 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 userController.V1UserGet has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
    Open

    func (c *userController) V1UserGet(ctx context.Context, request api.V1UserGetRequestObject) (api.V1UserGetResponseObject, error) {
        ctx, span := c.tracer.Start(ctx, "transport.http.handler/V1UserGet")
        defer span.End()
    
        var userID model.ID
    Severity: Minor
    Found in internal/transport/http/user.go - About 25 mins 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