Thuta Learning
Git & GitHub: Collaboration and Professional Workflows
BasicDevOps & Toolsintermediate

Code Review ကောင်းမွန်စွာ လုပ်ဆောင်ခြင်း

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Code Review ကောင်းမွန်စွာ လုပ်ဆောင်ခြင်း concept ကို နားလည်ရှင်းပြနိုင်ရန်
  • Diagram ကို ဖတ်ပြီး Git/GitHub workflow ထဲမှာ state (သို့) data ဘယ်လိုစီးဆင်းသလဲ ခြေရာခံနိုင်ရန်
  • ကိုယ့် project/team အတွက် ဘယ်လို အသုံးချသင့်သလဲ ဆုံးဖြတ်နိုင်ရန်

နားလည်ထားရမယ့် အချက်

Pull request တစ်ခု ဖွင့်ပြီးသည်နှင့် တစ်ခြားတစ်ယောက်ယောက်က ၎င်းကို review လုပ်ပေးရန် လိုအပ်ပြီး review ကောင်းစွာ လုပ်ဆောင်ခြင်းက ၎င်းကိုယ်တိုင် skill တစ်ခုဖြစ်ပါတယ်။

  • Comment — formal verdict မပါဘဲ feedback ချန်ခဲ့ခြင်း
  • Request changes — ကိုင်တွယ်ရမည်အထိ merge ကို ပိတ်ဆို့ခြင်း
  • Approve — merge လုပ်ရန် လမ်းဖွင့်ပေးခြင်း

Review ကောင်းတစ်ခုက code run ဖြစ်မဖြစ်ထက် ပိုပြီး ကြည့်ရပါတယ်။

  • Correctness — description claim အတိုင်း လုပ်ဆောင်နေသလား၊ edge case များ ကိုင်တွယ်ထားသလား
  • Readability — naming, structure, ဘာလို့လဲဆိုတာကို ရှင်းပြတဲ့ comment
  • Security implications — user input, authentication, data handling ရှိ သေးငယ်တဲ့ ချန်လှပ်ထားမှုများ
  • Test coverage — ပြောင်းလဲမှုအတွက် test ပါဝင်ခြင်း ရှိမရှိ
  • Maintainability — author မဟုတ်တဲ့ နောက်လူတစ်ဦး နားလည်ပြီး လုံခြုံစွာ တိုးချဲ့နိုင်ခြင်း ရှိမရှိ

Etiquette ကတော့ ဒါတွေ အလုပ်ဖြစ်မဖြစ် ပုံဖော်ပေးပါတယ်။

Review Etiquette

Comment တွေက line တိကျစွာ ညွှန်ပြပြီး concrete suggestion ရှိရမည်ပါ — vague criticism မဟုတ်ပါ။ feedback ကို မေးခွန်း ဒါမှမဟုတ် suggestion အနေနှင့် ဖော်ပြပါ၊ good intent ကို assume လုပ်ပါ၊ 'this is wrong' နှင့် 'this is a style preference' ကို ခွဲခြားပါ။

text
PULL REQUEST REVIEW STATES
--------------------------
                    +-------------------+
                    |   Pull Request    |
                    +-------------------+
                   /         |          \
             comment   request changes   approve
            (no verdict) (blocks merge) (clears merge)
                   \         |          /
                    +-------------------+
                    | author updates,   |
                    | reviewer re-checks|
                    +-------------------+

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

Reviewer တစ်ဦးလို စဉ်းစားဖို့ GitHub website မလိုအပ်ပါဘူး — ၎င်းက ပြသပေးတဲ့ comparison အတူတူကို local မှာ git command တစ်ခုနှင့်ပဲ ရရှိနိုင်ပါတယ်။

merge ဝင်လာမည့်အရာ ကြည့်ပါ

git log main..feature/add-validation ကတော့ merge တစ်ခု ဆောင်ကြဉ်းလာမည့် commit များကိုသာ တိတိကျကျ list ပေးပါတယ်။

တကယ့် change ကို ကြည့်ပါ

git diff main...feature/add-validation (dot သုံးလုံး) က branch ကွဲထွက်ရာနေရာနှင့် နှိုင်းယှဉ်ပြီး line-by-line change တွေကို ပြသပါတယ် — pull request ရဲ့ Files changed tab မှာ GitHub render ပေးတဲ့ diff အတူတူပါပဲ။

Push မလုပ်ခင် local မှာ ဖတ်ကြည့်ခြင်း၊ ကိုယ့်ရဲ့ကိုယ်ပိုင် work ပေါ်မှာ reviewer အနေနှင့် ပထမဆုံး ကစားကြည့်ခြင်းက တစ်ခြားလူ မမြင်ခင် ပြဿနာအများကြီးကို ဖမ်းမိစေပါတယ် — ကျန်ရစ်ခဲ့တဲ့ console.log တစ်ခု၊ မသက်ဆိုင်တဲ့ formatting ပြောင်းလဲမှုတစ်ခုစသည်တို့ပါ။

GitHub ကိုယ်တိုင်ပေါ်မှာတော့ reviewer တွေက ဖတ်ခြင်းအတူတူပဲ လုပ်ပေမယ့် comment တွေ built-in ပါဝင်ပါတယ် — line တစ်ကြောင်းကို click လိုက်ရင် အဲဒီ line နှင့် revision အတိအကျကို anchor လုပ်ထားတဲ့ thread တစ်ခု ပွင့်လာပါတယ်။

အတူတူ စမ်းရေးကြည့်မယ်

bash
git init -q -b main
git config user.name "Thuta Learner"
git config user.email "learner@example.com"

echo "function login() { return true; }" > login.js
git add login.js
GIT_AUTHOR_DATE="2026-01-01T09:00:00" GIT_COMMITTER_DATE="2026-01-01T09:00:00" \
  git commit -m "Add basic login function"

git checkout -b feature/add-validation
cat > login.js <<'EOF'
function login(username, password) {
  if (!username || !password) {
    return false;
  }
  return true;
}
EOF
git add login.js
GIT_AUTHOR_DATE="2026-01-01T10:00:00" GIT_COMMITTER_DATE="2026-01-01T10:00:00" \
  git commit -m "Add input validation to login"

git log main..feature/add-validation --oneline
git diff main...feature/add-validation
You should see
git log main..feature/add-validation --oneline ->
edd0062 Add input validation to login

git diff main...feature/add-validation ->
diff --git a/login.js b/login.js
index 5f8135f..7ab42fa 100644
--- a/login.js
+++ b/login.js
@@ -1 +1,6 @@
-function login() { return true; }
+function login(username, password) {
+  if (!username || !password) {
+    return false;
+  }
+  return true;
+}

၅ မိနစ် စမ်းကြည့်

branch နှစ်ခု (main နှင့် feature branch) ရှိတဲ့ repository တစ်ခုမှာ git log main..<branch> --oneline နှင့် git diff main...<branch> ကို run ကြည့်ပါ။ ပြီးရင် reviewer တစ်ဦးအနေနှင့် correctness, readability, security, test coverage, maintainability ငါးမျိုးအတိုင်း တစ်ခုချင်းစီ မှတ်ချက်ချကြည့်ပါ။

သတိလေးတစ်ချက်

vague comment ချန်ခဲ့ခြင်း — 'this doesn't look right' လို line တိကျမှု၊ suggestion မပါတဲ့ criticism က author ကို ဘာလုပ်ရမလဲ မသိစေခြင်း

style preference (indentation, naming style) နှင့် တကယ့် bug ကို ရောနှောပြီး တန်ဖိုးတူညီအောင် request changes အဖြစ် ဆက်ဆံခြင်း

GitHub Docs: About pull request reviewsGit & GitHub

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • vague comment ချန်ခဲ့ခြင်း — 'this doesn't look right' လို line တိကျမှု၊ suggestion မပါတဲ့ criticism က author ကို ဘာလုပ်ရမလဲ မသိစေခြင်း
  • style preference (indentation, naming style) နှင့် တကယ့် bug ကို ရောနှောပြီး တန်ဖိုးတူညီအောင် request changes အဖြစ် ဆက်ဆံခြင်း
  • Destructive (သို့) history ပြောင်းလဲနိုင်တဲ့ command တိုင်းကို run မခင် git status နဲ့ လက်ရှိအခြေအနေကို အမြဲစစ်ပါ။

လေ့ကျင့်ခန်း

branch နှစ်ခု (main နှင့် feature branch) ရှိတဲ့ repository တစ်ခုမှာ git log main..<branch> --oneline နှင့် git diff main...<branch> ကို run ကြည့်ပါ။ ပြီးရင် reviewer တစ်ဦးအနေနှင့် correctness, readability, security, test coverage, maintainability ငါးမျိုးအတိုင်း တစ်ခုချင်းစီ မှတ်ချက်ချကြည့်ပါ။

You'll know it worked when: git log main..feature/add-validation --oneline -> edd0062 Add input validation to login git diff main...feature/add-validation -> diff --git a/login.js b/login.js index 5f8135f..7ab42fa 100644 --- a/login.js +++ b/login.js @@ -1 +1,6 @@ -function login() { return true; } +function login(username, password) { + if (!username || !password) { + return false; + } + return true; +}