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

occurring 'non-alpha-in-dictionary' warning for comments in expect.txt #16

Closed
tobi50 opened this issue Jul 18, 2021 · 3 comments
Closed

Comments

@tobi50
Copy link

tobi50 commented Jul 18, 2021

Hello, thank you for developing good tools like this!

I have trouble adding comments in setting expect.txt.
I read below about comment in expect.txt.

comments in expect
You can use # followed by text to add a comment at the end of a line. Note that some automatic pruning may not properly handle this.
https://github.com/check-spelling/check-spelling/wiki/Configuration#comments-in-expect

But now I see warning 'non-alpha-in-dictionary' for comments in expect.txt.
I guess it is occurred by below codes and it will get better to fix regular expression.

check_dictionary() {
file="$1"
expected_chars="[a-zA-Z']"
unexpected_chars="[^a-zA-Z']"
(perl -pi -e '
chomp;
my $messy = 0;
my $orig = $_;
if (s/\n|\r|\x0b|\f|\x85|\x2028|\x2029/a/g) {
$messy = 1;
}
if ('"/^${expected_chars}*(${unexpected_chars}+)/"') {
print STDERR "$ARGV: line $., columns $-[1]-$+[1], Warning - ignoring entry because it contains non alpha characters (non-alpha-in-dictionary)\n";
$_ = "";

I think changing below fix this,

unexpected_chars="[^a-zA-Z']"
to
unexpected_chars="[^a-zA-Z'#]"

and

/^${expected_chars}*(${unexpected_chars}+)/
to
/^${expected_chars}+(${unexpected_chars}+)/

Best Regards,

@jsoref
Copy link
Member

jsoref commented Jul 19, 2021

Oh, indeed. Thanks for the input. I'll fix that in the next release.

I suspect I'll fix it differently, since I think I want to allow #.*

@tobi50
Copy link
Author

tobi50 commented Jul 19, 2021

Thank you for your quick responce!

@jsoref
Copy link
Member

jsoref commented Jul 25, 2021

Fwiw, I have a fix for this in prerelease, but I'm still working on some of the other things I have in progress. 2f64504

jsoref added a commit to jsoref/check-spelling that referenced this issue Jul 29, 2021
@jsoref jsoref added this to In progress in 0.1.0 Aug 24, 2021
jsoref added a commit to jsoref/check-spelling that referenced this issue Dec 29, 2021
@jsoref jsoref closed this as completed in d309724 Jan 30, 2022
@jsoref jsoref added this to Done in 0.0.20 Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
0.1.0
In progress
Development

No branches or pull requests

2 participants