Skip to content

refactor(view): groupCommitsByReleaseTags 함수 개선#940

Merged
lee-kyu-hwan merged 6 commits into
githru:newvizfrom
lee-kyu-hwan:931-refactor/group-commits-by-release-tags
Oct 9, 2025
Merged

refactor(view): groupCommitsByReleaseTags 함수 개선#940
lee-kyu-hwan merged 6 commits into
githru:newvizfrom
lee-kyu-hwan:931-refactor/group-commits-by-release-tags

Conversation

@lee-kyu-hwan

Copy link
Copy Markdown
Member

Related issue

#931

Result

  • groupCommitsByReleaseTags 함수를 함수형 프로그래밍 방식으로 리팩토링
  • Non-null assertion(!) 제거 및 타입 가드 적용
  • JSDoc 주석 영어로 개선

Work list

  • groupCommitsByReleaseTags를 reduce 패턴으로 리팩토링
  • Non-null assertion 제거 및 안전한 타입 체크 적용
  • JSDoc 주석 개선 및 영어 전환
  • 코드 가독성 및 유지보수성 개선

Discussion

함수형 프로그래밍 접근과 타입 안정성 강화를 통해 코드 품질을 개선했습니다. 기능 변경은 없습니다.

- 명령형에서 함수형 프로그래밍 스타일로 전환
  - forEach + push 패턴을 flatMap으로 변경
  - for 루프를 reduce로 교체하여 불변성 보장
  - unshift 사용을 spread 연산자로 대체

- 타입 안정성 강화
  - ReduceAccumulator 인터페이스 명시적 선언
  - extractReleaseContributorActivities에 반환 타입 추가
  - ReleaseContributorActivity 타입 import 추가

- 코드 품질 개선
  - ESLint no-plusplus 규칙 준수 (++ 연산자 제거)
  - 불필요한 non-null assertion 제거
  - 가독성을 위한 변수 구조 분해 할당 추가

- JSDoc 및 주석 개선
  - 모든 함수에 영문 JSDoc 주석 추가
  - 인라인 주석을 한글에서 영문으로 변경
  - 파라미터 및 반환값 설명 보완

- 코드 포맷팅 통일
  - 화살표 함수 일관성 적용
  - 타입 선언 포맷팅 개선
  - trailing comma 통일
- Map.get() 결과에 대한 명시적 null 체크로 ! 연산자 제거
- @typescript-eslint/no-non-null-assertion 규칙 준수
- 타입 안정성 및 런타임 안전성 개선
@lee-kyu-hwan lee-kyu-hwan self-assigned this Oct 7, 2025
Copilot AI review requested due to automatic review settings October 7, 2025 14:19
@lee-kyu-hwan
lee-kyu-hwan requested review from a team as code owners October 7, 2025 14:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the groupCommitsByReleaseTags function using functional programming principles while removing non-null assertions and improving documentation. The refactoring enhances code safety and maintainability without changing functionality.

  • Functional programming approach using reduce pattern instead of imperative loops
  • Non-null assertion removal with proper type guards
  • JSDoc comments translated to English with comprehensive parameter documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

oortmealy
oortmealy previously approved these changes Oct 7, 2025

@oortmealy oortmealy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!!👍👍

hyemimi
hyemimi previously approved these changes Oct 7, 2025

@hyemimi hyemimi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 입니다👍 수고 많으셨어요~!

@hyemimi

hyemimi commented Oct 7, 2025

Copy link
Copy Markdown
Contributor

PR 타이틀은 다른 PR들처럼 컨벤션에 맞게 수정해주시면 좋을 것 같아요!

ytaek
ytaek previously approved these changes Oct 8, 2025

@ytaek ytaek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드가 깔끔해지고 있습니다!!! LGGGGGGGGGGGGGTM@!!!


/**
* 폴더 경로에서 지정된 깊이의 폴더를 추출
* Extracts folder path at specified depth from file path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍👍👍👍

단순히 주석을 가볍게 적을 꺼면, 차라리 변수명 등의소스코드 내의 context로 표현하는 것이 맞는 것 같고
명시적으로 적고 싶다면 이렇게 doxygen 타입으로 적는게 맞는 것 같습니다!!
주석도 소스코드의 일부분이기 때문에 관리해야 하는 loc 니까요!

lastGroup: preReleaseGroup,
};
},
{ groups: [], lastGroup: null }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오홍 저는 typing을 여기다가 해왔었는데,
groups: [ ] as ReduceAccu..
reduce<> 에다가 선언을 해버리는게 깔끔해보이네요. 잘 배워갑니다.

Comment on lines +149 to +150
string,
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기는 linting이 다른 것과 다르게 됐네요? 흠 rule이 뭔지 헷갈리는군요 ㅋㅋ

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드를 보니 다른곳과 일관성이 부족한것 같아서 인터페이스로 분리해서 일관되도록 수정했습니다!

@hyemimi hyemimi added the newviz label Oct 8, 2025
Jxxunnn
Jxxunnn previously approved these changes Oct 8, 2025

@Jxxunnn Jxxunnn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로직 문제를 함수형으로 해결하도록 변경한 리팩터네요. 작업이 명확히 분리되면서 각 단계 역할이 잘 드러나는 것 같아요. 테스트 디버깅 가독성 등 다양한 이점이 있을 것 같습니다 ㅎㅎ 고생하셨습니다. 👍


const releaseGroups: ReleaseGroup[] = [];
let currentGroup: ReleaseGroup | null = null;
// Flatten all commits and sort chronologically

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이미 코드에서 어떤 작업을 수행하는지 잘 나타나서 이런 경우에는 주석이 없어도 될 것 같네요!
JSDoc 쓰신 경우와 일반 주석 쓰신 기준이 개인적으로 살짝 궁금..? (AI가 추가한 것같기도 하구요)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSDoc을 작성했어도 추가로 주석이 필요하다면 요청을해서(AI)작성을 했었는데 준근님 말씀대로 JSDoc과 중복되는 부분이 많아서 지우는게 좋을것 같네요ㅎㅎ

groupCommitsByReleaseTags 함수에서 불변성을 유지하면서
배열 업데이트 성능을 개선했습니다.

- slice(0, -1)과 spread operator 중복 사용 제거
- 배열 복사를 1회로 줄여 성능 향상
- 불변성은 slice()를 통해 유지
@lee-kyu-hwan
lee-kyu-hwan dismissed stale reviews from Jxxunnn, ytaek, hyemimi, and oortmealy via 5720716 October 9, 2025 07:16
@lee-kyu-hwan lee-kyu-hwan changed the title 931 refactor/group commits by release tags refactor(view): groupCommitsByReleaseTags 함수 개선 Oct 9, 2025
인라인으로 정의된 복잡한 Map 제네릭 타입을 별도 인터페이스로
추출하여 포맷팅 일관성을 개선했습니다.

- FolderStats 인터페이스 추출 (analyzeReleaseFolderActivity)
- ContributorFolderStats 인터페이스 추출 (extractReleaseContributorActivities)
- 린팅 규칙에 관계없이 일관된 타입 정의 스타일 적용
코드가 자명한 경우 중복된 주석을 제거하여 가독성을 개선했습니다.

@Jxxunnn Jxxunnn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다! 👍

@lee-kyu-hwan
lee-kyu-hwan merged commit 6df8971 into githru:newviz Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants