-
-
Notifications
You must be signed in to change notification settings - Fork 811
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
gurramkarthiknetha
wants to merge
36
commits into
PalisadoesFoundation:develop
from
gurramkarthiknetha:origin/2503
Closed
Origin/2503 #2598
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
65a766e
Updated branching strategy
DangaRanga 0a6d4d6
Removed duplicate entry
DangaRanga e16a3ad
Updated contributing.md
DangaRanga 653345e
Added extra markdown styling to contribute.md
DangaRanga 13180c2
Merge pull request #54 from DangaRanga/master
DangaRanga 07f4465
Bump dns-packet from 1.3.1 to 1.3.4
dependabot[bot] f9d7eae
Merge pull request #60 from PalisadoesFoundation/dependabot/npm_and_y…
palisadoes 1a57176
Update pull_request_template.md
palisadoes c4580fa
disabled CodeQL cron jobs and push actions (#72)
akshatgarg12 f71bc11
Merge Develop into Main (#1099)
noman2002 1fd4105
[#1123] Changes position and text of "All Organizations" button (#1124)
adi790uu 9ff2924
Revert "[#1123] Changes position and text of "All Organizations" butt…
noman2002 a320d35
Added Base branch check to main (#1515)
palisadoes 42633e2
Pre-GSoC 2024 - Stable (#1934)
palisadoes f6c6f03
Update README.md
palisadoes 423b990
Merge develop - 20240504 (#1956)
palisadoes 7befb35
Merge develop - 20240504 (#1957)
palisadoes a4d2a07
Bump follow-redirects from 1.15.5 to 1.15.6 (#1960)
dependabot[bot] 9b5d158
Bump tar from 6.1.15 to 6.2.1 (#1959)
dependabot[bot] 389ac01
Bump tj-actions/changed-files from 40 to 41 in /.github/workflows (#1…
dependabot[bot] d3d681f
Bump express from 4.18.2 to 4.19.2 (#1962)
dependabot[bot] 7091c76
Bump ejs from 3.1.9 to 3.1.10 (#1963)
dependabot[bot] bf9852d
coderabbit yaml file (#1991)
pranshugupta54 f661cc9
Updating the main branch to the latest develop code (#2020)
palisadoes 5010350
Latest Develop 20240724 (#2127)
palisadoes b991d54
Update README.md
palisadoes f358420
Update CONTRIBUTING.md
palisadoes 15c8753
Update CONTRIBUTING.md
palisadoes 30c1d18
Merge with Develop 20240924 (#2306)
palisadoes 6fbba6e
Bump tj-actions/changed-files from 40 to 41 in /.github/workflows (#2…
dependabot[bot] e828b78
Bump rollup from 4.21.3 to 4.22.5 (#2308)
dependabot[bot] d01b5d2
Merge with Develop 2024-1-14 (#2432)
palisadoes 1fe19c1
Update dependabot.yaml
palisadoes d2a4d73
Update pull-request-target.yml
palisadoes 3d1f1f0
Update pull-request-target.yml
palisadoes 90b1d16
changed
gurramkarthiknetha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
Loading status checks…
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
commit 42633e2e5eb47fa67dba88b612437cf3c77b95af
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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):" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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: