diff --git a/CHANGELOG.md b/CHANGELOG.md index b543a80d..52fe2bf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,11 @@ Features: * [#254](https://github.com/godaddy/tartufo/pull/260) - Changes the default value of `--regex/--no-regex` to True. +Misc: + +* [#255](https://github.com/godaddy/tartufo/issues/255) -- Removed deprecated flags + --include-paths and --exclude-paths + v2.9.0 - 19 October 2021 ------------------------ diff --git a/README.md b/README.md index 302e3026..f37c1217 100644 --- a/README.md +++ b/README.md @@ -59,16 +59,6 @@ Options: Check the names of files being scanned as well as their contents. [default: True] - -i, --include-paths FILENAME [DEPRECATED] Use `--include-path-patterns`. - File with regular expressions (one per - line), at least one of which must match a - Git object path in order for it to be - scanned; lines starting with '#' are treated - as comments and are ignored. If empty or not - provided (default), all Git object paths are - included unless otherwise excluded via the - --exclude-paths option. - -ip, --include-path-patterns TEXT Specify a regular expression which matches Git object paths to include in the scan. @@ -78,16 +68,6 @@ Options: included unless otherwise excluded via the --exclude-path-patterns option. - -x, --exclude-paths FILENAME [DEPRECATED] Use `--exclude-path-patterns`. - File with regular expressions (one per - line), none of which may match a Git object - path in order for it to be scanned; lines - starting with '#' are treated as comments - and are ignored. If empty or not provided - (default), no Git object paths are excluded - unless effectively excluded via the - --include-paths option. - -xp, --exclude-path-patterns TEXT Specify a regular expression which matches Git object paths to exclude from the scan. diff --git a/tartufo/cli.py b/tartufo/cli.py index 9d825816..283c5f24 100644 --- a/tartufo/cli.py +++ b/tartufo/cli.py @@ -80,17 +80,6 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> Optional[click.Comma show_default=True, help="Check the names of files being scanned as well as their contents.", ) -@click.option( - "-i", - "--include-paths", - type=click.File("r"), - help="""[DEPRECATED] Use `--include-path-patterns`. File with regular - expressions (one per line), at least one of which must match a Git object - path in order for it to be scanned; lines starting with '#' are treated as - comments and are ignored. If empty or not provided (default), all Git object - paths are included unless otherwise excluded via the --exclude-paths - option.""", -) @click.option( "-ip", "--include-path-patterns", @@ -101,16 +90,6 @@ def get_command(self, ctx: click.Context, cmd_name: str) -> Optional[click.Comma included unless otherwise excluded via the --exclude-path-patterns option.""", ) -@click.option( - "-x", - "--exclude-paths", - type=click.File("r"), - help="""[DEPRECATED] Use `--exclude-path-patterns`. File with regular - expressions (one per line), none of which may match a Git object path in - order for it to be scanned; lines starting with '#' are treated as comments - and are ignored. If empty or not provided (default), no Git object paths are - excluded unless effectively excluded via the --include-paths option.""", -) @click.option( "-xp", "--exclude-path-patterns", diff --git a/tartufo/scanner.py b/tartufo/scanner.py index f210073d..8da842bb 100755 --- a/tartufo/scanner.py +++ b/tartufo/scanner.py @@ -19,7 +19,6 @@ Set, Tuple, ) -import warnings import click import git @@ -188,13 +187,6 @@ def included_paths(self) -> List[Pattern]: if self._included_paths is None: self.logger.info("Initializing included paths") patterns = list(self.global_options.include_path_patterns or ()) - if self.global_options.include_paths: - warnings.warn( - "--include-paths is deprecated and will be removed in v3.0. Use --include-path-patterns instead.", - DeprecationWarning, - ) - patterns += self.global_options.include_paths.readlines() - self.global_options.include_paths.close() self._included_paths = ( config.compile_path_rules(set(patterns)) if patterns else [] ) @@ -227,13 +219,6 @@ def excluded_paths(self) -> List[Pattern]: if self._excluded_paths is None: self.logger.info("Initializing excluded paths") patterns = list(self.global_options.exclude_path_patterns or ()) - if self.global_options.exclude_paths: - warnings.warn( - "--exclude-paths is deprecated and will be removed in v3.0. Use --exclude-path-patterns instead.", - DeprecationWarning, - ) - patterns += self.global_options.exclude_paths.readlines() - self.global_options.exclude_paths.close() self._excluded_paths = ( config.compile_path_rules(set(patterns)) if patterns else [] ) diff --git a/tartufo/types.py b/tartufo/types.py index b5aa3e1d..8fe76616 100644 --- a/tartufo/types.py +++ b/tartufo/types.py @@ -12,9 +12,7 @@ class GlobalOptions: "entropy", "regex", "scan_filenames", - "include_paths", "include_path_patterns", - "exclude_paths", "exclude_path_patterns", "exclude_entropy_patterns", "exclude_signatures", @@ -34,9 +32,7 @@ class GlobalOptions: entropy: bool regex: bool scan_filenames: bool - include_paths: Optional[TextIO] include_path_patterns: Tuple[str, ...] - exclude_paths: Optional[TextIO] exclude_path_patterns: Tuple[str, ...] exclude_entropy_patterns: Tuple[str, ...] exclude_signatures: Tuple[str, ...] diff --git a/tests/test_base_scanner.py b/tests/test_base_scanner.py index 67da9834..87584174 100644 --- a/tests/test_base_scanner.py +++ b/tests/test_base_scanner.py @@ -183,13 +183,10 @@ def test_included_paths_is_empty_if_not_specified(self): def test_include_paths_are_calculated_if_specified( self, mock_compile: mock.MagicMock ): - mock_include = mock.MagicMock() - mock_include.readlines.return_value = ["bar"] - self.options.include_paths = mock_include self.options.include_path_patterns = ("foo",) test_scanner = TestScanner(self.options) test_scanner.included_paths # pylint: disable=pointless-statement - mock_compile.assert_called_once_with({"foo", "bar"}) + mock_compile.assert_called_once_with({"foo"}) @mock.patch("tartufo.config.compile_path_rules") def test_populated_excluded_paths_list_does_not_recompute( @@ -208,13 +205,10 @@ def test_excluded_paths_is_empty_if_not_specified(self): def test_exclude_paths_are_calculated_if_specified( self, mock_compile: mock.MagicMock ): - mock_exclude = mock.MagicMock() - mock_exclude.readlines.return_value = ["Pipfile.lock\n"] - self.options.exclude_paths = mock_exclude self.options.exclude_path_patterns = ("foo",) test_scanner = TestScanner(self.options) test_scanner.excluded_paths # pylint: disable=pointless-statement - mock_compile.assert_called_once_with({"foo", "Pipfile.lock\n"}) + mock_compile.assert_called_once_with({"foo"}) def test_should_scan_treats_included_paths_as_exclusive(self): test_scanner = TestScanner(self.options)