Showing 254 of 254 total issues

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

export const systemUser = new UserModel({
  id: 'm0',
  nick: {
    mas: SYSTEM_USER_NICK,
    ircnet: SYSTEM_USER_NICK,
Severity: Major
Found in new-client/src/models/User.ts and 1 other location - About 1 hr to fix
new-client/src/models/User.ts on lines 62..72

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 ircSystemUser = new UserModel({
  id: 'i0',
  nick: {
    mas: SYSTEM_USER_NICK,
    ircnet: SYSTEM_USER_NICK,
Severity: Major
Found in new-client/src/models/User.ts and 1 other location - About 1 hr to fix
new-client/src/models/User.ts on lines 50..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 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 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

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

      <Flex flex="1" alignItems="flex-end">
        <IconButton
          onClick={() => handleMove(WindowMoveDirection.Up)}
          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 69..77

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

Function createHTTPServers has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createHTTPServers() {
  let httpServer;
  let httpsServer;
  const httpPort = conf.get('frontend:http_port');
  const httpsPort = conf.get('frontend:https_port');
Severity: Minor
Found in server/server.js - About 1 hr to fix

    Function handleAddMessageServer has 26 lines of code (exceeds 25 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

      Function handleAddMessagesServer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        handleAddMessagesServer({ messages = mandatory() }) {
          messages.forEach(({ windowId, messages: windowMessages }) => {
            const window = this.windows.get(windowId);
            let newMessages;
      
      
      Severity: Minor
      Found in client/app/stores/WindowStore.js - About 1 hr to fix

        Function index has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = async function index(ctx) {
          ctx.set('Cache-control', 'private, max-age=0, no-cache');
        
          const user = ctx.mas.user;
        
        
        Severity: Minor
        Found in server/controllers/client.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if (cursor.section === 'top' || cursor.section === 'bottom') {
                    deltaY = rowIndex > cursor.y || (rowIndex === cursor.y && cursor.section === 'top') ? 1 : 0;
                  } else {
                    deltaX =
                      rowIndex === cursor.y && (columnIndex > cursor.x || (columnIndex === cursor.x && cursor.section === 'left'))
          Severity: Major
          Found in client/app/pods/components/window-grid/component.js - About 1 hr to fix

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

              if (conf.get('cloudronauth:enabled')) {
                router.get('/auth/cloudron', passport.authenticate('cloudron'));
                router.get('/auth/cloudron/callback', loginController.externalLogin('cloudron'));
              }
            Severity: Major
            Found in server/routes/router.js and 1 other location - About 1 hr to fix
            server/routes/router.js on lines 54..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 55.

            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

              handlerServerNotification(ntf: Notification): boolean {
                switch (ntf.type) {
                  case 'ADD_USERS':
                    this.upsertUsers(ntf.mapping);
                    break;
            Severity: Major
            Found in new-client/src/stores/UserStore.ts and 1 other location - About 1 hr to fix
            new-client/src/stores/NetworkStore.ts on lines 21..31

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

            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

              handlerServerNotification(ntf: Notification): boolean {
                switch (ntf.type) {
                  case 'UPDATE_NETWORKS':
                    this.updateNetworks(ntf.networks);
                    break;
            Severity: Major
            Found in new-client/src/stores/NetworkStore.ts and 1 other location - About 1 hr to fix
            new-client/src/stores/UserStore.ts on lines 36..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 55.

            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

              if (conf.get('yahooauth:enabled')) {
                router.get('/auth/yahoo', passport.authenticate('yahoo'));
                router.get('/auth/yahoo/callback', loginController.externalLogin('yahoo'));
              }
            Severity: Major
            Found in server/routes/router.js and 1 other location - About 1 hr to fix
            server/routes/router.js on lines 59..62

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

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

            async function handleJoin(user, msg) {
              // :neo!i=ilkkao@iao.iki.fi JOIN :#testi4
              const channel = msg.params[0];
              const network = msg.network;
              const targetUser = await nicksService.getUser(msg.nick, network);
            Severity: Minor
            Found in server/backends/irc/controller.js - 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

            Function disconnectIfIdle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            async function disconnectIfIdle(user, network) {
              const windows = await windowsService.getWindowsForNetwork(user, network);
              let onlyServer1on1Left = false;
            
              if (windows.length === 1) {
            Severity: Minor
            Found in server/backends/irc/controller.js - 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

            Function create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              static create(params) {
                if (!params) {
                  return null;
                }
            
            
            Severity: Minor
            Found in server/lib/userGId.ts - 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

            Function handleProcessLine has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              handleProcessLine({ window = mandatory(), body = mandatory() }) {
                let command = false;
                let commandParams;
            
                if (body.charAt(0) === '/') {
            Severity: Minor
            Found in client/app/stores/WindowStore.js - 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

            Function log has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              log({ level, message, ...meta }, callback) {
                const [, processName, processExtension] = process.title.split('-');
                let processColumn;
                let cat;
            
            
            Severity: Minor
            Found in server/lib/winstonMasTransport.ts - 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

            Function decoratedTitle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              @computed
              get decoratedTitle() {
                let title;
                const type = this.type;
                const userId = this.userId;
            Severity: Minor
            Found in client/app/models/Window.js - 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

            Function moveWindow has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              moveWindow(movingWindow: Window, direction: WindowMoveDirection): void {
                const windowRowIndex = this.visibleWindowsGrid.findIndex(row => row.includes(movingWindow));
                const windowRow = this.visibleWindowsGrid[windowRowIndex];
            
                if (!windowRow) {
            Severity: Minor
            Found in new-client/src/stores/WindowStore.ts - 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

            Severity
            Category
            Status
            Source
            Language