Showing 254 of 254 total issues

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

function sendPrivmsg(user, network, target, text) {
  courier.callNoWait('connectionmanager', 'write', {
    userId: user.id,
    network,
    line: `PRIVMSG ${target} :${text}`
Severity: Major
Found in server/backends/irc/controller.js and 1 other location - About 1 hr to fix
server/backends/irc/controller.js on lines 1339..1345

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

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

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

      alerts: {
        email: window.get('emailAlert'),
        notification: window.get('notificationAlert'),
        sound: window.get('soundAlert'),
        title: window.get('titleAlert')
Severity: Major
Found in server/services/session.js and 1 other location - About 1 hr to fix
server/services/windows.js on lines 183..188

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

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 exports has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (environment) {
  const ENV = {
    modulePrefix: 'mas',
    podModulePrefix: 'mas/pods',
    environment,
Severity: Minor
Found in client/config/environment.js - About 1 hr to fix

    Function _calculateCursorPosition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _calculateCursorPosition(event) {
        const outOfBoundsCursor = { x: null, y: null, section: null };
    
        const x = event.clientX;
        const y = event.clientY;
    Severity: Minor
    Found in client/app/pods/components/window-grid/component.js - About 1 hr to fix

      Function handle376or422 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      async function handle376or422(user, msg) {
        const networkInfo = await findOrCreateNetworkInfo(user, msg.network);
      
        await addSystemMessage(user, msg.network, 'server', msg.params.join(' '));
      
      
      Severity: Minor
      Found in server/backends/irc/controller.js - About 1 hr to fix

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

        try {
          templateV2 = handlebars.compile(fs.readFileSync(path.join(root(), 'new-client/html/index.html'), 'utf8'));
        } catch (e) {
          templateV2 = null;
        }
        Severity: Major
        Found in server/controllers/client.js and 1 other location - About 1 hr to fix
        server/controllers/client.js on lines 56..60

        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

        try {
          templateV1 = handlebars.compile(fs.readFileSync(path.join(root(), 'client/dist/index.html'), 'utf8'));
        } catch (e) {
          templateV1 = null;
        }
        Severity: Major
        Found in server/controllers/client.js and 1 other location - About 1 hr to fix
        server/controllers/client.js on lines 62..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 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

          @computed
          get updatedDate() {
            const updatedTs = this.updatedTs;
        
            return updatedTs ? `at ${moment.unix(updatedTs).format('MMM Do HH:mm')}` : '';
        Severity: Major
        Found in client/app/models/Message.js and 1 other location - About 1 hr to fix
        client/app/models/Message.js on lines 63..68

        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

          @computed
          get updatedDateLong() {
            const updatedTs = this.updatedTs;
        
            return updatedTs ? `at ${moment.unix(updatedTs).format('dddd, MMMM D HH:mm')}` : '';
        Severity: Major
        Found in client/app/models/Message.js and 1 other location - About 1 hr to fix
        client/app/models/Message.js on lines 56..61

        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

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

        function runSetters(objectProps, setters) {
          const preparedProps = {};
          const errors = {};
        
          for (const prop of Object.keys(objectProps)) {
        Severity: Minor
        Found in server/models/base.js - 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 authLocal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        async function authLocal(username, password, done) {
          if (!username) {
            return;
          }
        
        
        Severity: Minor
        Found in server/lib/passport.js - 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 externalLogin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        exports.externalLogin = function externalLogin(provider) {
          return async ctx => {
            await passport.authenticate(provider, async (err, user, info) => {
              if (user) {
                await createAuthSession(ctx, user);
        Severity: Minor
        Found in server/controllers/login.js - 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 handleAddMessageServer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          handleAddMessageServer({
            gid = mandatory(),
            userId = mandatory(),
            ts = mandatory(),
            windowId = mandatory(),
        Severity: Minor
        Found in client/app/stores/WindowStore.js - 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 handleSet has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        async function handleSet({ user, command }) {
          const properties = command.settings || {};
          const keys = Object.keys(properties);
        
          if (keys.length === 0) {
        Severity: Minor
        Found in server/controllers/request.js - 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 handleUploadFiles has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          handleUploadFiles({ files = mandatory(), window = mandatory() }) {
            if (files.length === 0) {
              return;
            }
        
        
        Severity: Minor
        Found in client/app/stores/WindowStore.js - About 1 hr to fix

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

          async function authLocal(username, password, done) {
            if (!username) {
              return;
            }
          
          
          Severity: Minor
          Found in server/lib/passport.js - About 1 hr to fix

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

              addWindow(windowRecord: WindowRecord): void {
                const window = this.windows.get(windowRecord.windowId);
                const user = windowRecord.userId ? this.rootStore.userStore.users.get(windowRecord.userId) || undefined : undefined;
            
                if (window) {
            Severity: Minor
            Found in new-client/src/stores/WindowStore.ts - About 1 hr to fix

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

                    <Flex>
                      <IconButton
                        onClick={() => handleMove(WindowMoveDirection.Down)}
                        size="sm"
                        m="0.2rem"
              Severity: Major
              Found in new-client/src/components/WindowMoveControls.tsx and 1 other location - About 1 hr to fix
              new-client/src/components/WindowMoveControls.tsx on lines 43..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

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

                    resp => {
                      if (resp.status !== 'OK') {
                        dispatch('OPEN_MODAL', {
                          name: 'info-modal',
                          model: {
              Severity: Major
              Found in client/app/stores/WindowStore.js and 2 other locations - About 1 hr to fix
              client/app/stores/WindowStore.js on lines 305..315
              client/app/stores/WindowStore.js on lines 414..424

              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

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

                    resp => {
                      if (resp.status !== 'OK') {
                        dispatch('OPEN_MODAL', {
                          name: 'info-modal',
                          model: {
              Severity: Major
              Found in client/app/stores/WindowStore.js and 2 other locations - About 1 hr to fix
              client/app/stores/WindowStore.js on lines 225..235
              client/app/stores/WindowStore.js on lines 305..315

              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