Skip to content

Commit

Permalink
modified
Browse files Browse the repository at this point in the history
  • Loading branch information
sailajakommineni committed Nov 24, 2023
1 parent 1612d10 commit 0f84a13
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/spellcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,28 @@ jobs:
if os.path.isfile(file_path):
# Read the text from your file
# file_path = '.github/checking.txt' # Update the path accordingly
with open(file_path, 'r', encoding='utf-8') as file:
text = file.read()
with open(file_path, 'r', encoding='utf-8') as file:
text = file.read()

# Check for grammar errors
matches = tool.check(text)
# Check for grammar errors
matches = tool.check(text)

# Print grammar errors with line numbers
if matches:
for match in matches:
print(f"File: {filename}")
line_range = match.context[0]['offset']
start_line = text.count('\n', 0, int(line_range)) + 1
end_line = text.count('\n', int(line_range), int(line_range) + match.context[0]['length']) + 1
print(f"Grammar error from line {start_line} to {end_line}: {match.message}")
# Print grammar errors with line numbers
if matches:
for match in matches:
print(f"File: {filename}")
line_range = match.context[0]['offset']
start_line = text.count('\n', 0, int(line_range)) + 1
end_line = text.count('\n', int(line_range), int(line_range) + match.context[0]['length']) + 1
print(f"Grammar error from line {start_line} to {end_line}: {match.message}")
else:
print("Unexpected match context structure:", match.context)
# # Exit with a non-zero code to indicate failure
# exit(1)

else:
# No grammar errors found, print a success message
print("No grammar errors found.")
print(f"No grammar errors found in {filename}")
# # # Exit with a non-zero code to indicate failure
# # exit(1)
print(f"No grammar errors found in {filename}")
# else:
# # No grammar errors found, print a success message
# print("No grammar errors found.")

# exit(0)
EOF

0 comments on commit 0f84a13

Please sign in to comment.