opcotech/elemo

View on GitHub

Showing 27 of 170 total issues

Function TodoForm has 212 lines of code (exceeds 75 allowed). Consider refactoring.
Open

export function TodoForm(props: NewTodoFormProps) {
  const [loading, setLoading] = useState(false);

  const createTodo = useStore((state) => state.createTodo);
  const updateTodo = useStore((state) => state.updateTodo);
Severity: Major
Found in web/components/todos/TodoForm.tsx - About 6 hrs to fix

    Method userController.V1UserUpdate has a Cognitive Complexity of 25 (exceeds 10 allowed). Consider refactoring.
    Open

    func (c *userController) V1UserUpdate(ctx context.Context, request api.V1UserUpdateRequestObject) (api.V1UserUpdateResponseObject, error) {
        ctx, span := c.tracer.Start(ctx, "transport.http.handler/V1UserUpdate")
        defer span.End()
    
        userID, err := model.NewIDFromString(request.Id, model.ResourceTypeUser.String())
    Severity: Minor
    Found in internal/transport/http/user.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 IssueRepository.scan has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
    Open

    func (r *IssueRepository) scan(params *issueScanParams) func(rec *neo4j.Record) (*model.Issue, error) {
        return func(rec *neo4j.Record) (*model.Issue, error) {
            issue := new(model.Issue)
            issue.Links = make([]string, 0)
    
    
    Severity: Minor
    Found in internal/repository/neo4j/issue.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 Issue.Validate has a Cognitive Complexity of 24 (exceeds 10 allowed). Consider refactoring.
    Open

    func (i *Issue) Validate() error {
        if err := validate.Struct(i); err != nil {
            return errors.Join(ErrInvalidIssueDetails, err)
        }
        if err := i.ID.Validate(); err != nil {
    Severity: Minor
    Found in internal/model/issue.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 TodoDrawer has 112 lines of code (exceeds 75 allowed). Consider refactoring.
    Open

    export function TodoDrawer() {
      const [showNewTodoForm, setShowNewTodoForm] = useState(false);
    
      const [todos, show, toggleDrawer, fetchingTodos, fetchTodos, updateTodo] = useStore((state) => [
        state.todos,
    Severity: Major
    Found in web/components/todos/TodoDrawer.tsx - About 2 hrs to fix

      Function SystemSettings has 104 lines of code (exceeds 75 allowed). Consider refactoring.
      Open

      export default async function SystemSettings() {
        const { license, version } = await getData();
      
        return (
          <div className="space-y-8 divide-y divide-gray-100">
      Severity: Major
      Found in web/app/(authenticated)/settings/system/page.tsx - About 2 hrs to fix

        Function SignInForm has 89 lines of code (exceeds 75 allowed). Consider refactoring.
        Open

        export function SignInForm() {
          const form = useRef<HTMLFormElement>(null);
          const [csrfToken, setCSRFToken] = useState('');
          const [submitting, setSubmitting] = useState(false);
        
        
        Severity: Major
        Found in web/components/auth/SignInForm.tsx - About 1 hr to fix

          Function TodoForm has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring.
          Open

          export function TodoForm(props: NewTodoFormProps) {
            const [loading, setLoading] = useState(false);
          
            const createTodo = useStore((state) => state.createTodo);
            const updateTodo = useStore((state) => state.updateTodo);
          Severity: Minor
          Found in web/components/todos/TodoForm.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 userController.V1UserUpdate has 12 return statements (exceeds 7 allowed).
          Open

          func (c *userController) V1UserUpdate(ctx context.Context, request api.V1UserUpdateRequestObject) (api.V1UserUpdateResponseObject, error) {
              ctx, span := c.tracer.Start(ctx, "transport.http.handler/V1UserUpdate")
              defer span.End()
          
              userID, err := model.NewIDFromString(request.Id, model.ResourceTypeUser.String())
          Severity: Major
          Found in internal/transport/http/user.go - About 55 mins to fix

            Method DocumentRepository.scan has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
            Open

            func (r *DocumentRepository) scan(dp, cp, lp, commp, ap string) func(rec *neo4j.Record) (*model.Document, error) {
                return func(rec *neo4j.Record) (*model.Document, error) {
                    doc := new(model.Document)
            
                    val, _, err := neo4j.GetRecordValue[neo4j.Node](rec, dp)
            Severity: Minor
            Found in internal/repository/neo4j/document.go - About 55 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 Issue.Validate has 11 return statements (exceeds 7 allowed).
            Open

            func (i *Issue) Validate() error {
                if err := validate.Struct(i); err != nil {
                    return errors.Join(ErrInvalidIssueDetails, err)
                }
                if err := i.ID.Validate(); err != nil {
            Severity: Major
            Found in internal/model/issue.go - About 50 mins to fix

              Method userService.Update has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
              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: Minor
              Found in internal/service/user.go - About 45 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

              Function NewRouter has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
              Open

              func NewRouter(strictServer StrictServer, serverConfig *config.ServerConfig, tracer tracing.Tracer) (http.Handler, error) {
                  if serverConfig == nil {
                      return nil, config.ErrNoConfig
                  }
              
              
              Severity: Minor
              Found in internal/transport/http/server.go - About 45 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

              Function TodoDrawer has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
              Open

              export function TodoDrawer() {
                const [showNewTodoForm, setShowNewTodoForm] = useState(false);
              
                const [todos, show, toggleDrawer, fetchingTodos, fetchTodos, updateTodo] = useStore((state) => [
                  state.todos,
              Severity: Minor
              Found in web/components/todos/TodoDrawer.tsx - About 45 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

              Function NewServer has 9 return statements (exceeds 7 allowed).
              Open

              func NewServer(opts ...ControllerOption) (StrictServer, error) {
                  var err error
              
                  c, err := newController(opts...)
                  if err != nil {
              Severity: Major
              Found in internal/transport/http/server.go - About 40 mins to fix

                Method systemService.checkStatus has 7 arguments (exceeds 6 allowed). Consider refactoring.
                Open

                    ctx context.Context,
                    name model.HealthCheckComponent,
                    resource Pingable,
                    response map[model.HealthCheckComponent]model.HealthStatus,
                    errCh chan error,
                Severity: Major
                Found in internal/service/system.go - About 35 mins to fix

                  Method OrganizationRepository.scan has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
                  Open

                  func (r *OrganizationRepository) scan(op, np, tp, mp string) func(rec *neo4j.Record) (*model.Organization, error) {
                      return func(rec *neo4j.Record) (*model.Organization, error) {
                          org := new(model.Organization)
                  
                          val, _, err := neo4j.GetRecordValue[neo4j.Node](rec, op)
                  Severity: Minor
                  Found in internal/repository/neo4j/organization.go - About 35 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

                  Function NewLicense has 8 return statements (exceeds 7 allowed).
                  Open

                  func NewLicense(licenseKey, pubKey string) (*License, error) {
                      var err error
                  
                      key, err := lk.PublicKeyFromB32String(pubKey)
                      if err != nil {
                  Severity: Major
                  Found in internal/license/license.go - About 35 mins to fix

                    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 ProjectRepository.scan has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
                      Open

                      func (r *ProjectRepository) scan(pp, dp, tp, ip string) func(rec *neo4j.Record) (*model.Project, error) {
                          return func(rec *neo4j.Record) (*model.Project, error) {
                              p := new(model.Project)
                      
                              val, _, err := neo4j.GetRecordValue[neo4j.Node](rec, pp)
                      Severity: Minor
                      Found in internal/repository/neo4j/project.go - About 35 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