SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

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

  render() {
    const formClassNames = classnames({
      'action-form': true,
      'form--big': true,
      'single-country': !!this.props.restrictedCountryCode,
Severity: Minor
Found in app/javascript/components/CallTool/Form.js - About 1 hr to fix

    Function init has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const init = options => {
      if (!options.el) {
        options.el = document.getElementById('call-tool-component');
      }
      const { el, store } = options;
    Severity: Minor
    Found in app/javascript/plugins/call_tool/index.tsx - About 1 hr to fix

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

        render() {
          const className = classnames('sweet-placeholder', this.props.className);
          const labelClassName = classnames({
            'sweet-placeholder__label': true,
            'sweet-placeholder__label--full':
      Severity: Minor
      Found in app/javascript/components/SweetInput/SweetInput.js - About 1 hr to fix

        Function componentDidMount has a Cognitive Complexity of 11 (exceeds 5 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

        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

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

            } else {
              this.$('.shares-editor__summary-row').addClass('hidden-closed');
              this.$('.shares-editor__stats-row').removeClass('hidden-closed');
              this.$('.shares-editor__stats-heading').removeClass('hidden-closed');
            }
        Severity: Major
        Found in app/javascript/legacy/campaigner_facing/shares_editor.js and 1 other location - About 1 hr to fix
        app/javascript/legacy/campaigner_facing/shares_editor.js on lines 111..115

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

        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 (desired === 'summary') {
              this.$('.shares-editor__summary-row').removeClass('hidden-closed');
              this.$('.shares-editor__stats-row').addClass('hidden-closed');
              this.$('.shares-editor__stats-heading').addClass('hidden-closed');
            } else {
        Severity: Major
        Found in app/javascript/legacy/campaigner_facing/shares_editor.js and 1 other location - About 1 hr to fix
        app/javascript/legacy/campaigner_facing/shares_editor.js on lines 115..119

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

        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

          test(`country => <SelectCountry .../>`, () => {
            const wrapper = shallow(<Country {...config} />);
            expect(wrapper.text()).toEqual('<InjectIntl(SelectCountry) />');
          });
        Severity: Major
        Found in app/javascript/components/Form/FieldTypes/index.test.tsx and 1 other location - About 1 hr to fix
        app/javascript/components/Form/FieldTypes/index.test.tsx on lines 176..179

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

        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

          test(`instruction => <div .../>`, () => {
            const wrapper = shallow(<Instruction {...config} />);
            expect(wrapper.text()).toEqual('Instruction message goes here..');
          });
        Severity: Major
        Found in app/javascript/components/Form/FieldTypes/index.test.tsx and 1 other location - About 1 hr to fix
        app/javascript/components/Form/FieldTypes/index.test.tsx on lines 163..166

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

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

          handleSuccess(e, data) {
            ee.emit('petition:submitted');
        
            const tracking = data.tracking;
            const member = window.champaign.personalization.member;
        Severity: Minor
        Found in app/javascript/legacy/member-facing/backbone/petition.js - About 1 hr to fix

          Function composeEmailLink has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function composeEmailLink(email) {
            const sanitizedToEmails = buildToEmailForCompose(
              email.toEmails,
              email.emailService
            );
          Severity: Minor
          Found in app/javascript/util/util.js - About 1 hr to fix

            Function paymentOptionsView has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              paymentOptionsView() {
                return (
                  <div className="OneClick">
                    <div className="StepWrapper-root">
                      <div className="overlay-toggle__mobile-ui">
            Severity: Minor
            Found in app/javascript/components/OneClick/OneClick.js - About 1 hr to fix

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

              export default props => {
                if (props.processing) {
                  return <FormattedMessage id="processing" defaultMessage="Processing..." />;
                }
              
              
              Severity: Major
              Found in app/javascript/components/ProcessingThen.js and 1 other location - About 1 hr to fix
              app/javascript/components/LoadingThen.js on lines 4..10

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

              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 default props => {
                if (props.loading) {
                  return <FormattedMessage id="loading" defaultMessage="Loading..." />;
                }
              
              
              Severity: Major
              Found in app/javascript/components/LoadingThen.js and 1 other location - About 1 hr to fix
              app/javascript/components/ProcessingThen.js on lines 4..10

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

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

                const onSubmit = async e => {
                  e.preventDefault();
              
                  const valid = validateForm();
                  if (!valid) return;
              Severity: Minor
              Found in app/javascript/modules/EmailParliament/EmailComposer.js - About 1 hr to fix

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

                  render() {
                    const className = classnames('sweet-placeholder__label', {
                      'sweet-placeholder__label--full':
                        !!this.props.value && !this.state.focused,
                      'sweet-placeholder__label--active': this.state.focused,
                Severity: Minor
                Found in app/javascript/components/SweetSelect/SweetSelect.js - About 1 hr to fix

                  Method create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def create
                      # TODO: Move form validator to ManageAction
                      validator = FormValidator.new(action_params.to_h)
                      action_params[:source] = action_params[:source] || detect_source
                  
                  
                  Severity: Minor
                  Found in app/controllers/api/actions_controller.rb - About 1 hr to fix

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

                      render() {
                        const {
                          alwaysShow,
                          consented,
                          active,
                    Severity: Minor
                    Found in app/javascript/components/consent/ConsentComponent.js - About 1 hr to fix

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

                      export default function InlineConsentRadiobuttons(props: IProps) {
                        const member = useSelector((state: IAppState) => state.member);
                        if (member && member.email) {
                          return null;
                        }
                      Severity: Minor
                      Found in app/javascript/components/consent/InlineConsentRadioButtons.tsx - About 1 hr to fix

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

                            if (tracking && !member.id) {
                              if (typeof window.fbq === 'function') {
                                if (tracking.user_id) {
                                  window.fbq('track', 'CompleteRegistration', tracking);
                                }
                        Severity: Major
                        Found in app/javascript/legacy/member-facing/backbone/petition.js and 1 other location - About 1 hr to fix
                        app/javascript/legacy/member-facing/backbone/petition_and_scroll_to_consent.js on lines 66..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 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

                            if (tracking && !member.id) {
                              if (typeof window.fbq === 'function') {
                                if (tracking.user_id) {
                                  window.fbq('track', 'CompleteRegistration', tracking);
                                }
                        app/javascript/legacy/member-facing/backbone/petition.js on lines 41..47

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language