prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Deprecate using default `--fmt-transitive` and `--lint-transitive` in preparation for switching default to `--no-{fmt,lint}-transitive`
  ### Problem
  
  Will close https://github.com/pantsbuild/pants/issues/8345.
  
  These options cause tools like isort and Scalafmt to work on the transitive dependencies of the targets you specify, rather than only the targets specified. This is surprising and not how the tools work when called directly—you'd expect isort to only change the files you pass to it, for example.
  
  We decided when adding this option to the V2 rules (https://github.com/pantsbuild/pants/pull/8660) that instead we should deprecate this misfeature.
  
  However, we cannot simply deprecate the option in one fell-swoop because then people who are trying to prepare for the default behavior changing to `--no-transitive` will be met with a deprecation warning that the option will be removed. Leaving off the option so that there's no deprecation warning means that they will have a breaking behavior change in 1.25.0.dev2 when we no longer act transitively.
  
  ### Solution
  
  For this deprecation cycle, only warn that the default will change if they are currently relying on the default.
  
  In 1.25.0.dev2, after the default changes, _then_ we can safely deprecate the option outright.
  
  ### Result
  
  Users who specified the option get this warning message:
  
  
  > [WARN] /Users/eric/DocsLocal/code/projects/pants/src/python/pants/task/task.py:265: DeprecationWarning: DEPRECATED: Pants defaulting to --fmt-transitive and --lint-transitive will be removed in version 1.25.0.dev2.
    Pants will soon default to --no-fmt-transitive and --no-lint-transitive. Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which means that tools like isort and Scalafmt will work on transitive dependencies as well. This behavior is unexpected. Normally when running tools like isort, you'd expect them to only work on the files you specify.
  > 
  > To prepare, please add to your `pants.ini` under both the `fmt` and the `lint` sections the option `transitive: False`. If you want to keep the default, use `True`, although the option will be removed in Pants 1.27.0.dev2
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/python/pants/task/target_restriction_mixins.py`
  Content:
  ```
  1 # Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
  2 # Licensed under the Apache License, Version 2.0 (see LICENSE).
  3 
  4 from pants.base.deprecated import deprecated_conditional
  5 from pants.task.goal_options_mixin import GoalOptionsMixin, GoalOptionsRegistrar
  6 
  7 
  8 class HasTransitiveOptionMixin:
  9   """A mixin for tasks that have a --transitive option.
  10 
  11   Some tasks must always act on the entire dependency closure. E.g., when compiling, one must
  12   compile all of a target's dependencies before compiling that target.
  13 
  14   Other tasks must always act only on the target roots (the targets explicitly specified by the
  15   user on the command line). E.g., when finding paths between two user-specified targets.
  16 
  17   Still other tasks may optionally act on either the target roots or the entire closure,
  18   as the user prefers in each case. E.g., when invoking a linter. This mixin supports such tasks.
  19 
  20   Note that this mixin doesn't actually register the --transitive option. It assumes that this
  21   option was registered on the task (either directly or recursively from its goal).
  22   """
  23 
  24   @property
  25   def act_transitively(self):
  26     deprecated_conditional(
  27       lambda: self.get_options().is_default("transitive"),
  28       removal_version="1.25.0.dev2",
  29       entity_description="Pants defaulting to `--fmt-transitive` and `--lint-transitive`",
  30       hint_message="Pants will soon default to `--no-fmt-transitive` and `--no-lint-transitive`. "
  31                    "Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which "
  32                    "means that tools like isort and Scalafmt will work on transitive dependencies "
  33                    "as well. This behavior is unexpected. Normally when running tools like isort, "
  34                    "you'd expect them to only work on the files you specify.\n\nTo prepare, "
  35                    "please add to your `pants.ini` under both the `fmt` and the `lint` "
  36                    "sections the option `transitive: False`. If you want to keep the default, use "
  37                    "`True`, although we recommend setting to `False` as the `--transitive` option "
  38                    "will be removed in a future Pants version."
  39     )
  40     return self.get_options().transitive
  41 
  42 
  43 class TransitiveOptionRegistrar:
  44   """Registrar of --transitive."""
  45 
  46   @classmethod
  47   def register_options(cls, register):
  48     super().register_options(register)
  49     register('--transitive', type=bool, default=True, fingerprint=True, recursive=True,
  50              help="If false, act only on the targets directly specified on the command line. "
  51                   "If true, act on the transitive dependency closure of those targets.")
  52 
  53 
  54 class HasSkipOptionMixin:
  55   """A mixin for tasks that have a --skip option.
  56 
  57   Some tasks may be skipped during certain usages. E.g., you may not want to apply linters
  58   while developing.  This mixin supports such tasks.
  59 
  60   Note that this mixin doesn't actually register the --skip option. It assumes that this
  61   option was registered on the task (either directly or recursively from its goal).
  62   """
  63 
  64   @property
  65   def skip_execution(self):
  66     return self.get_options().skip
  67 
  68 
  69 class SkipOptionRegistrar:
  70   """Registrar of --skip."""
  71 
  72   @classmethod
  73   def register_options(cls, register):
  74     super().register_options(register)
  75     register('--skip', type=bool, default=False, fingerprint=True, recursive=True,
  76              help='Skip task.')
  77 
  78 
  79 class HasSkipAndTransitiveOptionsMixin(HasSkipOptionMixin, HasTransitiveOptionMixin):
  80   """A mixin for tasks that have a --transitive and a --skip option."""
  81   pass
  82 
  83 
  84 class HasSkipAndTransitiveGoalOptionsMixin(GoalOptionsMixin, HasSkipAndTransitiveOptionsMixin):
  85   """A mixin for tasks that have a --transitive and a --skip option registered at the goal level."""
  86   pass
  87 
  88 
  89 class SkipAndTransitiveOptionsRegistrar(SkipOptionRegistrar, TransitiveOptionRegistrar):
  90   """Registrar of --skip and --transitive."""
  91   pass
  92 
  93 
  94 class SkipAndTransitiveGoalOptionsRegistrar(SkipAndTransitiveOptionsRegistrar,
  95                                             GoalOptionsRegistrar):
  96   """Registrar of --skip and --transitive at the goal level."""
  97   pass
  98
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/python/pants/task/target_restriction_mixins.py b/src/python/pants/task/target_restriction_mixins.py
  --- a/src/python/pants/task/target_restriction_mixins.py
  +++ b/src/python/pants/task/target_restriction_mixins.py
  @@ -23,20 +23,6 @@
   
     @property
     def act_transitively(self):
  -    deprecated_conditional(
  -      lambda: self.get_options().is_default("transitive"),
  -      removal_version="1.25.0.dev2",
  -      entity_description="Pants defaulting to `--fmt-transitive` and `--lint-transitive`",
  -      hint_message="Pants will soon default to `--no-fmt-transitive` and `--no-lint-transitive`. "
  -                   "Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which "
  -                   "means that tools like isort and Scalafmt will work on transitive dependencies "
  -                   "as well. This behavior is unexpected. Normally when running tools like isort, "
  -                   "you'd expect them to only work on the files you specify.\n\nTo prepare, "
  -                   "please add to your `pants.ini` under both the `fmt` and the `lint` "
  -                   "sections the option `transitive: False`. If you want to keep the default, use "
  -                   "`True`, although we recommend setting to `False` as the `--transitive` option "
  -                   "will be removed in a future Pants version."
  -    )
       return self.get_options().transitive
   
   
  @@ -83,7 +69,24 @@
   
   class HasSkipAndTransitiveGoalOptionsMixin(GoalOptionsMixin, HasSkipAndTransitiveOptionsMixin):
     """A mixin for tasks that have a --transitive and a --skip option registered at the goal level."""
  -  pass
  +
  +  @property
  +  def act_transitively(self):
  +    deprecated_conditional(
  +      lambda: self.get_options().is_default("transitive"),
  +      removal_version="1.25.0.dev2",
  +      entity_description="Pants defaulting to `--fmt-transitive` and `--lint-transitive`",
  +      hint_message="Pants will soon default to `--no-fmt-transitive` and `--no-lint-transitive`. "
  +                   "Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which "
  +                   "means that tools like isort and Scalafmt will work on transitive dependencies "
  +                   "as well. This behavior is unexpected. Normally when running tools like isort, "
  +                   "you'd expect them to only work on the files you specify.\n\nTo prepare, "
  +                   "please add to your `pants.ini` under both the `fmt` and the `lint` "
  +                   "sections the option `transitive: False`. If you want to keep the default, use "
  +                   "`True`, although we recommend setting to `False` as the `--transitive` option "
  +                   "will be removed in a future Pants version."
  +    )
  +    return self.get_options().transitive
   
   
   class SkipAndTransitiveOptionsRegistrar(SkipOptionRegistrar, TransitiveOptionRegistrar):
  
verification_info: {"golden_diff": "diff --git a/src/python/pants/task/target_restriction_mixins.py b/src/python/pants/task/target_restriction_mixins.py\n--- a/src/python/pants/task/target_restriction_mixins.py\n+++ b/src/python/pants/task/target_restriction_mixins.py\n@@ -23,20 +23,6 @@\n \n   @property\n   def act_transitively(self):\n-    deprecated_conditional(\n-      lambda: self.get_options().is_default(\"transitive\"),\n-      removal_version=\"1.25.0.dev2\",\n-      entity_description=\"Pants defaulting to `--fmt-transitive` and `--lint-transitive`\",\n-      hint_message=\"Pants will soon default to `--no-fmt-transitive` and `--no-lint-transitive`. \"\n-                   \"Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which \"\n-                   \"means that tools like isort and Scalafmt will work on transitive dependencies \"\n-                   \"as well. This behavior is unexpected. Normally when running tools like isort, \"\n-                   \"you'd expect them to only work on the files you specify.\\n\\nTo prepare, \"\n-                   \"please add to your `pants.ini` under both the `fmt` and the `lint` \"\n-                   \"sections the option `transitive: False`. If you want to keep the default, use \"\n-                   \"`True`, although we recommend setting to `False` as the `--transitive` option \"\n-                   \"will be removed in a future Pants version.\"\n-    )\n     return self.get_options().transitive\n \n \n@@ -83,7 +69,24 @@\n \n class HasSkipAndTransitiveGoalOptionsMixin(GoalOptionsMixin, HasSkipAndTransitiveOptionsMixin):\n   \"\"\"A mixin for tasks that have a --transitive and a --skip option registered at the goal level.\"\"\"\n-  pass\n+\n+  @property\n+  def act_transitively(self):\n+    deprecated_conditional(\n+      lambda: self.get_options().is_default(\"transitive\"),\n+      removal_version=\"1.25.0.dev2\",\n+      entity_description=\"Pants defaulting to `--fmt-transitive` and `--lint-transitive`\",\n+      hint_message=\"Pants will soon default to `--no-fmt-transitive` and `--no-lint-transitive`. \"\n+                   \"Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which \"\n+                   \"means that tools like isort and Scalafmt will work on transitive dependencies \"\n+                   \"as well. This behavior is unexpected. Normally when running tools like isort, \"\n+                   \"you'd expect them to only work on the files you specify.\\n\\nTo prepare, \"\n+                   \"please add to your `pants.ini` under both the `fmt` and the `lint` \"\n+                   \"sections the option `transitive: False`. If you want to keep the default, use \"\n+                   \"`True`, although we recommend setting to `False` as the `--transitive` option \"\n+                   \"will be removed in a future Pants version.\"\n+    )\n+    return self.get_options().transitive\n \n \n class SkipAndTransitiveOptionsRegistrar(SkipOptionRegistrar, TransitiveOptionRegistrar):\n", "issue": "Deprecate using default `--fmt-transitive` and `--lint-transitive` in preparation for switching default to `--no-{fmt,lint}-transitive`\n### Problem\r\n\r\nWill close https://github.com/pantsbuild/pants/issues/8345.\r\n\r\nThese options cause tools like isort and Scalafmt to work on the transitive dependencies of the targets you specify, rather than only the targets specified. This is surprising and not how the tools work when called directly\u2014you'd expect isort to only change the files you pass to it, for example.\r\n\r\nWe decided when adding this option to the V2 rules (https://github.com/pantsbuild/pants/pull/8660) that instead we should deprecate this misfeature.\r\n\r\nHowever, we cannot simply deprecate the option in one fell-swoop because then people who are trying to prepare for the default behavior changing to `--no-transitive` will be met with a deprecation warning that the option will be removed. Leaving off the option so that there's no deprecation warning means that they will have a breaking behavior change in 1.25.0.dev2 when we no longer act transitively.\r\n\r\n### Solution\r\n\r\nFor this deprecation cycle, only warn that the default will change if they are currently relying on the default.\r\n\r\nIn 1.25.0.dev2, after the default changes, _then_ we can safely deprecate the option outright.\r\n\r\n### Result\r\n\r\nUsers who specified the option get this warning message:\r\n\r\n\r\n> [WARN] /Users/eric/DocsLocal/code/projects/pants/src/python/pants/task/task.py:265: DeprecationWarning: DEPRECATED: Pants defaulting to --fmt-transitive and --lint-transitive will be removed in version 1.25.0.dev2.\r\n  Pants will soon default to --no-fmt-transitive and --no-lint-transitive. Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which means that tools like isort and Scalafmt will work on transitive dependencies as well. This behavior is unexpected. Normally when running tools like isort, you'd expect them to only work on the files you specify.\r\n> \r\n> To prepare, please add to your `pants.ini` under both the `fmt` and the `lint` sections the option `transitive: False`. If you want to keep the default, use `True`, although the option will be removed in Pants 1.27.0.dev2\n", "before_files": [{"content": "# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom pants.base.deprecated import deprecated_conditional\nfrom pants.task.goal_options_mixin import GoalOptionsMixin, GoalOptionsRegistrar\n\n\nclass HasTransitiveOptionMixin:\n  \"\"\"A mixin for tasks that have a --transitive option.\n\n  Some tasks must always act on the entire dependency closure. E.g., when compiling, one must\n  compile all of a target's dependencies before compiling that target.\n\n  Other tasks must always act only on the target roots (the targets explicitly specified by the\n  user on the command line). E.g., when finding paths between two user-specified targets.\n\n  Still other tasks may optionally act on either the target roots or the entire closure,\n  as the user prefers in each case. E.g., when invoking a linter. This mixin supports such tasks.\n\n  Note that this mixin doesn't actually register the --transitive option. It assumes that this\n  option was registered on the task (either directly or recursively from its goal).\n  \"\"\"\n\n  @property\n  def act_transitively(self):\n    deprecated_conditional(\n      lambda: self.get_options().is_default(\"transitive\"),\n      removal_version=\"1.25.0.dev2\",\n      entity_description=\"Pants defaulting to `--fmt-transitive` and `--lint-transitive`\",\n      hint_message=\"Pants will soon default to `--no-fmt-transitive` and `--no-lint-transitive`. \"\n                   \"Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which \"\n                   \"means that tools like isort and Scalafmt will work on transitive dependencies \"\n                   \"as well. This behavior is unexpected. Normally when running tools like isort, \"\n                   \"you'd expect them to only work on the files you specify.\\n\\nTo prepare, \"\n                   \"please add to your `pants.ini` under both the `fmt` and the `lint` \"\n                   \"sections the option `transitive: False`. If you want to keep the default, use \"\n                   \"`True`, although we recommend setting to `False` as the `--transitive` option \"\n                   \"will be removed in a future Pants version.\"\n    )\n    return self.get_options().transitive\n\n\nclass TransitiveOptionRegistrar:\n  \"\"\"Registrar of --transitive.\"\"\"\n\n  @classmethod\n  def register_options(cls, register):\n    super().register_options(register)\n    register('--transitive', type=bool, default=True, fingerprint=True, recursive=True,\n             help=\"If false, act only on the targets directly specified on the command line. \"\n                  \"If true, act on the transitive dependency closure of those targets.\")\n\n\nclass HasSkipOptionMixin:\n  \"\"\"A mixin for tasks that have a --skip option.\n\n  Some tasks may be skipped during certain usages. E.g., you may not want to apply linters\n  while developing.  This mixin supports such tasks.\n\n  Note that this mixin doesn't actually register the --skip option. It assumes that this\n  option was registered on the task (either directly or recursively from its goal).\n  \"\"\"\n\n  @property\n  def skip_execution(self):\n    return self.get_options().skip\n\n\nclass SkipOptionRegistrar:\n  \"\"\"Registrar of --skip.\"\"\"\n\n  @classmethod\n  def register_options(cls, register):\n    super().register_options(register)\n    register('--skip', type=bool, default=False, fingerprint=True, recursive=True,\n             help='Skip task.')\n\n\nclass HasSkipAndTransitiveOptionsMixin(HasSkipOptionMixin, HasTransitiveOptionMixin):\n  \"\"\"A mixin for tasks that have a --transitive and a --skip option.\"\"\"\n  pass\n\n\nclass HasSkipAndTransitiveGoalOptionsMixin(GoalOptionsMixin, HasSkipAndTransitiveOptionsMixin):\n  \"\"\"A mixin for tasks that have a --transitive and a --skip option registered at the goal level.\"\"\"\n  pass\n\n\nclass SkipAndTransitiveOptionsRegistrar(SkipOptionRegistrar, TransitiveOptionRegistrar):\n  \"\"\"Registrar of --skip and --transitive.\"\"\"\n  pass\n\n\nclass SkipAndTransitiveGoalOptionsRegistrar(SkipAndTransitiveOptionsRegistrar,\n                                            GoalOptionsRegistrar):\n  \"\"\"Registrar of --skip and --transitive at the goal level.\"\"\"\n  pass\n", "path": "src/python/pants/task/target_restriction_mixins.py"}], "after_files": [{"content": "# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom pants.base.deprecated import deprecated_conditional\nfrom pants.task.goal_options_mixin import GoalOptionsMixin, GoalOptionsRegistrar\n\n\nclass HasTransitiveOptionMixin:\n  \"\"\"A mixin for tasks that have a --transitive option.\n\n  Some tasks must always act on the entire dependency closure. E.g., when compiling, one must\n  compile all of a target's dependencies before compiling that target.\n\n  Other tasks must always act only on the target roots (the targets explicitly specified by the\n  user on the command line). E.g., when finding paths between two user-specified targets.\n\n  Still other tasks may optionally act on either the target roots or the entire closure,\n  as the user prefers in each case. E.g., when invoking a linter. This mixin supports such tasks.\n\n  Note that this mixin doesn't actually register the --transitive option. It assumes that this\n  option was registered on the task (either directly or recursively from its goal).\n  \"\"\"\n\n  @property\n  def act_transitively(self):\n    return self.get_options().transitive\n\n\nclass TransitiveOptionRegistrar:\n  \"\"\"Registrar of --transitive.\"\"\"\n\n  @classmethod\n  def register_options(cls, register):\n    super().register_options(register)\n    register('--transitive', type=bool, default=True, fingerprint=True, recursive=True,\n             help=\"If false, act only on the targets directly specified on the command line. \"\n                  \"If true, act on the transitive dependency closure of those targets.\")\n\n\nclass HasSkipOptionMixin:\n  \"\"\"A mixin for tasks that have a --skip option.\n\n  Some tasks may be skipped during certain usages. E.g., you may not want to apply linters\n  while developing.  This mixin supports such tasks.\n\n  Note that this mixin doesn't actually register the --skip option. It assumes that this\n  option was registered on the task (either directly or recursively from its goal).\n  \"\"\"\n\n  @property\n  def skip_execution(self):\n    return self.get_options().skip\n\n\nclass SkipOptionRegistrar:\n  \"\"\"Registrar of --skip.\"\"\"\n\n  @classmethod\n  def register_options(cls, register):\n    super().register_options(register)\n    register('--skip', type=bool, default=False, fingerprint=True, recursive=True,\n             help='Skip task.')\n\n\nclass HasSkipAndTransitiveOptionsMixin(HasSkipOptionMixin, HasTransitiveOptionMixin):\n  \"\"\"A mixin for tasks that have a --transitive and a --skip option.\"\"\"\n  pass\n\n\nclass HasSkipAndTransitiveGoalOptionsMixin(GoalOptionsMixin, HasSkipAndTransitiveOptionsMixin):\n  \"\"\"A mixin for tasks that have a --transitive and a --skip option registered at the goal level.\"\"\"\n\n  @property\n  def act_transitively(self):\n    deprecated_conditional(\n      lambda: self.get_options().is_default(\"transitive\"),\n      removal_version=\"1.25.0.dev2\",\n      entity_description=\"Pants defaulting to `--fmt-transitive` and `--lint-transitive`\",\n      hint_message=\"Pants will soon default to `--no-fmt-transitive` and `--no-lint-transitive`. \"\n                   \"Currently, Pants defaults to `--fmt-transitive` and `--lint-transitive`, which \"\n                   \"means that tools like isort and Scalafmt will work on transitive dependencies \"\n                   \"as well. This behavior is unexpected. Normally when running tools like isort, \"\n                   \"you'd expect them to only work on the files you specify.\\n\\nTo prepare, \"\n                   \"please add to your `pants.ini` under both the `fmt` and the `lint` \"\n                   \"sections the option `transitive: False`. If you want to keep the default, use \"\n                   \"`True`, although we recommend setting to `False` as the `--transitive` option \"\n                   \"will be removed in a future Pants version.\"\n    )\n    return self.get_options().transitive\n\n\nclass SkipAndTransitiveOptionsRegistrar(SkipOptionRegistrar, TransitiveOptionRegistrar):\n  \"\"\"Registrar of --skip and --transitive.\"\"\"\n  pass\n\n\nclass SkipAndTransitiveGoalOptionsRegistrar(SkipAndTransitiveOptionsRegistrar,\n                                            GoalOptionsRegistrar):\n  \"\"\"Registrar of --skip and --transitive at the goal level.\"\"\"\n  pass\n", "path": "src/python/pants/task/target_restriction_mixins.py"}]}