Showing 1,408 of 1,408 total issues
Function prepareLayersData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
prepareLayersData(state: FlowMapState, props: FlowMapData<L, F>): LayersData {
const locations = this.getLocationsForFlowMapLayer(state, props) || [];
const flows = this.getFlowsForFlowMapLayer(state, props) || [];
const { getFlowOriginId, getFlowDestId, getFlowMagnitude, getLocationId, getLocationCentroid } =
this.accessors;
- Read upRead up
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 ModeControl
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ModeControl: React.FC = () => {
const { visualizationMode } = useAppSelector(analysisUI);
const { query } = useRouter();
const [syncedIndicators] = useSyncIndicators();
const { detail, ...restQuery } = query;
Function AdminDataUploader
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
const AdminDataUploader: React.FC = () => {
const { data: lastTask } = useLasTask();
return (
<div className="flex h-full w-full items-center justify-center">
Function saveChunks
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async saveChunks<IndicatorRecord>(
entities: IndicatorRecord[],
options?: SaveOptions,
): Promise<IndicatorRecord[]> {
const queryRunner: QueryRunner = this.dataSource.createQueryRunner();
Function generateNewSourcingLocation
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateNewSourcingLocation(
dto: CreateScenarioInterventionDto,
sourcingData: SourcingLocation[],
locationData: {
adminRegionId: string;
Function getImpactMapByResolution
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getImpactMapByResolution(
getImpactMapDto:
| GetImpactMapDto
| GetActualVsScenarioImpactMapDto
| GetScenarioVsScenarioImpactMapDto,
Function aggregateAndCalculatePercentage
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const aggregateAndCalculatePercentage = (
records: any[],
): AggregatedVoumeAndPlotByYear[] => {
const withGeoRegion: VolumeAndPlotByYear[] = records.filter(
(record: VolumeAndPlotByYear) => record.geoRegionId !== null,
Function validateCleanData
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async validateCleanData(nonEmptyData: SourcingData[]): Promise<void> {
const excelErrors: {
line: number;
column: string;
errors: { [type: string]: string } | undefined;
Function relateSourcingDataWithOrganizationalEntities
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
async relateSourcingDataWithOrganizationalEntities(
suppliers: Supplier[],
businessUnits: Record<string, any>[],
materials: Material[],
sourcingData: SourcingData[],
Function getFlowAndCircleColors
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getFlowAndCircleColors(
inputColors: FlowAndCircleColors | undefined,
defaultFlowColorScheme: string[],
darkMode: boolean,
): FlowAndCircleColorsRGBA {
Similar blocks of code found in 2 locations. Consider refactoring. Open
@ApiProperty({
description: `The sort order for the resulting entities. Can be 'ASC' (Ascendant) or 'DES' (Descendent), with the default being 'DES'`,
})
@Type(() => String)
@IsString()
- 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 63.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
@ApiProperty({
description: `The sort order by Name for the resulting entities. Can be 'ASC' (Ascendant) or 'DESC' (Descendent). Defaults to ASC`,
})
@Type(() => String)
@IsString()
- 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 63.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
<Button
variant="ghost"
type="button"
className={cn(
'h-[22px] rounded-none rounded-bl-md rounded-tl-md border border-gray-300 text-gray-300',
- 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 63.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
<Button
variant="ghost"
type="button"
className={cn(
'h-[22px] rounded-none rounded-br-md rounded-tr-md border border-gray-300 text-gray-300',
- 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 63.
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
Function chartData
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const chartData = useMemo<ChartData>(() => {
const { indicatorShortName, yearSum, metadata } = data?.data?.impactTable?.[0] || {};
const nonProjectedData = (yearSum?.filter(({ isProjected }) => !isProjected) || []).sort(
({ year }) => year,
);
Function getScenarioInterventionsByScenarioId
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getScenarioInterventionsByScenarioId(
scenarioId: string,
): Promise<ScenarioIntervention[]> {
// TODO: Join with suppliers and selecting supplier field commented out due to performance issues
// This needs to be restored
Function calculateIndicatorSumByYear
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private calculateIndicatorSumByYear(
entityMap: Map<string, Map<number, ActualVsScenarioImpactTableRowsValues>>,
rangeOfYears: number[],
lastYearWithData: number,
): ActualVsScenarioIndicatorSumByYear[] {
Function saveChunks
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async saveChunks(
entities: SourcingLocation[],
options?: SaveOptions,
): Promise<SourcingLocation[]> {
const queryRunner: QueryRunner = this.dataSource.createQueryRunner();
Function Hero
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Hero: React.FC = () => {
return (
<section className="relative z-10 bg-white">
<Wrapper>
<motion.div
Function FAQs
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
const FAQs: React.FC = () => {
return (
<section className="bg-white">
<div className="relative z-10">
<Wrapper>