Skip to content

Commit

Permalink
Remove test files and ensured that python files follow coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
im-vedant committed Dec 28, 2024
1 parent c2ce9ca commit b88a4c1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/code_coverage_disable_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Methodology:
Recursively analyzes TypeScript files in the specified directories or checks specific files
Recursively analyzes TypeScript files in the specified directories or
checks specific files
to ensure they do not contain code coverage disable statements.
This script enforces proper code coverage practices in the project.
Expand Down Expand Up @@ -37,7 +38,8 @@ def has_code_coverage_disable(file_path):
otherwise.
"""
code_coverage_disable_pattern = re.compile(
r"""//?\s*istanbul\s+ignore(?:\s+(?:next|-line))?[^\n]*|/\*\s*istanbul\s+ignore\s+(?:next|-line)\s*\*/""",
r"""//?\s*istanbul\s+ignore(?:\s+(?:next|-line))?[^\n]*|
/\*\s*istanbul\s+ignore\s+(?:next|-line)\s*\*/""",
re.IGNORECASE,
)
try:
Expand All @@ -57,7 +59,7 @@ def has_code_coverage_disable(file_path):

def check_code_coverage(files_or_dirs):
"""
Check TypeScript files for code coverage disable statements.
Check TypeScript files for code coverage disable statements.
Args:
files_or_dirs (list): List of files or directories to check.
Expand All @@ -75,13 +77,13 @@ def check_code_coverage(files_or_dirs):
if "node_modules" in root:
continue
for file_name in files:
if (
file_name.endswith(".tsx")
or file_name.endswith(".ts")
):
if file_name.endswith(".tsx") or file_name.endswith(".ts"):
file_path = os.path.join(root, file_name)
if has_code_coverage_disable(file_path):
print(f"File {file_path} contains code coverage disable statement.")
print(
f"""File {file_path} contains code coverage
disable statement."""
)
code_coverage_found = True
elif os.path.isfile(item):
# If it's a file, check it directly
Expand All @@ -92,10 +94,10 @@ def check_code_coverage(files_or_dirs):
and not file_name.endswith(".test.ts")
and not file_name.endswith(".spec.tsx")
and not file_name.endswith(".spec.ts")

) :
):
if has_code_coverage_disable(item):
print(f"File {item} contains code coverage disable statement.")
print(f"""File {item} contains code coverage disable
statement.""")
code_coverage_found = True

return code_coverage_found
Expand Down Expand Up @@ -143,9 +145,7 @@ def main():
SystemExit: If an error occurs during execution.
"""
args = arg_parser_resolver()

files_or_dirs = args.files if args.files else args.directory
print(files_or_dirs)
# Check code coverage in the specified files or directories
code_coverage_found = check_code_coverage(files_or_dirs)

Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/eslint_disable_check.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env python3

Check warning on line 1 in .github/workflows/eslint_disable_check.py

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
"""ESLint Checker Script.
Methodology:
Recursively analyzes TypeScript files in the specified directory
or checks specific files directly to ensure they do not contain eslint-disable statements.
or checks specific files directly to ensure they do not contain
eslint-disable statements.
This script enforces code quality practices in the project.
Expand Down Expand Up @@ -77,15 +78,19 @@ def check_eslint(files_or_directories):
print(f"File {item} contains eslint-disable statement.")
eslint_found = True
elif os.path.isdir(item):
# If it's a directory, walk through it and check all .ts and .tsx files
# If it's a directory, walk through it and check all
# .ts and .tsx files
for root, _, files in os.walk(item):
if "node_modules" in root:
continue
for file_name in files:
if file_name.endswith(".ts") or file_name.endswith(".tsx"):
file_path = os.path.join(root, file_name)
if has_eslint_disable(file_path):
print(f"File {file_path} contains eslint-disable statement.")
print(
f"""File {file_path} contains eslint-disable
statement."""
)
eslint_found = True

return eslint_found
Expand Down Expand Up @@ -136,7 +141,6 @@ def main():

# Determine whether to check files or directories based on the arguments
files_or_directories = args.files if args.files else args.directory
print(files_or_directories)
# Check eslint in the specified files or directories
eslint_found = check_eslint(files_or_directories)

Expand Down
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ const { setItem } = useLocalStorage();
*
* @returns The rendered routes and components of the application.
*/
// eslint-disable

// istanbul ignore next
function app(): JSX.Element {
/*const { updatePluginLinks, updateInstalled } = bindActionCreators(
actionCreators,
Expand Down
1 change: 0 additions & 1 deletion src/setupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
// eslint-disable
global.fetch = jest.fn();

import { format } from 'util';
Expand Down

0 comments on commit b88a4c1

Please sign in to comment.