loomio/loomio

View on GitHub
vue/src/shared/helpers/helptext.js

Summary

Maintainability
C
7 hrs
Test Coverage

Function groupPrivacy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export var groupPrivacy = function(group, privacy) {
  privacy = privacy || group.groupPrivacy;

  if (group.isParent()) {
    switch (privacy) {
Severity: Minor
Found in vue/src/shared/helpers/helptext.js - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function groupPrivacyConfirm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export var groupPrivacyConfirm = function(group) {
  if (group.isNew()) { return ""; }

  if (group.attributeIsModified('groupPrivacy')) {
    if (group.privacyIsSecret()) {
Severity: Minor
Found in vue/src/shared/helpers/helptext.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 groupPrivacy has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export var groupPrivacy = function(group, privacy) {
  privacy = privacy || group.groupPrivacy;

  if (group.isParent()) {
    switch (privacy) {
Severity: Minor
Found in vue/src/shared/helpers/helptext.js - About 1 hr to fix

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

    export var eventTitle = function(event) {
      switch (event.eventableType) {
        case 'Comment':             return event.model().parentAuthorName;
        case 'Poll': case 'Outcome':     return event.model().poll().title;
        case 'Group': case 'Membership': return event.model().group().name;
    Severity: Minor
    Found in vue/src/shared/helpers/helptext.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 groupPrivacyStatement has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    export var groupPrivacyStatement = function(group) {
      if (group.parentId && group.parent().privacyIsSecret()) {
        if (group.privacyIsClosed()) {
          return 'group_form.privacy_statement.private_to_parent_members';
        } else {
    Severity: Minor
    Found in vue/src/shared/helpers/helptext.js - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Avoid too many return statements within this function.
    Open

        return 'discussion_edited';
    Severity: Major
    Found in vue/src/shared/helpers/helptext.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return 'group_form.confirm_change_to_private_discussions_only';
      Severity: Major
      Found in vue/src/shared/helpers/helptext.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return 'group_form.subgroup_privacy_is_closed_description';
        Severity: Major
        Found in vue/src/shared/helpers/helptext.js - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status