Skip to content

Commit

Permalink
Adding codceScene rules json to see if it changes how codeScene revie…
Browse files Browse the repository at this point in the history
…ws this PR
  • Loading branch information
dr-bizz committed Dec 17, 2024
1 parent 938cc10 commit 260ab26
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .codescene/code-health-rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"rule_sets": [
{
"matching_content_path": "**/*.ts",
"rules": [
{
"name": "Large Method",
"weight": 0.8
},
{
"name": "Complex Method",
"weight": 0.8
},
{
"name": "Lines of Code in a Single File",
"weight": 0.8
},
{
"name": "Number of Functions in a Single Module",
"weight": 0.8
},
{
"name": "Primitive Obsession",
"weight": 0.7
}
]
},
{
"matching_content_path": "**/*.test.ts",
"rules": [
{
"name": "Code Duplication",
"weight": 0.5
},
{
"name": "Large Method",
"weight": 0.5
},
{
"name": "Complex Method",
"weight": 0.5
},
{
"name": "Duplicated Assertion Blocks",
"weight": 0.0
},
{
"name": "Excess Number of Function Arguments",
"weight": 0.5
},
{
"name": "Large Assertion Blocks",
"weight": 0.7
},
{
"name": "Deep, Nested Complexity",
"weight": 0.7
}
]
}
]
}
4 changes: 4 additions & 0 deletions src/components/Coaching/CoachingDetail/CoachingDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { styled } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import DonationHistories from 'src/components/Dashboard/DonationHistories';
import MonthlyGoal from 'src/components/Dashboard/MonthlyGoal/MonthlyGoal';
import { useGetTaskAnalyticsQuery } from 'src/components/Dashboard/ThisWeek/NewsletterMenu/NewsletterMenu.generated';
import { navBarHeight } from 'src/components/Layouts/Primary/Primary';
import { useGetDonationGraphQuery } from 'src/components/Reports/DonationsReport/GetDonationGraph.generated';
Expand Down Expand Up @@ -213,6 +214,9 @@ export const CoachingDetail: React.FC<CoachingDetailProps> = ({
}
currencyCode={accountListData?.currency}
/>

<MonthlyGoal accountListId={accountListId} />

Check warning on line 219 in src/components/Coaching/CoachingDetail/CoachingDetail.tsx

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (health-indicator)

❌ Getting worse: Complex Method

CoachingDetail:React.FC<CoachingDetailProps> already has high cyclomatic complexity, and now it increases in Lines of Code from 160 to 161. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
<MonthlyCommitment
coachingId={accountListId}
accountListType={accountListType}
Expand Down

0 comments on commit 260ab26

Please sign in to comment.