Showing 12,846 of 12,846 total issues
Function generateDocsFiled
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const generateDocsFiled = docsFiled => {
return docsFiled.map(document => {
if (document.id && document.status) {
return {
requestTypeText: `Request type: ${document.displayName}`,
Function groupTimelineActivity
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function groupTimelineActivity(events) {
const phases = {};
let activity = [];
const phaseEvents = events
Function vetTecCheckbox
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const vetTecCheckbox = (
vettec,
preferredProvider,
handleVetTecChange,
handlePreferredProviderChange,
Function addStatusToIssues
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function addStatusToIssues(issues) {
return issues.map(issue => {
let status = '';
switch (issue.lastAction) {
case ISSUE_STATUS.fieldGrant:
Function handleCompareUpdate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleCompareUpdate = e => {
if (e.target.checked && !compareChecked) {
if (compare.search.loaded.length === 3) {
recordEvent({
event: 'gibct-form-change',
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className="calculator-form">
<p>Use the fields below to update your benefits.</p>
{this.renderApprovedProgramsSelector()}
Function otherCheckboxes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function otherCheckboxes(
handleVetTechPreferredProviderChange,
options,
smallScreen,
automatedTest = false,
Function handleScroll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleScroll = () => {
const topOffset =
document
.getElementById('estimate-your-benefits-accordion')
?.getBoundingClientRect().top -
Function handleCompareUpdate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleCompareUpdate = e => {
if (e.target.checked && !compareChecked) {
if (compareLength === 3) {
recordEvent({
event: 'gibct-form-change',
Function fetchSearchByNameResults
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function fetchSearchByNameResults(name, page, filters, version) {
const params = { name, page, ...rubyifyKeys(buildSearchFilters(filters)) };
if (version) {
params.version = version;
}
Function renderMilitaryDetails
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const renderMilitaryDetails = () => {
const name = 'Your military details';
return (
<AccordionItem
Function FourthFAQSection
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const FourthFAQSection = () => {
return (
<>
<h3 className="dhp-faq-section-header">Feedback</h3>
<va-accordion
Function handleSelectionChange
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleSelectionChange = selection => {
const highestRankTemp =
typeof selection === 'string' ? selection : selection.key;
if (selection.key)
setRank(`${selection.key.toUpperCase()} - ${selection.value}`);
Function editAddressSuccess
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
rest.post(`${prefix}/v0/profile/address_validation`, (req, res, ctx) => {
return res(
ctx.json({
addresses: [
{
Function getClaims
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getClaims() {
const startTimestampMs = Date.now();
return dispatch => {
dispatch({ type: FETCH_CLAIMS_PENDING });
Function convertAdmissionAndDischargeDetails
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const convertAdmissionAndDischargeDetails = record => {
const summary = getNote(record);
const admissionDate = getAdmissionDate(record, summary);
const dischargeDate = getDischargeDate(record, summary);
Function labAndTestDetails
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const labAndTestDetails = useMemo(() => {
return {
name: 'ANKLE LEFT 3 VIEWS',
category: 'Radiology',
orderedBy: 'DOE, JANE A',
Function LastFilledInfo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const LastFilledInfo = rx => {
const { dispStatus, orderedDate, sortedDispensedDate } = rx;
let nonVA = false;
let showLastFilledDate = false;
if (dispStatus === dispStatusObj.nonVA) {
Function ui:description
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
'ui:description': () => {
return (
<div className="vads-u-margin-y--3">
<va-accordion uswds bordered open-single>
<va-accordion-item
Similar blocks of code found in 14 locations. Consider refactoring. Open
LogoRow.propTypes = {
isMenuOpen: PropTypes.bool.isRequired,
setIsMenuOpen: PropTypes.func.isRequired,
showNavLogin: PropTypes.bool,
updateExpandedMenuID: PropTypes.func,
- Read upRead up
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 56.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76