SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

Function submit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  submit(event) {
    if (event) event.preventDefault();
    const donationAmount = this.props.amount;
    this.resetErrors();

Severity: Minor
Found in app/javascript/components/Braintree/BraintreeCardFields.js - About 1 hr to fix

    Function SearchByPostcode has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const SearchByPostcode = props => {
      const [loading, setLoading] = useState(false);
      const [error, setError] = useState(false);
      const [postcode, setPostcode] = useState(null);
      const [input, setInput] = useState('');
    Severity: Minor
    Found in app/javascript/modules/EmailParliament/SearchByPostcode.js - About 1 hr to fix

      Function configureStore has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const configureStore = (data, dispatch) => {
        const search = qs.parse(location.search, {
          arrayFormat: 'bracket',
        });
        dispatch({
      Severity: Minor
      Found in app/javascript/plugins/fundraiser/utils.ts - About 1 hr to fix

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

          render() {
            const { errors } = this.state;
            return (
              <div>
                {this.props.title && <h1> {this.props.title} </h1>}
        Severity: Minor
        Found in app/javascript/plugins/call_tool/CallToolView.js - About 1 hr to fix

          Function constructor has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(props) {
              super(props);
              const lang = window.champaign.page.language_code;
              this.state = {
                hostedFields: null,
          Severity: Minor
          Found in app/javascript/components/Braintree/BraintreeCardFields.js - About 1 hr to fix

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

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

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

                  if (optIn) {
                    optIn.addEventListener('click', () => {
                      if (this.petition) {
                        this.petition.updateForm({ consent: true });
                        this.petition.submit();
              Severity: Major
              Found in app/javascript/modules/consent/StandaloneConsentPrompt.ts and 1 other location - About 1 hr to fix
              app/javascript/modules/consent/StandaloneConsentPrompt.ts on lines 86..93

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

              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 (optOut) {
                    optOut.addEventListener('click', () => {
                      if (this.petition) {
                        this.petition.updateForm({ consent: false });
                        this.petition.submit();
              Severity: Major
              Found in app/javascript/modules/consent/StandaloneConsentPrompt.ts and 1 other location - About 1 hr to fix
              app/javascript/modules/consent/StandaloneConsentPrompt.ts on lines 77..84

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

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

              export function Thermometer(props) {
                // Only render if active
                if (isEmpty(props) || !props.active) return null;
                const currency = props.currency;
                const goal = props.goals[currency];
              Severity: Minor
              Found in app/javascript/components/Thermometer.js - About 1 hr to fix

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

                    const emitForcedLayoutSuccess = () => {
                      ee.emit(`${event}_forced_layout`, {
                        label: `${snakeCase(original)}_template_used_scroll_to_donate`,
                        amount: this.props.fundraiser.donationAmount,
                      });
                Severity: Major
                Found in app/javascript/components/Payment/Payment.js and 1 other location - About 1 hr to fix
                app/javascript/components/ExpressDonation/ExpressDonation.js on lines 94..99

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

                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

                    const emitForcedLayoutSuccess = () => {
                      ee.emit(`${event}_forced_layout`, {
                        label: `${snakeCase(original)}_template_used_scroll_to_donate`,
                        amount: this.props.fundraiser.donationAmount,
                      });
                app/javascript/components/Payment/Payment.js on lines 445..450

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

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

                  render() {
                    const { consented, showConsentRequired } = this.props;
                    const wrapperClass = classnames('ConsentControls', {
                      warning: showConsentRequired,
                    });
                Severity: Minor
                Found in app/javascript/components/consent/ConsentControls.js - About 1 hr to fix

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

                  it('can be disabled', () => {
                    const wrapper = shallow(<Checkbox disabled={true} />);
                  
                    expect(wrapper.find('input').prop('disabled')).toBeTruthy();
                  });
                  Severity: Major
                  Found in app/javascript/components/Checkbox/Checkbox.test.js and 1 other location - About 1 hr to fix
                  app/javascript/components/Checkbox/Checkbox.test.js on lines 27..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 67.

                  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

                  it('can be checked', () => {
                    const wrapper = shallow(<Checkbox checked={true} />);
                  
                    expect(wrapper.find('input').prop('checked')).toBeTruthy();
                  });
                  Severity: Major
                  Found in app/javascript/components/Checkbox/Checkbox.test.js and 1 other location - About 1 hr to fix
                  app/javascript/components/Checkbox/Checkbox.test.js on lines 21..25

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

                  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

                            data={{
                              src: this.state.src,
                              akid: this.state.akid,
                              recurringDefault: this.state.recurringDefault,
                              onlyRecurring: this.state.onlyRecurring,
                  Severity: Major
                  Found in app/javascript/components/Payment/Payment.js and 1 other location - About 1 hr to fix
                  app/javascript/plugins/call_tool/CallToolView.js on lines 73..79

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

                  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

                        return {
                          targetTitle: this.props.targetTitle,
                          targetName: this.props.targetName,
                          targetPhoneExtension: this.props.targetPhoneExtension,
                          targetPhoneNumber: this.props.targetPhoneNumber,
                  Severity: Major
                  Found in app/javascript/plugins/call_tool/CallToolView.js and 1 other location - About 1 hr to fix
                  app/javascript/components/Payment/Payment.js on lines 604..610

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

                  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

                  const ReCaptchaBranding = props => {
                    const className = props.className || 'ReCaptchaBranding';
                  
                    return (
                      <p className={className}>
                  Severity: Major
                  Found in app/javascript/components/ReCaptchaBranding.tsx and 1 other location - About 1 hr to fix
                  app/javascript/components/WeeklyDonationFinePrint.tsx on lines 4..15

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

                  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

                  const WeeklyDonationFinePrint = props => {
                    const className = props.className || 'ReCaptchaBranding';
                  
                    return (
                      <p className={className}>
                  Severity: Major
                  Found in app/javascript/components/WeeklyDonationFinePrint.tsx and 1 other location - About 1 hr to fix
                  app/javascript/components/ReCaptchaBranding.tsx on lines 4..15

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

                  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

                  Method choices_is_valid has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def choices_is_valid
                      return if choices.nil?
                  
                      if choices.class != Array
                        errors.add(:choices, 'must be an array of options')
                  Severity: Minor
                  Found in app/models/form_element.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 reducer has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const reducer = (state = initialState, action) => {
                    switch (action.type) {
                      case 'email_target:change_submitting':
                        return { ...state, isSubmitting: action.submitting };
                      case 'email_target:change_country':
                  Severity: Minor
                  Found in app/javascript/state/email_pension/actions.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language