diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-07-28 20:18:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-28 20:18:44 +0200 |
commit | a8b7dd7bffe343f00bcd6409534edcab530a4fc4 (patch) | |
tree | 5f1d6b315ca95634a9328eed70603cfcfbac4e1c /script | |
parent | c04f92ef68e5ea779a60bfddb91dc677c5470fd0 (diff) | |
download | pylint-git-a8b7dd7bffe343f00bcd6409534edcab530a4fc4.tar.gz |
Add unspecified-encoding checker #3826 (#4753)
* Add unspecified-encoding checker #3826
This adds an unspecified-encoding checker that adds a warning
whenever open() is called without an explicit encoding argument.
This closes #3826
* Update tests to conform to unspecified-encoding
With addition of the unspecified-encoding checker calls of open()
need an encoding argument.
Where necessary this argument has been added, or the message has been
disabled.
This also includes small linting changes to a small number
of tests. Their test-data has been updated to reflect new line numbers.
* Update scripts to conform to unspecified-encoding
With addition of the unspecified-encoding checker calls of open()
need an encoding argument.
Where necessary this argument has been added.
* Update pylint to conform to unspecified-encoding
With addition of the unspecified-encoding checker calls of open()
need an encoding argument.
Where necessary this argument has been added.
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'script')
-rw-r--r-- | script/bump_changelog.py | 4 | ||||
-rw-r--r-- | script/fix_documentation.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/script/bump_changelog.py b/script/bump_changelog.py index 278b627da..41c8c3c8a 100644 --- a/script/bump_changelog.py +++ b/script/bump_changelog.py @@ -33,10 +33,10 @@ def main() -> None: logging.debug(f"Launching bump_changelog with args: {args}") if "dev" in args.version: return - with open(DEFAULT_CHANGELOG_PATH) as f: + with open(DEFAULT_CHANGELOG_PATH, encoding="utf-8") as f: content = f.read() content = transform_content(content, args.version) - with open(DEFAULT_CHANGELOG_PATH, "w") as f: + with open(DEFAULT_CHANGELOG_PATH, "w", encoding="utf-8") as f: f.write(content) diff --git a/script/fix_documentation.py b/script/fix_documentation.py index 242225381..b03f70ead 100644 --- a/script/fix_documentation.py +++ b/script/fix_documentation.py @@ -82,7 +82,7 @@ def main(argv: Union[List[str], None] = None) -> int: return_value: int = 0 for file_name in args.filenames: - with open(file_name) as fp: + with open(file_name, encoding="utf-8") as fp: orignal_content = fp.read() content = orignal_content # Modify files @@ -91,7 +91,7 @@ def main(argv: Union[List[str], None] = None) -> int: content = changelog_insert_empty_lines(content, args.subtitle_prefix) # If modified, write changes and eventually return 1 if orignal_content != content: - with open(file_name, "w") as fp: + with open(file_name, "w", encoding="utf-8") as fp: fp.write(content) return_value |= 1 return return_value |