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

Add new --ignore-words option to ignore 'good' words #100

Merged
merged 2 commits into from
Mar 22, 2017

Conversation

thdot
Copy link
Contributor

@thdot thdot commented Mar 7, 2017

A new command line option -I / --ignore-words is implemented to specify one or multiple files containing good words which codespell will ignore.
This PR is related to issue #66.

@larsoner
Copy link
Member

There are style issues, see Travis output

A new command line option -I / --ignore-words is implemented to specify
one or multiple files containing 'good' words which codespell will
ignore.
@codecov-io
Copy link

codecov-io commented Mar 16, 2017

Codecov Report

Merging #100 into master will increase coverage by 0.52%.
The diff coverage is 95.6%.

@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
+ Coverage   88.92%   89.44%   +0.52%     
==========================================
  Files           3        3              
  Lines         578      616      +38     
  Branches       81       85       +4     
==========================================
+ Hits          514      551      +37     
  Misses         51       51              
- Partials       13       14       +1
Impacted Files Coverage Δ
codespell_lib/tests/test_basic.py 95.09% <100%> (+0.46%) ⬆️
codespell_lib/_codespell.py 85.14% <73.33%> (+0.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f95992a...c13d75f. Read the comment docs.

@thdot
Copy link
Contributor Author

thdot commented Mar 16, 2017

I have updated the commit. Any other objections to the PR?

@larsoner
Copy link
Member

Can you add a test to make sure it works?

@thdot
Copy link
Contributor Author

thdot commented Mar 16, 2017

I have added unit tests for the --ignore-wordsand --regex options.
It was a little bit tricky because codespell_lib stores state in global variables. I solved this by adding a test fixture (setup and teardown methods) which reload the python module.

assert_equal(sio[1], '') # stderr
assert_true('SUMMARY' in sio[0])
assert_equal(len(sio[0].split('\n')), 7)
assert_true('abandonned' in sio[0].split()[-2])


@with_setup(reload_codespell_lib, reload_codespell_lib)
def test_ignore_dictonary():
"""Test ignore dictonary functionality"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo Line 171,172 should be dictionary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ups, thank you.

@thdot
Copy link
Contributor Author

thdot commented Mar 21, 2017

@Eric89GXL @lucasdemarchi Ready to merge?

@larsoner
Copy link
Member

LGTM. @lucasdemarchi do you want to look?

@lucasdemarchi lucasdemarchi merged commit bdc95ed into codespell-project:master Mar 22, 2017
@thdot thdot deleted the ignore-words branch March 22, 2017 08:23
@luzpaz
Copy link
Collaborator

luzpaz commented Oct 2, 2017

@thdot what's the format of this file of good words? I have a list that I'd like to exclude:

allEdges
Calculater
dum
eiter
iff
indicies
NormalY
nTo
ot
pres
recurrance
substraction
thru

@thdot
Copy link
Contributor Author

thdot commented Oct 4, 2017

It's simply one 'good' word per line.

@luzpaz
Copy link
Collaborator

luzpaz commented Oct 4, 2017

Note: the whitelist word needs to be identical to the word that is in dictionary.txt discovered this after encountering: #143 (comment)

@thdot perhaps the -I feature could be case-insensitive some how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants