mirror of
https://github.com/codespell-project/codespell.git
synced 2025-05-17 15:36:17 +08:00
Merge branch 'master' into peternewman-hidden-subdir
This commit is contained in:
4
.github/workflows/codespell-private.yml
vendored
4
.github/workflows/codespell-private.yml
vendored
@ -33,16 +33,16 @@ jobs:
|
||||
run: |
|
||||
python --version # just to check
|
||||
pip install -U pip wheel # upgrade to latest pip find 3.5 wheels; wheel to avoid errors
|
||||
pip install --upgrade codecov chardet "setuptools!=47.2.0" docutils setuptools_scm[toml]
|
||||
pip install --upgrade chardet "setuptools!=47.2.0" docutils setuptools_scm[toml]
|
||||
pip install aspell-python-py3
|
||||
pip install -e ".[dev]" # install the codespell dev packages
|
||||
- run: codespell --help
|
||||
- run: codespell --version
|
||||
- run: make check
|
||||
- uses: codecov/codecov-action@v3
|
||||
- run: codespell --check-filenames --skip="./.git/*,*.pyc,./codespell_lib/tests/test_basic.py,./codespell_lib/data/*,./example/code.c,./build/lib/codespell_lib/tests/test_basic.py,./build/lib/codespell_lib/data/*,README.rst,*.egg-info/*"
|
||||
# this file has an error
|
||||
- run: "! codespell codespell_lib/tests/test_basic.py"
|
||||
- run: codecov
|
||||
|
||||
make-check-dictionaries:
|
||||
runs-on: ubuntu-latest
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,3 +9,5 @@ codespell.egg-info
|
||||
.mypy_cache/
|
||||
.pytest_cache/
|
||||
codespell_lib/_version.py
|
||||
junit-results.xml
|
||||
*.egg-info/
|
||||
|
@ -647,14 +647,22 @@ def parse_file(filename, colors, summary, misspellings, exclude_lines,
|
||||
if not os.path.isfile(filename):
|
||||
return bad_count
|
||||
|
||||
text = is_text_file(filename)
|
||||
try:
|
||||
text = is_text_file(filename)
|
||||
except PermissionError as e:
|
||||
print("WARNING: %s: %s" % (e.strerror, filename),
|
||||
file=sys.stderr)
|
||||
return bad_count
|
||||
except OSError:
|
||||
return bad_count
|
||||
|
||||
if not text:
|
||||
if not options.quiet_level & QuietLevels.BINARY_FILE:
|
||||
print("WARNING: Binary file: %s" % filename, file=sys.stderr)
|
||||
return bad_count
|
||||
try:
|
||||
lines, encoding = file_opener.open(filename)
|
||||
except Exception:
|
||||
except OSError:
|
||||
return bad_count
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
|
@ -8023,6 +8023,8 @@ constracted->constructed
|
||||
constractor->constructor
|
||||
constractors->constructors
|
||||
constraing->constraining, constraint,
|
||||
constrainst->constraint, constraints,
|
||||
constrainsts->constraints
|
||||
constrainted->constrained
|
||||
constraintes->constraints
|
||||
constrainting->constraining
|
||||
|
@ -122,6 +122,20 @@ def test_basic(tmpdir, capsys):
|
||||
assert cs.main(d) == 0
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not sys.platform == 'linux', reason='Only supported on Linux')
|
||||
def test_permission_error(tmp_path, capsys):
|
||||
"""Test permission error handling."""
|
||||
d = tmp_path
|
||||
with open(d / 'unreadable.txt', 'w') as f:
|
||||
f.write('abandonned\n')
|
||||
code, _, stderr = cs.main(f.name, std=True)
|
||||
assert 'WARNING:' not in stderr
|
||||
os.chmod(f.name, 0o000)
|
||||
code, _, stderr = cs.main(f.name, std=True)
|
||||
assert 'WARNING:' in stderr
|
||||
|
||||
|
||||
def test_interactivity(tmpdir, capsys):
|
||||
"""Test interaction"""
|
||||
# Windows can't read a currently-opened file, so here we use
|
||||
|
Reference in New Issue
Block a user