Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin/2503 #2598

Closed
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
65a766e
Updated branching strategy
DangaRanga May 23, 2021
0a6d4d6
Removed duplicate entry
DangaRanga May 23, 2021
e16a3ad
Updated contributing.md
DangaRanga May 23, 2021
653345e
Added extra markdown styling to contribute.md
DangaRanga May 23, 2021
13180c2
Merge pull request #54 from DangaRanga/master
DangaRanga May 23, 2021
07f4465
Bump dns-packet from 1.3.1 to 1.3.4
dependabot[bot] May 30, 2021
f9d7eae
Merge pull request #60 from PalisadoesFoundation/dependabot/npm_and_y…
palisadoes May 30, 2021
1a57176
Update pull_request_template.md
palisadoes May 30, 2021
c4580fa
disabled CodeQL cron jobs and push actions (#72)
akshatgarg12 Jun 6, 2021
f71bc11
Merge Develop into Main (#1099)
noman2002 Nov 30, 2023
1fd4105
[#1123] Changes position and text of "All Organizations" button (#1124)
adi790uu Dec 10, 2023
9ff2924
Revert "[#1123] Changes position and text of "All Organizations" butt…
noman2002 Dec 12, 2023
a320d35
Added Base branch check to main (#1515)
palisadoes Jan 29, 2024
42633e2
Pre-GSoC 2024 - Stable (#1934)
palisadoes Apr 27, 2024
f6c6f03
Update README.md
palisadoes Apr 27, 2024
423b990
Merge develop - 20240504 (#1956)
palisadoes May 4, 2024
7befb35
Merge develop - 20240504 (#1957)
palisadoes May 4, 2024
a4d2a07
Bump follow-redirects from 1.15.5 to 1.15.6 (#1960)
dependabot[bot] May 5, 2024
9b5d158
Bump tar from 6.1.15 to 6.2.1 (#1959)
dependabot[bot] May 5, 2024
389ac01
Bump tj-actions/changed-files from 40 to 41 in /.github/workflows (#1…
dependabot[bot] May 5, 2024
d3d681f
Bump express from 4.18.2 to 4.19.2 (#1962)
dependabot[bot] May 5, 2024
7091c76
Bump ejs from 3.1.9 to 3.1.10 (#1963)
dependabot[bot] May 5, 2024
bf9852d
coderabbit yaml file (#1991)
pranshugupta54 May 19, 2024
f661cc9
Updating the main branch to the latest develop code (#2020)
palisadoes Jun 2, 2024
5010350
Latest Develop 20240724 (#2127)
palisadoes Jul 27, 2024
b991d54
Update README.md
palisadoes Aug 11, 2024
f358420
Update CONTRIBUTING.md
palisadoes Aug 11, 2024
15c8753
Update CONTRIBUTING.md
palisadoes Aug 11, 2024
30c1d18
Merge with Develop 20240924 (#2306)
palisadoes Sep 29, 2024
6fbba6e
Bump tj-actions/changed-files from 40 to 41 in /.github/workflows (#2…
dependabot[bot] Sep 29, 2024
e828b78
Bump rollup from 4.21.3 to 4.22.5 (#2308)
dependabot[bot] Sep 29, 2024
d01b5d2
Merge with Develop 2024-1-14 (#2432)
palisadoes Nov 14, 2024
1fe19c1
Update dependabot.yaml
palisadoes Nov 16, 2024
d2a4d73
Update pull-request-target.yml
palisadoes Nov 25, 2024
3d1f1f0
Update pull-request-target.yml
palisadoes Nov 25, 2024
90b1d16
changed
gurramkarthiknetha Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Pre-GSoC 2024 - Stable (#1934)
* Added Base branch check to main

* Deleted all files in the main branch in anticipation of merging develop into main cleanly

* Merge develop to main

* Deleted all main files

* Merged develop into main
palisadoes authored Apr 27, 2024
commit 42633e2e5eb47fa67dba88b612437cf3c77b95af
10 changes: 9 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
# file to .env or set the variables in your local environment manually.


# Custom port number for the talawa-admin development server to run on. Default is 4321.

PORT=4321

# Run Talawa-api locally in your system, and put its url into the same.

REACT_APP_TALAWA_URL=
@@ -20,4 +24,8 @@ REACT_APP_USE_RECAPTCHA=
REACT_APP_RECAPTCHA_SITE_KEY=

# has to be inserted in the env file to use plugins and other websocket based features.
REACT_APP_BACKEND_WEBSOCKET_URL=ws://localhost:4000/graphql
REACT_APP_BACKEND_WEBSOCKET_URL=ws://localhost:4000/graphql

# If you want to logs Compiletime and Runtime error , warning and info write YES or if u want to
# keep the console clean leave it blank
ALLOW_LOGS=
51 changes: 31 additions & 20 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@
"eslint:recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/recommended",
"eslint-config-prettier",
"prettier"
],
"globals": {
"Atomics": "readonly",
@@ -27,11 +29,17 @@
},

// Specify the ESLint plugins tobe used
"plugins": ["react", "@typescript-eslint", "jest"],
"plugins": [
"react",
"@typescript-eslint",
"jest",
"import",
"eslint-plugin-tsdoc",
"prettier"
],
Comment on lines +32 to +39
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add React Hooks lint rules for better code quality

The configuration is missing essential React Hooks rules which help prevent common mistakes.

Add the React Hooks plugin and rules:

  "plugins": [
    "react",
    "@typescript-eslint",
    "jest",
    "import",
    "eslint-plugin-tsdoc",
    "prettier",
+   "react-hooks"
  ],

Also add the corresponding rules:

  "rules": {
+   "react-hooks/rules-of-hooks": "error",
+   "react-hooks/exhaustive-deps": "warn",
    // ... existing rules

Committable suggestion skipped: line range outside the PR's diff.

"rules": {
"react/destructuring-assignment": ["off"],
"@typescript-eslint/no-explicit-any": ["off"],
"@typescript-eslint/explicit-module-boundary-types": ["off"],
"react/destructuring-assignment": "error",
"@typescript-eslint/explicit-module-boundary-types": "error",
"react/no-multi-comp": [
"error",
{
@@ -44,6 +52,14 @@
"extensions": [".tsx"]
}
],
"import/no-duplicates": "error",
"tsdoc/syntax": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/no-duplicate-enum-values": "error",
"@typescript-eslint/array-type": "error",
@@ -56,6 +72,7 @@
"allowTypedFunctionExpressions": true
}
],
"camelcase": "off",
"@typescript-eslint/naming-convention": [
"error",
// Interfaces must begin with Interface or TestInterface followed by a PascalCase name
@@ -76,7 +93,7 @@
},
{
"selector": "variable",
"format": ["camelCase", "UPPER_CASE"],
"format": ["camelCase", "UPPER_CASE", "PascalCase"],
"leadingUnderscore": "allow"
},
{
@@ -86,7 +103,7 @@
},
{
"selector": "function",
"format": ["camelCase"]
"format": ["camelCase", "PascalCase"]
},
{
"selector": "memberLike",
@@ -95,7 +112,11 @@
"leadingUnderscore": "require"
},

{ "selector": "variable", "modifiers": ["exported"], "format": null }
{
"selector": "variable",
"modifiers": ["exported"],
"format": null
}
],
// Ensures that components are always written in PascalCase
"react/jsx-pascal-case": [
@@ -110,23 +131,13 @@
// All tests must need not have an assertion
"jest/expect-expect": 0,

// Ensures that components are always indented by 2 spaces
"react/jsx-indent": ["warn", 2],
"react/jsx-tag-spacing": [
"warn",
{
"afterOpening": "never",
"beforeClosing": "never",
"beforeSelfClosing": "always"
}
],

// Enforce Strictly functional components
"react/no-unstable-nested-components": ["error", { "allowAsProps": true }],
"react/function-component-definition": [
0,
{ "namedComponents": "function-declaration" }
]
],
"prettier/prettier": "error"
},

// Let ESLint use the react version in the package.json
18 changes: 18 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Configuration for automated dependency updates using Dependabot
version: 2
updates:
# Define the target package ecosystem
- package-ecosystem: "npm"
# Specify the root directory
directory: "/"
# Schedule automated updates to run weekly
schedule:
interval: "weekly"
# Labels to apply to Dependabot PRs
labels:
- "dependencies"
# Specify the target branch for PRs
target-branch: "develop"
# Customize commit message prefix
commit-message:
prefix: "chore(deps):"
34 changes: 0 additions & 34 deletions .github/workflows/authorized-changes-detection.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/codeql-codescan.yml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ jobs:
language: [ 'javascript' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
170 changes: 170 additions & 0 deletions .github/workflows/compare_translations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
"""Script to encourage more efficient coding practices.
Methodology:

Utility for comparing translations between default and other languages.

This module defines a function to compare two translations
and print any missing keys in the other language's translation.
Attributes:

FileTranslation : Named tuple to represent a combination
of file and missing translations.

Fields:
- file (str): The file name.
- missing_translations (list): List of missing translations.

Functions:
compare_translations(default_translation, other_translation):
Compare two translations and print missing keys.

load_translation(filepath):
Load translation from a file.

check_translations():
Load the default translation and compare it with other translations.

main():
The main function to run the script.
Parses command-line arguments, checks for the
existence of the specified directory, and then
calls check_translations with the provided or default directory.


Usage:
This script can be executed to check and print missing
translations in other languages based on the default English translation.

Example:
python compare_translations.py
NOTE:
This script complies with our python3 coding and documentation standards
and should be used as a reference guide. It complies with:

1) Pylint
2) Pydocstyle
3) Pycodestyle
4) Flake8

"""
# standard imports
import argparse
import json
import os
import sys
from collections import namedtuple

# Named tuple for file and missing
# translations combination
FileTranslation = namedtuple("FileTranslation",
["file", "missing_translations"])


def compare_translations(default_translation,
other_translation, default_file, other_file):
"""Compare two translations and return detailed info about missing/mismatched keys.

Args:
default_translation (dict): The default translation (en.json).
other_translation (dict): The other language translation.
default_file (str): The name of the default translation file.
other_file (str): The name of the other
translation file.

Returns:
list: A list of detailed error messages for each missing/mismatched key.
"""
errors = []

# Check for missing keys in other_translation
for key in default_translation:
if key not in other_translation:
error_msg = f"Missing Key: '{key}' - This key from '{default_file}' is missing in '{other_file}'."
errors.append(error_msg)
# Check for keys in other_translation that don't match any in default_translation
for key in other_translation:
if key not in default_translation:
error_msg = f"Error Key: '{key}' - This key in '{other_file}' does not match any key in '{default_file}'."
errors.append(error_msg)
return errors


def load_translation(filepath):
"""Load translation from a file.

Args:
filepath: Path to the translation file

Returns:
translation: Loaded translation
"""
with open(filepath, "r", encoding="utf-8") as file:
translation = json.load(file)
return translation


def check_translations(directory):
"""Load default translation and compare with other translations.

Args:
directory (str): The directory containing translation files.

Returns:
None
"""
default_file = "en.json"
default_translation = load_translation(os.path.join(directory, default_file))
translations = os.listdir(directory)
translations.remove(default_file) # Exclude default translation

error_found = False

for translation_file in translations:
other_file = os.path.join(directory, translation_file)
other_translation = load_translation(other_file)

# Compare translations and get detailed error messages
errors = compare_translations(
default_translation, other_translation, default_file, translation_file
)
if errors:
error_found = True
print(f"File {translation_file} has missing translations for:")
for error in errors:
print(f" - {error}")

if error_found:
sys.exit(1) # Exit with an error status code
else:
print("All translations are present")
sys.exit(0)


def main():
"""

Parse command-line arguments, check for the existence of the specified directory
and call check_translations with the provided or default directory.

"""
parser = argparse.ArgumentParser(
description="Check and print missing translations for all non-default languages."
)
parser.add_argument(
"--directory",
type=str,
nargs="?",
default=os.path.join(os.getcwd(), "public/locales"),
help="Directory containing translation files(relative to the root directory).",
)
args = parser.parse_args()

if not os.path.exists(args.directory):
print(f"Error: The specified directory '{args.directory}' does not exist.")
sys.exit(1)

check_translations(args.directory)


if __name__ == "__main__":
main()
Loading