Skip to content

Commit

Permalink
refactor: replace TODO with HACK or REFACTOR (#5185)
Browse files Browse the repository at this point in the history
* refactor: replace TODO with HACK or REFACTOR

Signed-off-by: yuda <yuda@megazone.com>

* refactor: replace TODO with HACK or REFACTOR

Signed-off-by: yuda <yuda@megazone.com>

* feat: add excluded files

Signed-off-by: yuda <yuda@megazone.com>

* chore: exclude lottie.js

Signed-off-by: yuda <yuda@megazone.com>

* chore: update excluded files

Signed-off-by: yuda <yuda@megazone.com>

* chore: remove console.log checks from failure conditions

Signed-off-by: yuda <yuda@megazone.com>

* chore: exclude file

Signed-off-by: yuda <yuda@megazone.com>

* chore: chore

Signed-off-by: yuda <yuda@megazone.com>

* chore: target

Signed-off-by: yuda <yuda@megazone.com>

* chore: chore

Signed-off-by: yuda <yuda@megazone.com>

* chore: edit exclude path

Signed-off-by: yuda <yuda@megazone.com>

* chore: fix file path

Signed-off-by: yuda <yuda@megazone.com>

* chore: update path

Signed-off-by: yuda <yuda@megazone.com>

---------

Signed-off-by: yuda <yuda@megazone.com>
  • Loading branch information
yuda110 authored Dec 9, 2024
1 parent 0b10e21 commit c22e99e
Show file tree
Hide file tree
Showing 46 changed files with 45 additions and 72 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_code_warning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
id: check_todo
run: |
echo "Checking for TODOs..."
TODO_FILES=$(grep -rl "TODO" . --exclude-dir={node_modules,.git} || true)
TODO_FILES=$(grep -rl "TODO" apps/web/src --exclude-dir={node_modules,.github} || true)
TODO_COUNT=0
if [ -n "$TODO_FILES" ]; then
echo "The following files contain TODO:"
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
run: |
echo "TODO Count: $todo_count"
echo "console.log Count: $console_log_count"
if [ "$todo_count" -gt 0 ] || [ "$console_log_count" -gt 0 ]; then
if [ "$todo_count" -gt 0 ]; then
echo "::warning:: Workflow failed. TODO count: $todo_count, console.log count: $console_log_count"
exit 1
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ describe('Date Range Formatter Composable', () => {

it('Should be displayed in the format of "Sep 11, YYYY" when the start and end dates are in the same year and month, and end month is this month.', async () => {
const _currentDate = dayjs.utc().set('date', 11);
console.log(_currentDate.format('YYYY-MM-DD'));
await wrapper.setProps({
dateRange: {
start: _currentDate.format('YYYY-MM-DD'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,6 @@ onMounted(async () => {
</span>
</div>
</div>
<!-- TODO: low priority -->
<!-- <favorite-button v-if="item.subMenuList?.length === 0"-->
<!-- class="favorite-button"-->
<!-- :item-id="item.id"-->
<!-- :favorite-type="FAVORITE_TYPE.MENU"-->
<!-- scale="0.65"-->
<!-- />-->
</router-link>
<div v-else>
<div v-if="state.isMenuDescription"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const handleFocusEnd = (type: SuggestionType, direction: FocusingDirection) => {
if (type === SUGGESTION_TYPE.DEFAULT_SERVICE && direction === 'DOWNWARD') {
state.proxyFocusingDirection = direction;
}
// TODO: need UPWARD case
// HACK: need UPWARD case
emit('move-focus-end');
};
Expand All @@ -84,7 +84,7 @@ watch(() => contentsSize.height.value, (height) => {
});
// /* Watcher */
// TODO: for focusing
// HACK: for focusing
// watch(() => props.isFocused, (isFocused) => {
// if (isFocused) {
// if (props.focusingDirection === 'DOWNWARD') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ const init = async () => {
gnbStore.fetchMetricExample(),
gnbStore.fetchCostQuerySet(),
dashboardStore.load(),
// TODO: If GNBDashboardMenu is deprecated, you need to add a request to receive a dashboard list here.
// HACK: If GNBDashboardMenu is deprecated, you need to add a request to receive a dashboard list here.
]);
state.loading = false;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ watch(() => props.visible, (value) => {
@click.stop="handleProfileButtonClick"
@keydown.enter="openProfileMenu"
>
<!-- TODO: Will add user image src -->
<p-avatar v-if="state.visibleRoleType !== 'Admin' && state.visibleAvatar"
class="menu-icon"
size="md"
Expand All @@ -246,7 +245,6 @@ watch(() => props.visible, (value) => {
class="profile-menu-wrapper"
>
<div class="user-info">
<!-- TODO: Will add user image src -->
<p-avatar v-if="state.visibleRoleType !== 'Admin' && state.visibleAvatar"
size="sm"
/>
Expand Down Expand Up @@ -305,7 +303,7 @@ watch(() => props.visible, (value) => {
height="1rem"
/>
</div>
<!-- TODO: This code might need recovery in version 1.13.-->
<!-- HACK: This code might need recovery in version 1.13.-->
<!-- <div v-on-click-outside="handleClickOutsideCurrencyMenu"-->
<!-- class="info-menu currency"-->
<!-- @click.stop="handleCurrencyDropdownClick"-->
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/common/modules/page-layouts/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export interface Breadcrumb {
name: TranslateResult|string;
to?: Location;
copiable?: boolean;
data?: ProjectGroupTreeNodeData // TODO: refactor this with renewaled project tree
data?: ProjectGroupTreeNodeData // REFACTOR: refactor this with renewaled project tree
}
2 changes: 1 addition & 1 deletion apps/web/src/common/modules/portals/TopNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const storeState = reactive({
const state = reactive({
visible: computed({
get() {
// TODO: this (my-page guard) is a temporary solution. It should be refactored.
// REFACTOR: this (my-page guard) is a temporary solution. It should be refactored.
let result: boolean;
if (storeState.hasPermission || storeState.workspaceList.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ const advancedOptionsState = reactive({
{ label: 'None', name: 'none' },
{ label: 'Year', name: 'years' },
{ label: 'Month', name: 'months' },
// TODO: to be deprecated
// { label: 'Day', name: 'days' },
]),
timeDiffDateMap: computed<Record<string, SelectDropdownMenuItem[]>>(() => ({
years: range(2).map((i) => ({
Expand All @@ -106,11 +104,6 @@ const advancedOptionsState = reactive({
label: i === 0 ? 'Last 1 Month' : `Last ${i + 1} Months`,
name: String(i + 1),
})),
// TODO: to be deprecated
// days: range(31).map((i) => ({
// label: i === 0 ? 'Last 1 Day' : `Last ${i + 1} Days`,
// name: String(i + 1),
// })),
})),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
// const costPieSchema = costPieWidgetConfig.options_schema;

describe('[Widget Config Helper] getWidgetConfig', () => {
// TODO: SpaceConnector must be initialized before testing
// NOTE: SpaceConnector must be initialized before testing
it('dummy test', () => {
expect(true).toBeTruthy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export const getWidgetComponent = (widgetConfigId: string): AsyncComponent|undef

export const getWidgetFieldComponent = (fieldName: WidgetFieldName): AsyncComponent => {
const widgetFieldComponent = WIDGET_FIELD_COMPONENTS[fieldName];
// TODO: Uncomment this line after all widget field components are implemented
// if (!widgetFieldComponent) throw new Error(`No matching widget component found. ${widgetFieldComponent} does not exist.`);

return widgetFieldComponent;
};
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const state = reactive({
customModalVisible: false as boolean,
customTargetDataField: '' as string,
customNumberFormat: '#,##0' as string,
numberFormatHelpLink: computed<string>(() => ''), // TODO: add link
});
/* Util */
Expand Down Expand Up @@ -215,7 +214,7 @@ watch(() => state.customModalVisible, (modalVisible) => {
<p class="sample-text">
{{ $t('COMMON.WIDGETS.NUMBER_FORMAT.SAMPLE') }}: {{ getFormattedNumber(state.customNumberFormat) }}
</p>
<!-- TODO: To be activated after guide completion-->
<!--HACK: To be activated after guide completion-->
<!-- <p-link :href="state.numberFormatHelpLink"-->
<!-- :action-icon="ACTION_ICON.EXTERNAL_LINK"-->
<!-- highlight-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const getField = (field: TableWidgetField): string => {
};
const valueFormatter = (value: TableDataValue, field: TableWidgetField) => {
// TODO: handle missing value after applying table missing value
// HACK: handle missing value after applying table missing value
// // handle missing value
// const isMissingValue = value === null || value === undefined;
// if (isMissingValue && props.missingValueInfo?.value === 'lineBreaks') return TABLE_MISSING_VALUE_SYMBOL;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/common/modules/widgets/types/widget-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
EVAL_EXPRESSION_TYPE,
} from '@/common/modules/widgets/_constants/data-table-constant';

export type WidgetType = string; // TODO: make this widget type enum
export type WidgetType = string; // HACK: make this widget type enum

export type DataTableState = 'AVAILABLE' | 'UNAVAILABLE';

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/lib/access-control/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const WORKSPACE_MEMBER_DEFAULT_PERMISSIONS: MenuId[] = [
MENU_ID.NOTICE,
];

// TODO: this need to be changed with new SYSTEM domain planning
// HACK: this need to be changed with new SYSTEM domain planning
export const SYSTEM_USER_DEFAULT_PERMISSIONS: MenuId[] = [
MENU_ID.IAM,
MENU_ID.ROLE,
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/lib/helper/config-data-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const convertMenuConfigToReferenceData = (config: ConfigData[]|null, menu
const convertMenuList = cloneDeep(menuList);
// const costIdx = convertMenuList.findIndex((i) => i.id === MENU_ID.COST_EXPLORER);

// TODO: will be applied after the cost explorer menu is updated
// NOTE: will be applied after the cost explorer menu is updated
// if (convertMenuList[costIdx].subMenuList?.length === 4) {
// convertMenuList[costIdx].subMenuList?.push(
// {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export default class ResourceVariableModel<T=any> implements IResourceVariableMo
values: this.stat(options.key as string, options.presetValues),
};

// TODO: keys method binding
return propertyObject;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const {
});
const handleClickSendCode = () => {
// TODO: send verification code to admin email
// HACK: send verification code to admin email
state.isCodeSent = true;
};
const confirm = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const formState = reactive({
commonValidForDelay: false,
isValid: computed(() => {
if (state.step === 1) return formState.firstStepValid;
// TODO: apply loading state
// HACK: apply loading state
return true;
}),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ watch(() => props.serviceAccountId, async (serviceAccountId) => {
:editable="state.isEditable"
@refresh="handleRefresh"
/>
<!-- TODO: To be implemented after further discussion-->
<!-- HACK: To be implemented after further discussion-->
<!-- <service-account-usage-overview v-if="!state.isTrustedAccount"-->
<!-- :service-account-loading="state.loading"-->
<!-- :service-account-id="props.serviceAccountId"-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const {
},
});
// TODO: type check
// HACK: type check
const handleClickBoardItem = (item) => {
state.selectedRules = item;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const handleSelectPeriod = (periodMenuName: string) => {
temp chart area
</div>
<div class="legend-wrapper">
<!-- TODO: temp data -->
<!-- HACK: temp data -->
<div class="legend">
<span>2023-01-01</span>
<span class="count">8</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface Props {
const props = defineProps<Props>();
const state = reactive({
notifyLevelList: [ // TODO: Remove this dummy data
notifyLevelList: [ // HACK: Remove this dummy data
{ threshold: { upDown: 'increase', value: 5 }, notifyLevel: NOTIFY_LEVEL.INFO },
{ threshold: { upDown: 'increase', value: 10 }, notifyLevel: NOTIFY_LEVEL.MINOR },
{ threshold: { upDown: 'decrease', value: 5 }, notifyLevel: NOTIFY_LEVEL.MODERATE },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const DETECTION_CONFIGURATION_HANDLERS = {
},
],
}] as KeyItemSet[],
// TODO: temp code
// HACK: temp code
valueHandlerMap: {
name: makeDistinctValueHandler('cost_analysis.AnomalyDetectionConfiguration', 'name', 'string', [{ k: 'name', v: '', o: 'not' }]),
policy: makeDistinctValueHandler('cost_analysis.AnomalyDetectionConfiguration', 'policy'),
Expand Down Expand Up @@ -138,7 +138,7 @@ export const DETECTION_HISTORY_HANDLERS = {
},
],
}] as KeyItemSet[],
// TODO: temp code
// HACK: temp code
valueHandlerMap: {
name: makeDistinctValueHandler('cost_analysis.AnomalyDetectionConfiguration', 'name', 'string', [{ k: 'name', v: '', o: 'not' }]),
config_id: makeDistinctValueHandler('cost_analysis.AnomalyDetectionConfiguration', 'config_id'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@ const state = reactive({
selectedSharedScope: 'WORKSPACE' as DashboardScope,
showBadge: computed<boolean>(() => {
if (dashboardDetailGetters.dashboardInfo?.user_id) return true;
// TODO: is admin type dashboard, return true
return state.isSharedDashboard;
}),
// TODO: is admin type dashboard, return 'solid-outline'
badgeType: computed<BadgeType>(() => 'subtle'),
badgeStyleType: computed<BadgeStyleType>(() => {
if (dashboardDetailGetters.isPrivate) return 'gray150';
if (state.sharedScope === 'PROJECT') return 'primary3';
// TODO: is admin type dashboard, return 'indigo500'
return 'indigo100';
}),
badgeText: computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const {
if (props.variableNames.includes(value)) {
return i18n.t('DASHBOARDS.CUSTOMIZE.VARIABLES.VALIDATION_NAME_REQUIRED');
}
// TODO: add invalid text about name length
// HACK: add invalid text about name length
return value.trim().length > 0;
},
});
Expand Down Expand Up @@ -83,7 +83,7 @@ const state = reactive({
options: [
{ draggableItemId: getRandomId(), key: '', label: '' },
] as ManageVariableFormOption[],
resourceKey: '', // TODO: setting resource key in 'SEARCH_RESOURCE' option type
resourceKey: '', // HACK: setting resource key in 'SEARCH_RESOURCE' option type
selectionMenu: computed(() => [
{ name: 'MULTI', label: i18n.t('DASHBOARDS.CUSTOMIZE.VARIABLES.MULTI_SELECT') },
{ name: 'SINGLE', label: i18n.t('DASHBOARDS.CUSTOMIZE.VARIABLES.SINGLE_SELECT') },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const fetchData = async (): Promise<Data[]> => {
apiQueryHelper.setFilters(widgetState.consoleFilters);
if (pageSize.value) apiQueryHelper.setPage(getPageStart(thisPage.value, pageSize.value), pageSize.value);
// TODO: temp code
// NOTE: temp code
let _dataField = widgetState.dataField;
if (widgetState.dataField === 'additional_info.service') _dataField = 'data.service';
if (widgetState.dataField === 'additional_info.status') _dataField = 'data.status';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const useWidgetFrame = (
const nonInheritOptions = getNonInheritedWidgetOptionNamesAmongUsedVariables(props.dashboardVariablesSchema, widgetState.inheritOptions, widgetState.schemaProperties);
if (!nonInheritOptions.length) return undefined;

// TODO: widget option name must be changed to readable name.
// const tooltipText = nonInheritOptions.map((d) => `<p>• ${getWidgetOptionsSchemaPropertyName(d)}</p>`).join('\n');
const tooltipText = nonInheritOptions.map((d) => `<p>• ${d}</p>`).join('\n');
return `${i18n.t('DASHBOARDS.WIDGET.INHERIT_OPTIONS_TOOLTIP_TEXT_1')}</br></br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
// const costPieSchema = costPieWidgetConfig.options_schema;

describe('[Widget Config Helper] getWidgetConfig', () => {
// TODO: SpaceConnector must be initialized before testing
// NOTE: SpaceConnector must be initialized before testing
it('dummy test', () => {
expect(true).toBeTruthy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ watch(() => state.data?.email_verified, (value) => {
>
<template #default="{invalid}">
<div class="input-form">
<!-- TODO: need to apply placeholder changes based on the distinction between open source and SaaS. -->
<!-- HACK: need to apply placeholder changes based on the distinction between open source and SaaS. -->
<p-text-input :value="email"
:invalid="invalid"
placeholder="user@spaceone.io"
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/services/my-page/pages/UserAccountPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const state = reactive({
<div class="contents-wrapper">
<p-pane-layout class="role-card-content">
<div class="icon-wrapper">
<!-- TODO: Will add user image src -->
<p-avatar size="xl" />
<p-lazy-img v-if="state.roleType === 'Admin'"
:src="state.icon"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const OPERATOR = Object.freeze({
interface Props {
conditionsPolicy?: string;
conditions?: any[]; // TODO: set type
conditions?: any[]; // HACK: set type
projectId?: string;
}
const props = withDefaults(defineProps<Props>(), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ onMounted(async () => {
<div class="info">
<p>{{ item.name }}</p>
</div>
<!-- TODO: will be updated field name -->
<!-- HACK: will be updated field name -->
<p-link v-if="item.tags.url"
new-tab
highlight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const handleClickCreate = async () => {
}
};
// TODO: Planned for future implementation
// HACK: Planned for future implementation
// watch(() => state.pluginVersions, (version) => {
// if (version) {
// getPluginMetaData();
Expand Down Expand Up @@ -171,7 +171,7 @@ onMounted(() => {
<p class="desc">
{{ props.selectedType.tags?.long_description || props.selectedType.tags?.description }}
</p>
<!-- TODO: will be updated field name -->
<!-- HACK: will be updated field name -->
<p-link v-if="props.selectedType.tags?.url"
new-tab
highlight
Expand Down
Loading

0 comments on commit c22e99e

Please sign in to comment.