| Conditions | 1 | 
| Total Lines | 108 | 
| Code Lines | 89 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React from "react";  | 
            ||
| 38 | |||
| 39 | export function SkillSubform({ | 
            ||
| 40 | keyPrefix,  | 
            ||
| 41 | jobId,  | 
            ||
| 42 | jobRequiredSkills,  | 
            ||
| 43 | jobOptionalSkills,  | 
            ||
| 44 | }: SkillSubformProps): React.ReactElement { | 
            ||
| 45 | const intl = useIntl();  | 
            ||
| 46 | const locale = getLocale(intl.locale);  | 
            ||
| 47 | |||
| 48 | const linkToJob = (text): React.ReactElement => (  | 
            ||
| 49 | <a  | 
            ||
| 50 |       href={jobShow(locale, jobId)} | 
            ||
| 51 |       title={intl.formatMessage(messages.linkToJobTitle)} | 
            ||
| 52 | target="_blank"  | 
            ||
| 53 | rel="noreferrer"  | 
            ||
| 54 | >  | 
            ||
| 55 |       {text} | 
            ||
| 56 | </a>  | 
            ||
| 57 | );  | 
            ||
| 58 | |||
| 59 | return (  | 
            ||
| 60 | <>  | 
            ||
| 61 | <div data-c-container="medium">  | 
            ||
| 62 | <p  | 
            ||
| 63 | data-c-margin="top(1) bottom(1)"  | 
            ||
| 64 | data-c-font-size="h4"  | 
            ||
| 65 | data-c-font-weight="bold"  | 
            ||
| 66 | data-c-color="c3"  | 
            ||
| 67 | >  | 
            ||
| 68 | <FormattedMessage  | 
            ||
| 69 | id="application.experienceModal.skillSubform.connectSubtitle"  | 
            ||
| 70 | defaultMessage="Connect This Experience to the Job"  | 
            ||
| 71 | description="Subtitle of Connect-to-skills section."  | 
            ||
| 72 | />  | 
            ||
| 73 | </p>  | 
            ||
| 74 | <p data-c-margin="bottom(1)">  | 
            ||
| 75 | <FormattedMessage  | 
            ||
| 76 | id="application.experienceModal.skillSubform.connectDescription"  | 
            ||
| 77 | defaultMessage="Below you can select which of the job skills you used during this experience. Later on, you’ll be asked to provide a few sentences to help managers understand how you used this skill. You can <a>review the definitions</a> of the skills on the job poster."  | 
            ||
| 78 | description="Explanation for Connect-to-skills section."  | 
            ||
| 79 |             values={{ | 
            ||
| 80 | a: (...chunks): React.ReactElement => linkToJob(chunks),  | 
            ||
| 81 | }}  | 
            ||
| 82 | />  | 
            ||
| 83 | </p>  | 
            ||
| 84 | <p data-c-margin="bottom(1)">  | 
            ||
| 85 | <FormattedMessage  | 
            ||
| 86 | id="application.experienceModal.skillSubform.connectDescription.noSkillsOkay"  | 
            ||
| 87 | defaultMessage="If none of the skills apply to this experience, feel free to save it without any skills selected."  | 
            ||
| 88 | description="Explanation that you can save an experience without connecting it to skills yet."  | 
            ||
| 89 | />  | 
            ||
| 90 | </p>  | 
            ||
| 91 | </div>  | 
            ||
| 92 | <div data-c-container="medium">  | 
            ||
| 93 | <div data-c-grid="gutter(all, 1) middle">  | 
            ||
| 94 | <div data-c-grid-item="base(1of1)">  | 
            ||
| 95 | <p data-c-font-weight="bold">  | 
            ||
| 96 | <FormattedMessage  | 
            ||
| 97 | id="application.experienceModal.skillSubform.requiredSkillsSubtitle"  | 
            ||
| 98 | defaultMessage="Please indicate which of the following <a>required skills</a> (if any) you used in this experience."  | 
            ||
| 99 | description="Title for the Required Skills checkbox."  | 
            ||
| 100 |                 values={{ | 
            ||
| 101 | a: (...chunks): React.ReactElement => linkToJob(chunks),  | 
            ||
| 102 | }}  | 
            ||
| 103 | />  | 
            ||
| 104 | </p>  | 
            ||
| 105 | </div>  | 
            ||
| 106 | <div data-c-grid-item="base(1of1)">  | 
            ||
| 107 | <CheckboxGroupField  | 
            ||
| 108 |               id={keyPrefix} | 
            ||
| 109 |               groupLabel={intl.formatMessage(messages.skillCheckboxGroupLabel)} | 
            ||
| 110 | grid="base(1of1)"  | 
            ||
| 111 | name="requiredSkills"  | 
            ||
| 112 |               allBoxes={jobRequiredSkills.map((skill) => ({ | 
            ||
| 113 | value: skill,  | 
            ||
| 114 | label: skill,  | 
            ||
| 115 | }))}  | 
            ||
| 116 | />  | 
            ||
| 117 | </div>  | 
            ||
| 118 | |||
| 119 | <div data-c-grid-item="base(1of1)">  | 
            ||
| 120 | <p data-c-font-weight="bold">  | 
            ||
| 121 | <FormattedMessage  | 
            ||
| 122 | id="application.experienceModal.skillSubform.optionalSkillsSubtitle"  | 
            ||
| 123 | defaultMessage="Please indicate which of the following <a>optional skills</a> (if any) you used in this experience."  | 
            ||
| 124 | description="Title for the Optional Skills checkbox."  | 
            ||
| 125 |                 values={{ | 
            ||
| 126 | a: (...chunks): React.ReactElement => linkToJob(chunks),  | 
            ||
| 127 | }}  | 
            ||
| 128 | />  | 
            ||
| 129 | </p>  | 
            ||
| 130 | </div>  | 
            ||
| 131 | <div data-c-grid-item="base(1of1)">  | 
            ||
| 132 | <CheckboxGroupField  | 
            ||
| 133 |               id={keyPrefix} | 
            ||
| 134 |               groupLabel={intl.formatMessage(messages.skillCheckboxGroupLabel)} | 
            ||
| 135 | grid="base(1of1)"  | 
            ||
| 136 | name="optionalSkills"  | 
            ||
| 137 |               allBoxes={jobOptionalSkills.map((skill) => ({ | 
            ||
| 138 | value: skill,  | 
            ||
| 139 | label: skill,  | 
            ||
| 140 | }))}  | 
            ||
| 141 | />  | 
            ||
| 142 | </div>  | 
            ||
| 143 | </div>  | 
            ||
| 144 | </div>  | 
            ||
| 145 | </>  | 
            ||
| 146 | );  | 
            ||
| 150 |