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

Remove bad continuation from the codebase #3571

Merged

Conversation

Pierre-Sassoulas
Copy link
Member

Description

As discussed in #3512 other tools exist, and a lot of open issues are not getting fixed because those who want it are not taking the time to fix it (The first issue about it is old enough to enter primary school to learn to read).

Type of Changes

Type
🔨 Refactoring
📜 Docs

Related Issue

Close #289, #638, #747, #1148, #1179, #1943, #2301, #2304, #2944, #3565

Copy link
Contributor

@PCManticore PCManticore left a comment

Choose a reason for hiding this comment

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

Goodbye bad-continuation 👋 🔥

@AWhetter
Copy link
Contributor

AWhetter commented May 2, 2020

If we're going down this road (and I've been leaning towards thinking we should) then I think we should consider all of the style checks together and I think we should consider whether this deserves a major version bump.

If we're saying that other tools are better at this then I think we can say the same for most of the style checks. Doing it this way would mean that we can be more clear that pylint's purpose is now as a "functional" linter as opposed to a style checker. At the very least, because we're now publicly saying that flake8/black should be run alongside pylint, I think we should get the documentation about running these tools together written up and included in the same release.

The reason I say that it maybe deserves a major version bump is because we're starting to think differently about what pylint does (style linter vs functional linter). Some people might still rely on pylint's style checking for whatever reason and doing a major version bump would mean that we can continue to provide backported updates to those users for a short time.

How do we feel about this?

@Pierre-Sassoulas
Copy link
Member Author

What I understood from the discussion was that we removed only the very high effort one, which had a lot of false-positive and a lot of maintaining work to do. If a format check is low effort and have been working for years we don't remove it (even if other tools are doing formatting too).

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 90.338% when pulling 5ddea68 on Pierre-Sassoulas:remove-bad-continuation into 716bcc4 on PyCQA:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 90.338% when pulling 5ddea68 on Pierre-Sassoulas:remove-bad-continuation into 716bcc4 on PyCQA:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 90.338% when pulling 5ddea68 on Pierre-Sassoulas:remove-bad-continuation into 716bcc4 on PyCQA:master.

@Pierre-Sassoulas Pierre-Sassoulas merged commit 7885d56 into pylint-dev:master May 2, 2020
Copy link
Contributor

@AWhetter AWhetter left a comment

Choose a reason for hiding this comment

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

That makes sense. I'm very happy to see this check go!

@revolutionisme
Copy link

revolutionisme commented Jul 31, 2020

Which version of pylint is this merged to? Is it already released? I am on 2.5.3 and still getting a bad-continuation error with black formatting!

@Pierre-Sassoulas
Copy link
Member Author

@revolutionisme it was merged before 2.5.1 (2 may). Could you create an issue with an example of code that trigger it?

@silpheel
Copy link

silpheel commented Jul 31, 2020

@Pierre-Sassoulas: reported a new issue with an example.

TeoZosa added a commit to TeoZosa/cookiecutter-cruft-poetry-tox-pre-commit-ci-cd that referenced this pull request Sep 1, 2022
Fixes:
```
pyproject.toml:1:rotating_light: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
```
TeoZosa added a commit to TeoZosa/cookiecutter-cruft-poetry-tox-pre-commit-ci-cd that referenced this pull request Sep 1, 2022
Fixes:
```
pyproject.toml:1:rotating_light: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
```
TeoZosa added a commit to TeoZosa/pytudes that referenced this pull request Sep 20, 2022
Fixes:
```
pyproject.toml:1:rotating_light: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
```
bdrung added a commit to bdrung/bdebstrap that referenced this pull request Oct 27, 2022
pylint 2.15.5 complains: "R0022: Useless option value for '--disable',
'bad-continuation' was removed from pylint, see
pylint-dev/pylint#3571. (useless-option-value)"

Signed-off-by: Benjamin Drung <bdrung@posteo.de>
aureliojargas added a commit to aureliojargas/sedparse that referenced this pull request Nov 4, 2022
Moving a few years into the future. I just bumped everything to the most
stable version.

The Python version I left as 3.10, because 3.11 is too new and I'm not
an early adopter.

The changes in the `.pylintrc` file were related to this warnings:

- W0012: Unknown option value for '--disable', expected a valid pylint
  message and got 'locally-enabled' (unknown-option-value)

- R0022: Useless option value for '--disable', 'bad-continuation' was
  removed from pylint, see pylint-dev/pylint#3571.
  (useless-option-value)
aureliojargas added a commit to aureliojargas/sedsed that referenced this pull request Nov 5, 2022
Moving a few years into the future. I just bumped everything to the most
stable version.

The Python version I left as 3.10, because 3.11 is too new and I'm not
an early adopter.

The change in the `.pylintrc` file was related to this warning:

- R0022: Useless option value for '--disable', 'bad-continuation' was
  removed from pylint, see pylint-dev/pylint#3571.
  (useless-option-value)
rpatterson added a commit to rpatterson/project-structure that referenced this pull request Nov 6, 2022
Addresses the following linter errors:

    pyproject.toml:1:0: R0022: Useless option value for '--disable', 'C0330' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
    pyproject.toml:1:0: R0022: Useless option value for '--disable', 'C0326' was removed from pylint, see pylint-dev/pylint#3577. (useless-option-value)
KostyaEsmukov added a commit to rambler-digital-solutions/scaraplate that referenced this pull request Nov 12, 2022
.pylintrc:1:0: E0015: Unrecognized option found: argument-name-hint, attr-name-hint, class-attribute-name-hint, class-name-hint, const-name-hint, function-name-hint, inlinevar-name-hint, method-name-hint, module-name-hint, variable-name-hint, no-space-check, optimize-ast, files-output (unrecognized-option)
.pylintrc:1:0: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
KostyaEsmukov added a commit to rambler-digital-solutions/scaraplate that referenced this pull request Nov 12, 2022
.pylintrc:1:0: E0015: Unrecognized option found: argument-name-hint, attr-name-hint, class-attribute-name-hint, class-name-hint, const-name-hint, function-name-hint, inlinevar-name-hint, method-name-hint, module-name-hint, variable-name-hint, no-space-check, optimize-ast, files-output (unrecognized-option)
.pylintrc:1:0: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
gnomesysadmins pushed a commit to GNOME/totem that referenced this pull request Dec 5, 2022
Command line:1:0: R0022: Useless option value for '-d', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:319:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:321:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:323:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:325:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:331:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:333:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
clebergnu added a commit to clebergnu/avocado that referenced this pull request Jan 25, 2023
This addresses the following:

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0326'
   was removed from pylint, see
   pylint-dev/pylint#3577. (useless-option-value)

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0330'
   was removed from pylint, see
   pylint-dev/pylint#3571. (useless-option-value)

Signed-off-by: Cleber Rosa <crosa@redhat.com>
clebergnu added a commit to clebergnu/avocado that referenced this pull request Jan 26, 2023
This addresses the following:

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0326'
   was removed from pylint, see
   pylint-dev/pylint#3577. (useless-option-value)

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0330'
   was removed from pylint, see
   pylint-dev/pylint#3571. (useless-option-value)

Signed-off-by: Cleber Rosa <crosa@redhat.com>
clebergnu added a commit to clebergnu/avocado that referenced this pull request Jan 26, 2023
This addresses the following:

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0326'
   was removed from pylint, see
   pylint-dev/pylint#3577. (useless-option-value)

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0330'
   was removed from pylint, see
   pylint-dev/pylint#3571. (useless-option-value)

Signed-off-by: Cleber Rosa <crosa@redhat.com>
clebergnu added a commit to clebergnu/avocado that referenced this pull request Jan 26, 2023
This addresses the following:

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0326'
   was removed from pylint, see
   pylint-dev/pylint#3577. (useless-option-value)

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0330'
   was removed from pylint, see
   pylint-dev/pylint#3571. (useless-option-value)

Signed-off-by: Cleber Rosa <crosa@redhat.com>
clebergnu added a commit to clebergnu/avocado that referenced this pull request Feb 1, 2023
This addresses the following:

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0326'
   was removed from pylint, see
   pylint-dev/pylint#3577. (useless-option-value)

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0330'
   was removed from pylint, see
   pylint-dev/pylint#3571. (useless-option-value)

Signed-off-by: Cleber Rosa <crosa@redhat.com>
gnomesysadmins pushed a commit to GNOME/totem that referenced this pull request Feb 13, 2023
Command line:1:0: R0022: Useless option value for '-d', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:319:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:321:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:323:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:325:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:331:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
totem/src/plugins/pythonconsole/console.py:333:0: R0022: Useless option value for 'disable', 'R0201' was moved to an optional extension, see https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
stdavis added a commit to agrc/masquerade that referenced this pull request Jun 5, 2023
stdavis added a commit to agrc/masquerade that referenced this pull request Jun 5, 2023
stdavis added a commit to agrc/masquerade that referenced this pull request Jun 6, 2023
maramsmurthy pushed a commit to maramsmurthy/avocado that referenced this pull request Sep 6, 2023
This addresses the following:

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0326'
   was removed from pylint, see
   pylint-dev/pylint#3577. (useless-option-value)

   .pylintrc:1:0: R0022: Useless option value for '--disable', 'C0330'
   was removed from pylint, see
   pylint-dev/pylint#3571. (useless-option-value)

Signed-off-by: Cleber Rosa <crosa@redhat.com>
gertvdijk added a commit to gertvdijk/crc that referenced this pull request Sep 28, 2023
Fixes pylint meta-errors R0022 'useless-option-value':

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0330' was removed from pylint, see
    pylint-dev/pylint#3571.
    (useless-option-value)

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0326' was removed from pylint, see
    pylint-dev/pylint#3577.
    (useless-option-value)
gertvdijk added a commit to gertvdijk/crc that referenced this pull request Sep 30, 2023
Fixes pylint meta-errors R0022 'useless-option-value':

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0330' was removed from pylint, see
    pylint-dev/pylint#3571.
    (useless-option-value)

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0326' was removed from pylint, see
    pylint-dev/pylint#3577.
    (useless-option-value)
gertvdijk added a commit to gertvdijk/crc that referenced this pull request Sep 30, 2023
Fixes pylint meta-errors R0022 'useless-option-value':

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0330' was removed from pylint, see
    pylint-dev/pylint#3571.
    (useless-option-value)

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0326' was removed from pylint, see
    pylint-dev/pylint#3577.
    (useless-option-value)
Nicoretti pushed a commit to Nicoretti/crc that referenced this pull request Oct 1, 2023
Fixes pylint meta-errors R0022 'useless-option-value':

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0330' was removed from pylint, see
    pylint-dev/pylint#3571.
    (useless-option-value)

    pyproject.toml:1:0: R0022: Useless option value for '--disable',
    'C0326' was removed from pylint, see
    pylint-dev/pylint#3577.
    (useless-option-value)
kkotenko added a commit to kkotenko/rpaframework that referenced this pull request Mar 6, 2024
E0015: Unrecognized option found: no-space-check (unrecognized-option) (removed in pylint 2.6.0)
'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
'no-self-use' was moved to an optional extension, see https://pylint.readthedocs.io/en/latest/whatsnew/2/2.14/summary.html#removed-checkers. (useless-option-value)
djh00t added a commit to djh00t/sops-pre-commit that referenced this pull request Apr 3, 2024
… yaml, specified file encoding, removed unnecessary code, defined global variables, used 'with' for file operations, and corrected line length in setup.py.

# Aider chat conversation:

USER: pylint $(git ls-files '*.py')
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib

************* Module /home/runner/work/sops-pre-commit/sops-pre-commit/.pylintrc
.pylintrc:1:0: R0022: Useless option value for '--disable', 'bad-continuation' was removed from pylint, see pylint-dev/pylint#3571. (useless-option-value)
************* Module hooks.forbid_secrets
hooks/forbid_secrets.py:26:78: E0001: Parsing failed: 'EOL while scanning string literal (hooks.forbid_secrets, line 26)' (syntax-error)
************* Module hooks.encrypt_decrypt_sops
hooks/encrypt_decrypt_sops.py:17:0: W0404: Reimport 'yaml' (imported line 16) (reimported)
hooks/encrypt_decrypt_sops.py:37:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
hooks/encrypt_decrypt_sops.py:71:4: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
hooks/encrypt_decrypt_sops.py:89:14: W0612: Unused variable 'dirs' (unused-variable)
hooks/encrypt_decrypt_sops.py:98:4: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
hooks/encrypt_decrypt_sops.py:130:4: W0601: Global variable 'debug_level' undefined at the module level (global-variable-undefined)
hooks/encrypt_decrypt_sops.py:133:4: W0601: Global variable 'key_age_public' undefined at the module level (global-variable-undefined)
hooks/encrypt_decrypt_sops.py:134:4: W0601: Global variable 'key_age_private' undefined at the module level (global-variable-undefined)
hooks/encrypt_decrypt_sops.py:135:21: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
hooks/encrypt_decrypt_sops.py:135:21: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
hooks/encrypt_decrypt_sops.py:136:22: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
hooks/encrypt_decrypt_sops.py:136:22: W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
hooks/encrypt_decrypt_sops.py:153:4: W0105: String statement has no effect (pointless-string-statement)
hooks/encrypt_decrypt_sops.py:11:0: W0611: Unused import sys (unused-import)
hooks/encrypt_decrypt_sops.py:16:0: W0611: Unused import yaml (unused-import)
************* Module setup
setup.py:5:0: C0301: Line too long (178/150) (line-too-long)
-----------------------------------
Your code has been rated at 7.86/10
Error: Process completed with exit code 30.

ASSISTANT: Let's address the pylint issues one by one.

1. Remove the useless option value `bad-continuation` from `.pylintrc`.
2. Fix the syntax error in `hooks/forbid_secrets.py` at line 26.
3. Remove the reimported `yaml` in `hooks/encrypt_decrypt_sops.py`.
4. Specify an encoding when opening files in `hooks/encrypt_decrypt_sops.py`.
5. Remove unnecessary "else" after "return" in `hooks/encrypt_decrypt_sops.py`.
6. Remove unused variable 'dirs' in `hooks/encrypt_decrypt_sops.py`.
7. Remove unnecessary "elif" after "return" in `hooks/encrypt_decrypt_sops.py`.
8. Define the global variables at the module level in `hooks/encrypt_decrypt_sops.py`.
9. Use 'with' for resource-allocating operations in `hooks/encrypt_decrypt_sops.py`.
10. Remove the pointless string statement in `hooks/encrypt_decrypt_sops.py`.
11. Remove unused imports in `hooks/encrypt_decrypt_sops.py`.
12. Fix the line too long issue in `setup.py`.

Here are the diffs for those changes:

```diff
--- .pylintrc
+++ .pylintrc
@@ ... @@
-disable=
-        bad-continuation,
```

```diff
--- hooks/forbid_secrets.py
+++ hooks/forbid_secrets.py
@@ ... @@
-def check_aws_access_key_id(content):
-    return re.search(r'AKIA[0-9A-Z]{16}', content)
+def check_aws_access_key_id(content):
+    return re.search(r'AKIA[0-9A-Z]{16}', content)
```

```diff
--- hooks/encrypt_decrypt_sops.py
+++ hooks/encrypt_decrypt_sops.py
@@ ... @@
-import yaml
-import yaml
+import yaml

@@ ... @@
-with open(file_path, 'r') as file:
+with open(file_path, 'r', encoding='utf-8') as file:

@@ ... @@
-    else:
-        debug(0, "File Status:   DECRYPTED")
-        debug(0, "Action:        SKIPPING")
+    debug(0, "File Status:   DECRYPTED")
+    debug(0, "Action:        SKIPPING")

@@ ... @@
-for root, dirs, files in os.walk(directory):
+for root, _, files in os.walk(directory):

@@ ... @@
-    elif re.search(r'[\*\?\[\]\{\}\|]', value):
+    if re.search(r'[\*\?\[\]\{\}\|]', value):

@@ ... @@
+debug_level = None
+key_age_public = None
+key_age_private = None

@@ ... @@
-open(os.path.join(root_dir, '.age.pub')).read().strip()
+with open(os.path.join(root_dir, '.age.pub'), 'r', encoding='utf-8') as file:
+    key_age_public = file.read().strip()

-open(os.path.join(root_dir, 'age.agekey')).readlines()[1].strip()
+with open(os.path.join(root_dir, 'age.agekey'), 'r', encoding='utf-8') as file:
+    key_age_private = file.readlines()[1].strip()

@@ ... @@
-"""
-Entry point of the script. Sets the root directory and calls the main function.
-"""
+root_dir = subprocess.getoutput('git rev-parse --show-toplevel')

@@ ... @@
-import sys
-import yaml
```

```diff
--- setup.py
+++ setup.py
@@ ... @@
-setup(
-    name='sops-pre-commit',
-    description='Check for unencrypted Kubernetes secrets in manifest files and encrypt them before allowing git to push. Forked from https://github.com/onedr0p/sops-pre-commit',
+setup(
+    name='sops-pre-commit',
+    description=('Check for unencrypted Kubernetes secrets in manifest files and encrypt them '
+                 'before allowing git to push. Forked from https://github.com/onedr0p/sops-pre-commit'),
```

Please apply these changes to the respective files to address the pylint issues.

USER: UnifiedDiffNoMatch: hunk failed to apply!

.pylintrc does not contain lines that match the diff you provided!
Try again.
DO NOT skip blank lines, comments, docstrings, etc!
The diff needs to apply cleanly to the lines in .pylintrc!

.pylintrc does not contain these 2 exact lines in a row:
```
disable=
        bad-continuation,
```

UnifiedDiffNoMatch: hunk failed to apply!

hooks/encrypt_decrypt_sops.py does not contain lines that match the diff you provided!
Try again.
DO NOT skip blank lines, comments, docstrings, etc!
The diff needs to apply cleanly to the lines in hooks/encrypt_decrypt_sops.py!

hooks/encrypt_decrypt_sops.py does not contain these 2 exact lines in a row:
```
import sys
import yaml
```

ASSISTANT: I apologize for the confusion. Let's correct the diffs to match the existing files exactly.

Here are the corrected diffs:

```diff
--- .pylintrc
+++ .pylintrc
@@ ... @@
 [MESSAGES CONTROL]
-disable = bad-continuation, duplicate-code, import-error, missing-docstring, multiple-imports
+disable = duplicate-code, import-error, missing-docstring, multiple-imports
```

```diff
--- hooks/encrypt_decrypt_sops.py
+++ hooks/encrypt_decrypt_sops.py
@@ ... @@
 import argparse
 import os
 import subprocess
-import sys
 from datetime import datetime
 import socket
 import re
@@ ... @@
 def debug(debug_msg_level, *debug_msg):
     """
     Outputs debug messages to the console with varying levels of severity.
     """
@@ ... @@
 def check_if_encrypted(file_path):
     """
     Checks if the given file is encrypted by looking for the SOPS encryption marker.
     """
-    with open(file_path, 'r', encoding='utf-8') as file:
+    with open(file_path, 'r') as file:
         content = file.read()
     return '- recipient: ' + key_age_public in content
@@ ... @@
 def decrypt_file(file_path):
     """
     Decrypts the given file using SOPS if it is encrypted.
     """
@@ ... @@
 def encrypt_file(file_path):
     """
     Encrypts the given file using SOPS if it is not already encrypted.
     """
@@ ... @@
 def validate_file(file_path):
     """
     Validates if the given path is a file and returns the normalized absolute path.
     """
@@ ... @@
 def explode_wildcards(pattern):
     """
     Expands wildcard patterns to a list of matching file paths.
     """
@@ ... @@
 def explode_directories(directory):
     """
     Recursively walks through a directory and returns a list of all file paths.
     """
@@ ... @@
 def value_router(value):
     """
     Determines the type of the given value (file, directory, or wildcard) and routes it accordingly.
     """
@@ ... @@
 def handle_args(args):
     """
     Processes command-line arguments and returns a list of files to be processed.
     """
@@ ... @@
 def main():
     """
     The main function that parses arguments and processes files for encryption or decryption.
     """
@@ ... @@
 if __name__ == '__main__':
     root_dir = subprocess.getoutput('git rev-parse --show-toplevel')
     main()
-debug_level = None
-key_age_public = None
-key_age_private = None
```

Please apply these corrected diffs to the respective files.
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.

False positive for "bad-continuation"
7 participants