zammad/zammad

View on GitHub
app/assets/javascripts/app/lib/base/email-addresses.js

Summary

Maintainability
F
6 days
Test Coverage

Function parse5322 has 689 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function parse5322(opts) {

    // tokenizing functions

    function inStr() { return pos < len; }
Severity: Major
Found in app/assets/javascripts/app/lib/base/email-addresses.js - About 3 days to fix

    File email-addresses.js has 775 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    
    // email-addresses.js - RFC 5322 email address parser
    // v 3.0.1
    //
    // http://tools.ietf.org/html/rfc5322
    Severity: Major
    Found in app/assets/javascripts/app/lib/base/email-addresses.js - About 1 day to fix

      Function handleOpts has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function handleOpts(opts, defs) {
          function isString(str) {
              return Object.prototype.toString.call(str) === '[object String]';
          }
      
      
      Severity: Minor
      Found in app/assets/javascripts/app/lib/base/email-addresses.js - About 1 hr to fix

        Function giveResult has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function giveResult(ast) {
                var addresses, groupsAndMailboxes, i, groupOrMailbox, result;
                if (ast === null) {
                    return null;
                }
        Severity: Minor
        Found in app/assets/javascripts/app/lib/base/email-addresses.js - About 1 hr to fix

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

              function obsAddrList() {
                  return opts.strict ? null : wrap('obs-addr-list', and(
                      star(and(
                          invis(opt(cfws)),
                          literal(',')
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 717..732

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

          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

              function obsMboxList() {
                  return opts.strict ? null : wrap('obs-mbox-list', and(
                      star(and(
                          invis(opt(cfws)),
                          literal(',')
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 735..750

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

          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

                      for (i = node.children.length - 1; i >= 0; i -= 1) {
                          stack.push(node.children[i]);
                      }
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 2 other locations - About 55 mins to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 808..810
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 831..833

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

          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

                      for (i = node.children.length - 1; i >= 0; i -= 1) {
                          stack.push(node.children[i]);
                      }
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 2 other locations - About 55 mins to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 791..793
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 831..833

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

          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

                          for (i = node.children.length - 1; i >= 0; i -= 1) {
                              stack.push(node.children[i]);
                          }
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 2 other locations - About 55 mins to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 791..793
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 808..810

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

          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

              function obsDomain() {
                  return opts.strict ? null : wrap('obs-domain', and(atom, star(and(literal('.'), atom)))());
              }
          Severity: Minor
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 1 other location - About 50 mins to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 764..766

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

          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

              function obsLocalPart() {
                  return opts.strict ? null : wrap('obs-local-part', and(word, star(and(literal('.'), word)))());
              }
          Severity: Minor
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 1 other location - About 50 mins to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 769..771

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

          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

              function mailboxList() {
                  return wrap('mailbox-list', or(
                      and(
                          mailbox,
                          star(and(literal(','), mailbox))
          Severity: Minor
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 1 other location - About 35 mins to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 513..521

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

          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

              function addressList() {
                  return wrap('address-list', or(
                      and(
                          address,
                          star(and(literal(','), address))
          Severity: Minor
          Found in app/assets/javascripts/app/lib/base/email-addresses.js and 1 other location - About 35 mins to fix
          app/assets/javascripts/app/lib/base/email-addresses.js on lines 502..510

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

          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

          There are no issues that match your filters.

          Category
          Status