Skip to content

Commit

Permalink
fix: review for code smell, duplicates, IDE notices (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyw authored Sep 17, 2024
1 parent f57f60a commit 46a5d10
Show file tree
Hide file tree
Showing 116 changed files with 18 additions and 42 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@
"@storybook/addon-webpack5-compiler-swc": "^1.0.2",
"@storybook/blocks": "^8.1.3",
"@storybook/cli": "^8.1.3",
"@storybook/manager-api": "^8.2.9",
"@storybook/react": "^8.1.3",
"@storybook/react-webpack5": "^8.1.3",
"@storybook/test": "^8.1.3",
"@storybook/theming": "^8.2.9",
"@svgr/rollup": "^8.1.0",
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.7",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss';
import url from '@rollup/plugin-url';
import rebase from 'rollup-plugin-rebase';
import path from 'path';

const packageJson = require('./package.json');

Expand Down
4 changes: 2 additions & 2 deletions src/ChangeFailureRateGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const composeGraphData = (_: ChartProps, data: DoraRecord[]) => {
successUrls: [],
};

if (record.status === true && !record.failed_at) {
if (record.status && !record.failed_at) {
count.successful = 1;
count.successUrls.push(record.deploy_url);
} else {
Expand All @@ -145,7 +145,7 @@ export const composeGraphData = (_: ChartProps, data: DoraRecord[]) => {

entry.repositories.set(key, count);
} else {
if (record.status === true && !record.failed_at) {
if (record.status && !record.failed_at) {
count.successful++;
count.successUrls.push(record.deploy_url);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/ChangeLeadTimeGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface ProcessRepository {
}

export const composeGraphData = (props: ChartProps, data: DoraRecord[]) => {
let reduced = data.reduce(
let resp = data.reduce(
(acc: Map<string, ProcessRepository[]>, record: DoraRecord) => {
if (!record.merged_at) {
return acc;
Expand Down Expand Up @@ -71,7 +71,7 @@ export const composeGraphData = (props: ChartProps, data: DoraRecord[]) => {
new Map<string, ProcessRepository[]>(),
);

return reduced;
return resp;
};

const renderTooltip = (payload: ProcessRepository, repository: string) => {
Expand Down
4 changes: 2 additions & 2 deletions src/Loading/loading.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
box-shadow: -38px -12px, -14px 0, 14px 0, 38px 0;
}
33% {
box-shadow: -38px 0px, -14px -12px, 14px 0, 38px 0;
box-shadow: -38px 0, -14px -12px, 14px 0, 38px 0;
}
66% {
box-shadow: -38px 0px, -14px 0, 14px -12px, 38px 0;
box-shadow: -38px 0, -14px 0, 14px -12px, 38px 0;
}
100% {
box-shadow: -38px 0, -14px 0, 14px 0, 38px -12px;
Expand Down
14 changes: 0 additions & 14 deletions src/ToolTip/tooltipContent.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,3 @@
font-size: 14px;
color: var(--react-dora-charts-text-color);
}

.tooltipWrapper {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: -5px;
left: -5px;
background-color: var(--react-dora-charts-background-color);
border-radius: 10px;
padding: 10px;
}
5 changes: 2 additions & 3 deletions src/TrendGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,10 @@ const filterGraphData = (
start: number,
end: number,
): GraphData[] => {
const filtered = data.filter((entry: GraphData) => {
const resp = data.filter((entry: GraphData) => {
return entry.date >= start && entry.date <= end;
});

return filtered;
return resp;
};

const TrendGraph: React.FC<TrendProps> = (props: TrendProps) => {
Expand Down
11 changes: 5 additions & 6 deletions src/functions/metricFunctions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ const calculateChangeFailureRateAverage = (
data: DoraRecord[],
): number => {
const totalSuccessfulRecords = data.filter(
f => f.status === true && !f.failed_at,
f => f.status && !f.failed_at,
).length;
const totalFailedRecords = data.filter(
f => f.status === false || (f.status === true && f.failed_at),
f => !f.status || (f.status && f.failed_at),
).length;

if (totalFailedRecords === 0 && totalSuccessfulRecords === 0) {
Expand Down Expand Up @@ -157,9 +157,8 @@ const calculateDeploymentFrequencyAverage = (
totalDeployTime += diff;
}

let avgDeployTime = totalDeployTime / sorted.length / millisecondsToHours;

return avgDeployTime;
const resp = totalDeployTime / sorted.length / millisecondsToHours;
return resp;
};

const calculateRecoverTimeAverage = (
Expand All @@ -170,7 +169,7 @@ const calculateRecoverTimeAverage = (
let totalRecoveryTime = 0;

data.forEach(record => {
if (record.status === true && !record.failed_at) {
if (record.status && !record.failed_at) {
return;
}

Expand Down
11 changes: 0 additions & 11 deletions src/icons/icon.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@
stroke: var(--react-dora-charts-primary-color);
}

.surround {
width: 100%;
height: 100%;
}

.icon {
position: absolute;
width: 33%;
height: 33%;
}

.iconContainer {
width: 96px;
height: 96px;
Expand Down
2 changes: 1 addition & 1 deletion stories/MetricEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface Props {
postFix?: string;
}

const capitalizeCamelCase = camelCaseString => {
const capitalizeCamelCase = (camelCaseString: string) => {
const words = camelCaseString.replace(/([a-z])([A-Z])/g, '$1 $2').split(' ');

const capitalizedWords = words.map(
Expand Down

0 comments on commit 46a5d10

Please sign in to comment.