Showing 254 of 254 total issues

File controller.js has 1001 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env node
//
//   Copyright 2009-2014 Ilkka Oksanen <iao@iki.fi>
//
//   Licensed under the Apache License, Version 2.0 (the "License");
Severity: Major
Found in server/backends/irc/controller.js - About 2 days to fix

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

    const Search: FunctionComponent = () => {
      const navigate = useNavigate();
      const toast = useToast();
      const { windowStore } = useContext(ServerContext);
      const [name, setName] = useState<string>('');
    Severity: Major
    Found in new-client/src/components/JoinChannel.tsx and 1 other location - About 2 days to fix
    new-client/src/components/CreateChannel.tsx on lines 8..49

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

    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 Search: FunctionComponent = () => {
      const navigate = useNavigate();
      const toast = useToast();
      const { windowStore } = useContext(ServerContext);
      const [name, setName] = useState<string>('');
    Severity: Major
    Found in new-client/src/components/CreateChannel.tsx and 1 other location - About 2 days to fix
    new-client/src/components/JoinChannel.tsx on lines 8..49

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

    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

    File WindowStore.ts has 664 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { autorun, observable, computed, makeObservable, action, runInAction } from 'mobx';
    import dayjs from 'dayjs';
    import { RemirrorJSON } from 'remirror';
    import Message from '../models/Message';
    import Window, { WindowMoveDirection } from '../models/Window';
    Severity: Major
    Found in new-client/src/stores/WindowStore.ts - About 1 day to fix

      File WindowStore.js has 623 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { observable, computed } from 'mobx';
      import moment from 'moment';
      import Cookies from 'js-cookie';
      import isMobile from 'ismobilejs';
      import { dispatch } from '../utils/dispatcher';
      Severity: Major
      Found in client/app/stores/WindowStore.js - About 1 day to fix

        Function main has 255 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        (async function main() {
          const { val, reason } = await db.setSchema({
            users: {
              definition: {
                deleted: { type: 'boolean', allowNull: false },
        Severity: Major
        Found in server/bin/create-db.ts - About 1 day to fix

          File component.js has 480 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          //
          //   Copyright 2009-2014 Ilkka Oksanen <iao@iki.fi>
          //
          //   Licensed under the Apache License, Version 2.0 (the "License");
          //   you may not use this file except in compliance with the License.
          Severity: Minor
          Found in client/app/pods/components/discussion-window/component.js - About 7 hrs to fix

            File request.js has 450 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            //
            //   Copyright 2014 Ilkka Oksanen <iao@iki.fi>
            //
            //   Licensed under the Apache License, Version 2.0 (the "License");
            //   you may not use this file except in compliance with the License.
            Severity: Minor
            Found in server/controllers/request.js - About 6 hrs to fix

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

                        <Field name="password" validate={validatePassword}>
                          {({ field, form }: InputRenderProps<InputProps>) => (
                            <FormControl mt={4} isInvalid={Boolean(form.errors.password) && form.touched.password}>
                              <FormLabel htmlFor="password">Password</FormLabel>
                              <Input {...field} type="password" id="password" placeholder="password" />
              Severity: Major
              Found in website/src/components/RegisterModal.tsx and 1 other location - About 6 hrs to fix
              website/src/components/RegisterModal.tsx on lines 138..146

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

              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

                        <Field name="email" validate={validateEmail}>
                          {({ field, form }: InputRenderProps<InputProps>) => (
                            <FormControl mt={4} isInvalid={Boolean(form.errors.email) && form.touched.email}>
                              <FormLabel htmlFor="email">Email Address</FormLabel>
                              <Input {...field} type="email" id="email" placeholder="email" />
              Severity: Major
              Found in website/src/components/RegisterModal.tsx and 1 other location - About 6 hrs to fix
              website/src/components/RegisterModal.tsx on lines 147..155

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

              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

                        <Field name="tos" validate={validateTos}>
                          {({ field, form }: InputRenderProps<CheckboxProps>) => (
                            <FormControl mt={4} isInvalid={Boolean(form.errors.tos) && form.touched.tos}>
                              <FormLabel htmlFor="tos">I agree MAS Terms of Service</FormLabel>
                              <Checkbox {...field} id="tos" placeholder="tos" />
              Severity: Major
              Found in website/src/components/RegisterModal.tsx and 2 other locations - About 6 hrs to fix
              website/src/components/RegisterModal.tsx on lines 129..137
              website/src/components/RegisterModal.tsx on lines 170..178

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

              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

                        <Field name="name" validate={validateName}>
                          {({ field, form }: InputRenderProps<InputProps>) => (
                            <FormControl mt={4} isInvalid={Boolean(form.errors.name) && form.touched.name}>
                              <FormLabel htmlFor="name">Your Name</FormLabel>
                              <Input {...field} id="name" placeholder="name" />
              Severity: Major
              Found in website/src/components/RegisterModal.tsx and 2 other locations - About 6 hrs to fix
              website/src/components/RegisterModal.tsx on lines 170..178
              website/src/components/RegisterModal.tsx on lines 179..187

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

              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

                        <Field name="nick" validate={validateNick}>
                          {({ field, form }: InputRenderProps<InputProps>) => (
                            <FormControl mt={4} isInvalid={Boolean(form.errors.nick) && form.touched.nick}>
                              <FormLabel htmlFor="nick">Nickname</FormLabel>
                              <Input {...field} id="nick" placeholder="nick" />
              Severity: Major
              Found in website/src/components/RegisterModal.tsx and 2 other locations - About 6 hrs to fix
              website/src/components/RegisterModal.tsx on lines 129..137
              website/src/components/RegisterModal.tsx on lines 179..187

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

              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

              WindowStore has 47 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class WindowStore {
                rootStore: RootStore;
                socket: Socket;
                windows = new Map<number, Window>();
                activeWindow: Window | null = null;
              Severity: Minor
              Found in new-client/src/stores/WindowStore.ts - About 6 hrs to fix

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

                          <Flex direction="row">
                            <Input type="text" value={name} onChange={e => setName(e.target.value)} />
                            {name !== profileStore.profile.name && (
                              <>
                                <Button onClick={() => handleSave('name')} mx="1rem">
                Severity: Major
                Found in new-client/src/components/Profile.tsx and 1 other location - About 6 hrs to fix
                new-client/src/components/Profile.tsx on lines 82..94

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

                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

                          <Flex direction="row">
                            <Input type="email" value={email} onChange={e => setEmail(e.target.value)} />
                            {email !== profileStore.profile.email && (
                              <>
                                <Button onClick={() => handleSave('email')} mx="1rem">
                Severity: Major
                Found in new-client/src/components/Profile.tsx and 1 other location - About 6 hrs to fix
                new-client/src/components/Profile.tsx on lines 66..78

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

                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 handleMode has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                Open

                async function handleMode(user, msg) {
                  // :ilkka9!~ilkka9@localhost.myrootshell.com MODE #sunnuntai +k foobar3
                  const target = msg.params[0];
                
                  if (!isChannel(target)) {
                Severity: Minor
                Found in server/backends/irc/controller.js - About 6 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 setup has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.setup = function setup(server) {
                  const io = socketIo(server, {
                    maxHttpBufferSize: 1e8,
                    pingInterval: 10000,
                    pingTimeout: 15000,
                Severity: Major
                Found in server/controllers/socket.js - About 6 hrs to fix

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

                  export default Component.extend({
                    group: '',
                    password: '',
                    errorMsg: '',
                  
                  
                  Severity: Major
                  Found in client/app/pods/components/join-group-modal/component.js and 1 other location - About 5 hrs to fix
                  client/app/pods/components/create-group-modal/component.js on lines 20..45

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

                  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 default Component.extend({
                    group: '',
                    password: '',
                    errorMsg: '',
                  
                  
                  Severity: Major
                  Found in client/app/pods/components/create-group-modal/component.js and 1 other location - About 5 hrs to fix
                  client/app/pods/components/join-group-modal/component.js on lines 20..45

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

                  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