Skip to content

Commit

Permalink
changed the disable telemetry argument name to match upstream change.
Browse files Browse the repository at this point in the history
  • Loading branch information
Thorsten Roeder committed Jan 26, 2024
1 parent cdd875f commit 147e034
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ It checks all files containing `requirements` in their name in the repo.

Releases details: [CHANGELOG.md](CHANGELOG.md)

Note that **telemetry data will be sent with every Safety call**. These data are anonymous and not sensitive. This includes the Python version, the Safety command used (check/license/review), and the Safety options used (without their values). Users can disable this functionality by adding the `--disable-telemetry` flag.
Note that **telemetry data will be sent with every Safety call**. These data are anonymous and not sensitive. This includes the Python version, the Safety command used (check/license/review), and the Safety options used (without their values). Users can disable this functionality by adding the `--disable-optional-telemetry` flag.

## Usage
```yaml
Expand Down
6 changes: 3 additions & 3 deletions pre_commit_hooks/safety_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ def main(argv=None): # pylint: disable=inconsistent-return-statements

def call_safety_check(requirements_file_paths, ignore_args, report_arg, args_rest):
safety_args = []
if "--disable-telemetry" in args_rest:
safety_args.append("--disable-telemetry")
args_rest = [arg for arg in args_rest if arg != "--disable-telemetry"]
if "--disable-optional-telemetry" in args_rest:
safety_args.append("--disable-optional-telemetry")
args_rest = [arg for arg in args_rest if arg != "--disable-optional-telemetry"]
safety_args.append("check")
for file_path in requirements_file_paths:
safety_args += ["--file", file_path]
Expand Down
2 changes: 1 addition & 1 deletion tests/safety_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_short_report(tmpdir):
def test_disable_telemetry(tmpdir):
requirements_file = tmpdir.join('requirements.txt')
requirements_file.write('urllib3==1.24.1')
assert safety(["--disable-telemetry", str(requirements_file)]) == EXIT_CODE_VULNERABILITIES_FOUND
assert safety(["--disable-optional-telemetry", str(requirements_file)]) == EXIT_CODE_VULNERABILITIES_FOUND

@pytest.mark.parametrize("report", [["--full-report"], []])
def test_full_report(tmpdir, report, capfd):
Expand Down

0 comments on commit 147e034

Please sign in to comment.