SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

Function PopupMemberConsent has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function PopupMemberConsent(props: IProps) {
  const member = useSelector((state: IAppState) => state.member);
  const onClose = () => props.toggleModal(false);
  const onConsent = e => {
    e.preventDefault();
Severity: Minor
Found in app/javascript/components/consent/PopupMemberConsent.tsx - About 1 hr to fix

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

          $.post(
            `/api/payment/braintree/pages/${this.props.page.id}/one_click`,
            data
          ).then(this.onSuccess.bind(this), this.onFailure.bind(this));
    Severity: Major
    Found in app/javascript/components/OneClick/OneClick.js and 1 other location - About 1 hr to fix
    app/javascript/components/ExpressDonation/ExpressDonation.js on lines 149..152

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

    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

          $.post(
            `/api/payment/braintree/pages/${this.props.page.id}/one_click`,
            data
          ).then(this.onSuccess.bind(this), this.onFailure.bind(this));
    app/javascript/components/OneClick/OneClick.js on lines 58..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 66.

    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

      public validateForm() {
        return new Promise((resolve, reject) => {
          this.events.once('fundraiser:form:success', resolve);
          this.events.once('fundraiser:form:error', reject);
          this.events.emit('fundraiser:actions:validate_form');
    Severity: Major
    Found in app/javascript/plugins/fundraiser/index.tsx and 1 other location - About 1 hr to fix
    app/javascript/plugins/fundraiser/index.tsx on lines 112..118

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

    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

      public makePayment(callback: (data: any, formData: any) => void) {
        return new Promise((resolve, reject) => {
          this.events.once('fundraiser:transaction_success', resolve);
          this.events.once('fundraiser:transaction_error', reject);
          this.events.emit('fundraiser:actions:make_payment');
    Severity: Major
    Found in app/javascript/plugins/fundraiser/index.tsx and 1 other location - About 1 hr to fix
    app/javascript/plugins/fundraiser/index.tsx on lines 99..105

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

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

    export function getErrorsByCode(code) {
      let errors = [];
      switch (code) {
        case '':
        case undefined:
    Severity: Minor
    Found in app/javascript/util/getBraintreeErrorMessages.js - About 1 hr to fix

      Function render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          return (
            <div className="SelectPensionFund">
              <FormGroup>
                <SelectCountry
      Severity: Minor
      Found in app/javascript/plugins/email_pension/SelectPensionFund.js - About 1 hr to fix

        Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          render() {
            if (!this.props.member || !this.props.isRequiredExisting) return null;
            return (
              <Popup
                open={this.props.open}
        Severity: Minor
        Found in app/javascript/components/consent/ExistingMemberConsent.js - About 1 hr to fix

          Method search_by_plugin_type has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def search_by_plugin_type(query)
              matches_by_plugins = []
              filtered_pages = @collection.pluck(:id)
              query.each do |plugin_type|
                begin
          Severity: Minor
          Found in app/services/search/page_searcher.rb - 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 renderField has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            renderField(type) {
              const fieldProps = this.fieldProps();
              const {
                field: { default_value, name, choices },
              } = this.props;
          Severity: Minor
          Found in app/javascript/components/FieldShape/FieldShape.js - About 1 hr to fix

            Method create_action has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def create_action
                action_params = {
                  page: page
                }.merge(@extra_attrs)
            
            
            Severity: Minor
            Found in app/services/manage_action.rb - About 1 hr to fix

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

                errorNotice = () => {
                  if (!isEmpty(this.state.errors)) {
                    return (
                      <span className="error-msg left-align">
                        <FormattedMessage id="email_tool.form.errors.message" />
              Severity: Major
              Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 1 hr to fix
              app/javascript/plugins/email_pension/EmailRepresentativeView.js on lines 86..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 63.

              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

                disableSubmit: function() {
                  this.outstandingSaveRequest = true;
                  this.$saveBtn.text(window.I18n.t('pages.edit.saving'));
                  this.$saveBtn.addClass('disabled');
                },
              Severity: Major
              Found in app/javascript/legacy/campaigner_facing/page_edit_bar.js and 1 other location - About 1 hr to fix
              app/javascript/legacy/campaigner_facing/page_edit_bar.js on lines 214..218

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

              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

                enableSubmit: function() {
                  this.outstandingSaveRequest = false;
                  this.$saveBtn.text(window.I18n.t('pages.edit.save_work'));
                  this.$saveBtn.removeClass('disabled');
                },
              Severity: Major
              Found in app/javascript/legacy/campaigner_facing/page_edit_bar.js and 1 other location - About 1 hr to fix
              app/javascript/legacy/campaigner_facing/page_edit_bar.js on lines 208..212

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

              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

                errorNotice = () => {
                  if (!isEmpty(this.state.errors)) {
                    return (
                      <span className="error-msg left-align">
                        <FormattedMessage id="email_tool.form.errors.message" />
              app/javascript/plugins/email_pension/EmailPensionView.js on lines 176..184

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

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

              export const sendEmail = async params => {
                const data = {
                  email: {
                    body: params.body,
                    recipients: params.recipients,
              Severity: Minor
              Found in app/javascript/modules/EmailParliament/api.js - About 1 hr to fix

                Function render has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    return (
                      <div>
                        <form className="form-inline" onSubmit={this.handleSubmit.bind(this)}>
                          <div className="input-group">
                Severity: Minor
                Found in app/javascript/legacy/campaigner_facing/emails.js - About 1 hr to fix

                  Function componentDidMount has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    async componentDidMount() {
                      if (window.dataLayer) {
                        await window.dataLayer.push({
                          event: unintendedDonationsExperiment.activationEvent,
                        });
                  Severity: Minor
                  Found in app/javascript/plugins/fundraiser/FundraiserView.js - About 1 hr to fix

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

                                function clearSelection() {
                                  if (document.selection) {
                                    document.selection.empty();
                                  } else if (window.getSelection) {
                                    window.getSelection().removeAllRanges();
                    Severity: Major
                    Found in app/javascript/packs/summernote-rtl-plugin.js and 1 other location - About 1 hr to fix
                    app/javascript/packs/summernote-rtl-plugin.js on lines 106..112

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

                    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

                                function clearSelection() {
                                  if (document.selection) {
                                    document.selection.empty();
                                  } else if (window.getSelection) {
                                    window.getSelection().removeAllRanges();
                    Severity: Major
                    Found in app/javascript/packs/summernote-rtl-plugin.js and 1 other location - About 1 hr to fix
                    app/javascript/packs/summernote-rtl-plugin.js on lines 34..40

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

                    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