We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5c99790 commit e3a1667Copy full SHA for e3a1667
detect_secrets/core/audit.py
@@ -248,8 +248,9 @@ def _get_secret_with_context(
248
if len(output) < end_line - start_line + 1:
249
# This handles the case of a short file.
250
num_lines_in_file = int(subprocess.check_output([
251
- 'wc',
252
- '-l',
+ 'grep', # https://stackoverflow.com/a/38870057
+ '-c', # - 'wc -l' cannot be used here because if the last char
253
+ '', # of the file isn't \n, then the last line isn't counted
254
filename,
255
]).decode('utf-8').split()[0])
256
0 commit comments