Skip to content

Commit

Permalink
resolve merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
meetulr committed Jan 6, 2024
2 parents fa80fb0 + 0367652 commit 8200329
Show file tree
Hide file tree
Showing 31 changed files with 1,483 additions and 197 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/count_changed_files.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""Script to limit number of file changes in single PR.
Methodology:
Analyses the Pull request to find if the count of file changed in a pr
exceeds a pre-defined nummber 20
This scripts encourages contributors to align with project practices,
reducing the likelihood of unintentional merges into incorrect branches.
NOTE:
This script complies with our python3 coding and documentation standards.
It complies with:
1) Pylint
2) Pydocstyle
3) Pycodestyle
4) Flake8
"""

import sys
import argparse
import subprocess


def _count_changed_files(base_branch, pr_branch):
"""
Count the number of changed files between two branches.
Args:
base_branch (str): The base branch.
pr_branch (str): The PR branch.
Returns:
int: The number of changed files.
Raises:
SystemExit: If an error occurs during execution.
"""
base_branch = f"origin/{base_branch}"
pr_branch = f"origin/{pr_branch}"

command = f"git diff --name-only {base_branch}...{pr_branch} | wc -l"

try:
# Run git command to get the list of changed files
process = subprocess.Popen(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
output, error = process.communicate()
except Exception as e:
print(f"Error: {e}")
sys.exit(1)

file_count = int(output.strip())
return file_count

def _arg_parser_resolver():
"""Resolve the CLI arguments provided by the user.
Args:
None
Returns:
result: Parsed argument object
"""
parser = argparse.ArgumentParser()
parser.add_argument(
"--base_branch",
type=str,
required=True,
help="Base branch where pull request should be made."
),
parser.add_argument(
"--pr_branch",
type=str,
required=True,
help="PR branch from where the pull request is made.",
),
parser.add_argument(
"--file_count",
type=int,
default=20,
help="Number of files changes allowed in a single commit")
return parser.parse_args()


def main():
"""
Execute the script's main functionality.
This function serves as the entry point for the script. It performs
the following tasks:
1. Validates and retrieves the base branch and PR commit from
command line arguments.
2. Counts the number of changed files between the specified branches.
3. Checks if the count of changed files exceeds the acceptable
limit (20).
4. Provides informative messages based on the analysis.
Raises:
SystemExit: If an error occurs during execution.
"""

args = _arg_parser_resolver()

base_branch = args.base_branch
pr_branch = args.pr_branch

print(f"You are trying to merge on branch: {base_branch}")
print(f"You are making commit from your branch: {pr_branch}")

# Count changed files
file_count = _count_changed_files(base_branch, pr_branch)
print(f"Number of changed files: {file_count}")

# Check if the count exceeds 20
if file_count > args.file_count:
print("Error: Too many files (greater than 20) changed in the pull request.")
print("Possible issues:")
print("- Contributor may be merging into an incorrect branch.")
print("- Source branch may be incorrect please use develop as source branch.")
sys.exit(1)


if __name__ == "__main__":
main()
16 changes: 16 additions & 0 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ jobs:
python .github/workflows/compare_translations.py --directory public/locales
Check-Changed-Files:
runs-on: ubuntu-latest
needs: Code-Quality-Checks
steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Run Python script
run: |
python .github/workflows/count_changed_files.py --base_branch "${{ github.base_ref }}" --pr_branch "${{ github.head_ref }}"
Test-Application:
name: Test Application
runs-on: ubuntu-latest
Expand Down
33 changes: 32 additions & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@
"admin": "ADMIN",
"user": "USER"
},
"userLoginPage": {
"title": "Talawa Admin",
"fromPalisadoes": "An open source application by Palisadoes Foundation volunteers",
"talawa_portal": "Talawa Admin Portal",
"login": "Login",
"register": "Register",
"firstName": "First Name",
"lastName": "Last Name",
"email": "Email",
"password": "Password",
"atleast_8_char_long": "Atleast 8 Character long",
"Password_and_Confirm_password_mismatches.": "Password and Confirm password mismatches.",
"confirmPassword": "Confirm Password",
"forgotPassword": "Forgot Password ?",
"enterEmail": "Enter Email",
"enterPassword": "Enter Password",
"doNotOwnAnAccount": "Do not own an account?",
"talawaApiUnavailable": "Talawa-API service is unavailable. Is it running? Check your network connectivity too.",
"captchaError": "Captcha Error!",
"Please_check_the_captcha": "Please, check the captcha.",
"Something_went_wrong": "Something went wrong, Please try after sometime.",
"passwordMismatches": "Password and Confirm password mismatches.",
"fillCorrectly": "Fill all the Details Correctly.",
"notAuthorised": "Sorry! you are not Authorised!",
"notFound": "User not found!",
"successfullyRegistered": "Successfully Registered. Please wait until you will be approved.",
"userLogin": "User Login",
"afterRegister": "Successfully registered. Please wait for admin to approve your request.",
"OR": "OR"
},
"latestEvents": {
"eventCardTitle": "Upcoming Events",
"eventCardSeeAll": "See All",
Expand Down Expand Up @@ -432,7 +462,8 @@
"deleteMsg": "Do you want to delete this organization?",
"cancel": "Cancel",
"confirmDelete": "Confirm Delete",
"longDelOrgMsg": "By clicking on Delete Organization button the organization will be permanently deleted along with its events, tags and all related data."
"longDelOrgMsg": "By clicking on Delete Organization button the organization will be permanently deleted along with its events, tags and all related data.",
"successfullyDeletedSampleOrganization": "Successfully deleted sample Organization"
},
"userUpdate": {
"firstName": "First Name",
Expand Down
33 changes: 32 additions & 1 deletion public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@
"admin": "ADMIN",
"user": "UTILISATEUR"
},
"userLoginPage": {
"title": "Administrateur Talawa",
"talawa_portal": "Portail D'Administrateur Talawa",
"fromPalisadoes": "Une application open source par les volontaires de la Fondation Palissades",
"login": "Connexion",
"register": "S'inscrire",
"firstName": "Prénom",
"lastName": "Nom de famille",
"email": "E-mail",
"password": "Mot de passe",
"atleast_8_char_long": "Au moins 8 caractères",
"Password_and_Confirm_password_mismatches.": "Le mot de passe et la confirmation du mot de passe ne correspondent pas.",
"confirmPassword": "Confirmez le mot de passe",
"forgotPassword": "Mot de passe oublié ?",
"enterEmail": "entrez l'e-mail",
"enterPassword": "Entrer le mot de passe",
"doNotOwnAnAccount": "Vous n'avez pas de compte ?",
"talawaApiUnavailable": "Le service Talawa-API n'est pas disponible. Est-il en cours d'exécution ? Vérifiez également votre connectivité réseau.",
"captchaError": "Erreur de captcha !",
"Please_check_the_captcha": "Veuillez vérifier le captcha.",
"Something_went_wrong": "Quelque chose s'est mal passé, veuillez réessayer plus tard.",
"passwordMismatches": "Le mot de passe et la confirmation du mot de passe ne correspondent pas.",
"fillCorrectly": "Remplissez tous les détails correctement.",
"notAuthorised": "Désolé ! vous n'êtes pas autorisé !",
"notFound": "Utilisateur introuvable !",
"successfullyRegistered": "Enregistré avec succès. Veuillez patienter jusqu'à ce que vous soyez approuvé.",
"userLogin": "Utilisateur en ligne",
"afterRegister": "Enregistré avec succès. Veuillez attendre que l'administrateur approuve votre demande.",
"OR": "OU"
},
"latestEvents": {
"eventCardTitle": "Événements à venir",
"eventCardSeeAll": "Voir Tout",
Expand Down Expand Up @@ -429,7 +459,8 @@
"deleteMsg": "Voulez-vous supprimer cette organisation ?",
"cancel": "Annuler",
"confirmDelete": "Confirmer la suppression",
"longDelOrgMsg": "En cliquant sur le bouton Supprimer l'organisation, l'organisation sera définitivement supprimée ainsi que ses événements, balises et toutes les données associées."
"longDelOrgMsg": "En cliquant sur le bouton Supprimer l'organisation, l'organisation sera définitivement supprimée ainsi que ses événements, balises et toutes les données associées.",
"successfullyDeletedSampleOrganization": "Exemple d'organisation supprimé avec succès"
},
"userUpdate": {
"firstName": "Prénom",
Expand Down
33 changes: 32 additions & 1 deletion public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@
"admin": "व्यवस्थापक",
"user": "उपयोगकर्ता"
},
"userLoginPage": {
"title": "तलवा व्यवस्थापक",
"fromPalisadoes": "पलिसाडो के स्वयंसेवकों द्वारा एक खुला स्रोत अनुप्रयोग",
"talawa_portal": "तलावा प्रशासन पोर्टल",
"login": "लॉग इन करें",
"register": "पंजीकरण करवाना",
"firstName": "पहला नाम",
"lastName": "उपनाम",
"email": "ईमेल",
"password": "पासवर्ड",
"atleast_8_char_long": "कम से कम 8 कैरेक्टर लंबा",
"Password_and_Confirm_password_mismatches.": "पासवर्ड और पुष्टि पासवर्ड बेमेल।",
"confirmPassword": "पासवर्ड की पुष्टि कीजिये",
"forgotPassword": "पासवर्ड भूल गए ?",
"enterEmail": "ईमेल दर्ज करें",
"enterPassword": "पास वर्ड दर्ज करें",
"doNotOwnAnAccount": "क्या आपके पास खाता नहीं है?",
"talawaApiUnavailable": "तलावा-एपीआई सेवा उपलब्ध नहीं है। क्या यह चल रही है? अपनी नेटवर्क कनेक्टिविटी की भी जाँच करें।",
"captchaError": "कैप्चा त्रुटि!",
"Please_check_the_captcha": "कृपया, कैप्चा जांचें।",
"Something_went_wrong": "कुछ गलत हुआ, कृपया कुछ समय बाद प्रयास करें।",
"passwordMismatches": "पासवर्ड और पुष्टि पासवर्ड मेल नहीं खाते।",
"fillCorrectly": "सभी विवरण सही ढंग से भरें।",
"notAuthorised": "क्षमा करें! आप अधिकृत नहीं हैं!",
"notFound": "उपयोगकर्ता नहीं मिला!",
"successfullyRegistered": "सफलतापूर्वक पंजीकृत। कृपया स्वीकृत होने तक प्रतीक्षा करें।",
"afterRegister": "पंजीकरण सफलतापूर्वक हो गया है। कृपया आपके अनुरोध को स्वीकार करने के लिए व्यवस्थापक की प्रतीक्षा करें।",
"userLogin": "उपयोगकर्ता लॉगिन",
"OR": "या"
},
"latestEvents": {
"eventCardTitle": "आगामी घटनाएँ",
"eventCardSeeAll": "सभी देखें",
Expand Down Expand Up @@ -428,7 +458,8 @@
"deleteMsg": "क्या आप इस संगठन को हटाना चाहते हैं?",
"cancel": "रद्द करना",
"confirmDelete": "हटाने की पुष्टि करें",
"longDelOrgMsg": "संगठन को हमेशा के लिए हटा देने के लिए संगठन हटाने के बटन पर क्लिक करके, उसके इवेंट्स, टैग्स और सभी संबंधित डेटा सहित सभी जानकारी हटा दी जाएगी।"
"longDelOrgMsg": "संगठन को हमेशा के लिए हटा देने के लिए संगठन हटाने के बटन पर क्लिक करके, उसके इवेंट्स, टैग्स और सभी संबंधित डेटा सहित सभी जानकारी हटा दी जाएगी।",
"successfullyDeletedSampleOrganization": "नमूना संगठन सफलतापूर्वक हटा दिया गया"
},
"userUpdate": {
"firstName": "पहला नाम",
Expand Down
33 changes: 32 additions & 1 deletion public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@
"admin": "ADMINISTRACIÓN",
"user": "USUARIO"
},
"userLoginPage": {
"title": "Administrador Talawa",
"fromPalisadoes": "Una aplicación de código abierto de los voluntarios de la Fundación palisados",
"talawa_portal": "Portal De Administración Talawa",
"login": "Acceso",
"register": "Registro",
"firstName": "Primer nombre",
"lastName": "Apellido",
"email": "Correo electrónico",
"password": "Clave",
"atleast_8_char_long": "Al menos 8 caracteres de largo",
"Password_and_Confirm_password_mismatches.": "Contraseña y Confirmar contraseña no coinciden.",
"confirmPassword": "Confirmar contraseña",
"forgotPassword": "Has olvidado tu contraseña ?",
"enterEmail": "ingrese correo electrónico",
"enterPassword": "introducir la contraseña",
"doNotOwnAnAccount": "¿No tienes una cuenta?",
"talawaApiUnavailable": "El servicio Talawa-API no está disponible. ¿Está funcionando? Verifica también la conectividad de tu red.",
"captchaError": "¡Error de captcha!",
"Please_check_the_captcha": "Por favor, revisa el captcha.",
"Something_went_wrong": "Algo salió mal. Inténtalo después de un tiempo",
"passwordMismatches": "Contraseña y Confirmar contraseña no coinciden.",
"fillCorrectly": "Complete todos los detalles correctamente.",
"notAuthorised": "¡Lo siento! ¡No estás autorizado!",
"notFound": "¡Usuario no encontrado!",
"successfullyRegistered": "Registrado con éxito. Espere hasta que sea aprobado",
"userLogin": "Inicio de sesión de usuario",
"afterRegister": "Registrado exitosamente. Espere a que el administrador apruebe su solicitud.",
"OR": "O"
},
"latestEvents": {
"eventCardTitle": "Próximos Eventos",
"eventCardSeeAll": "Ver Todos",
Expand Down Expand Up @@ -428,7 +458,8 @@
"deleteMsg": "¿Desea eliminar esta organización?",
"cancel": "Cancelar",
"confirmDelete": "Confirmar eliminación",
"longDelOrgMsg": "Al hacer clic en el botón Eliminar organización, la organización se eliminará permanentemente junto con sus eventos, etiquetas y todos los datos relacionados."
"longDelOrgMsg": "Al hacer clic en el botón Eliminar organización, la organización se eliminará permanentemente junto con sus eventos, etiquetas y todos los datos relacionados.",
"successfullyDeletedSampleOrganization": "Organización de muestra eliminada correctamente"
},
"userUpdate": {
"firstName": "Primer nombre",
Expand Down
33 changes: 32 additions & 1 deletion public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@
"admin": "行政",
"user": "用戶"
},
"userLoginPage": {
"title": "塔拉瓦管理員",
"fromPalisadoes": "柵欄 基金会志愿者的开源应用程序",
"talawa_portal": "塔拉瓦管理門戶",
"login": "登錄",
"register": "登記",
"firstName": "",
"lastName": "",
"email": "電子郵件",
"password": "密碼",
"atleast_8_char_long": "至少 8 個字符長",
"Password_and_Confirm_password_mismatches.": "密碼和確認密碼不匹配。",
"confirmPassword": "確認密碼",
"forgotPassword": "忘記密碼 ?",
"enterEmail": "输入电子邮件",
"enterPassword": "输入密码",
"doNotOwnAnAccount": "沒有帳戶嗎?",
"talawaApiUnavailable": "服務不可用。它正在運行嗎?還要檢查您的網絡連接。",
"captchaError": "驗證碼錯誤!",
"Please_check_the_captcha": "請檢查驗證碼。",
"Something_went_wrong": "出了點問題,請稍後再試。",
"passwordMismatches": "密碼和確認密碼不匹配。",
"fillCorrectly": "正確填寫所有細節。",
"notAuthorised": "抱歉!你沒有被授權!",
"notFound": "找不到用戶!",
"successfullyRegistered": "註冊成功,請等待審核通過。",
"userLogin": "用户登录",
"afterRegister": "註冊成功。 請等待管理員批准您的請求。",
"OR": "或者"
},
"latestEvents": {
"eventCardTitle": "即将举行的活动",
"eventCardSeeAll": "查看全部",
Expand Down Expand Up @@ -428,7 +458,8 @@
"deleteMsg": "您是否要删除此组织?",
"cancel": "取消",
"confirmDelete": "确认删除",
"longDelOrgMsg": "点击删除组织按钮,组织将被永久删除,包括其事件、标签和所有相关数据。"
"longDelOrgMsg": "点击删除组织按钮,组织将被永久删除,包括其事件、标签和所有相关数据。",
"successfullyDeletedSampleOrganization": "已成功刪除樣本組織"
},
"userUpdate": {
"firstName": "",
Expand Down
Loading

0 comments on commit 8200329

Please sign in to comment.