def _resolve_conflicting_skip(self, *, old_scope: str): # Skip mypy because this is a temporary hack, and mypy doesn't follow the inheritance chain # properly. return self.resolve_conflicting_skip_options( # type: ignore old_scope=old_scope, new_scope='scalafix', subsystem=Scalafix.global_instance(), )
def _resolve_conflicting_options(self, *, old_option: str, new_option: str): return resolve_conflicting_options( old_option=old_option, new_option=new_option, old_scope='fmt-scalafix', new_scope='scalafix', old_container=self.get_options(), new_container=Scalafix.global_instance().options, )
def invoke_tool(self, absolute_root, target_sources): args = [] tool_classpath = self.tool_classpath('scalafix-tool-classpath') if tool_classpath: args.append(f'--tool-classpath={os.pathsep.join(tool_classpath)}') if self.get_options().semantic: # If semantic checks are enabled, we need the full classpath for these targets. runtime_classpath = self.context.products.get_data( 'runtime_classpath') classpath = ScalafixTask._compute_classpath( runtime_classpath, {target for target, _ in target_sources}) args.append(f'--sourceroot={absolute_root}') args.append(f'--classpath={os.pathsep.join(classpath)}') task_config = self.get_options().configuration subsystem_config = Scalafix.global_instance().get_options().config if task_config and subsystem_config: raise ValueError( "Conflicting options for the config file used. You used the new, preferred " "`--scalafix-config`, but also used the deprecated `--fmt-scalafix-configuration`.\n" "Please use only one of these (preferably `--scalafix-config`)." ) config = task_config or subsystem_config or None if config: args.append(f'--config={config}') if self.get_options().rules: args.append(f'--rules={self.get_options().rules}') if self.get_options().level == 'debug': args.append('--verbose') # This is how you pass a list of strings to a single arg key for a in self._scalac_args: args.append('--scalac-options') args.append(a) args.extend(self.additional_args or []) args.extend(source for _, source in target_sources) # Execute. return self.runjava(classpath=self.tool_classpath('scalafix'), main=self._SCALAFIX_MAIN, jvm_options=self.get_options().jvm_options, args=args, workunit_name='scalafix')
def invoke_tool(self, absolute_root, target_sources): args = [] tool_classpath = self.tool_classpath("scalafix-tool-classpath") if tool_classpath: args.append(f"--tool-classpath={os.pathsep.join(tool_classpath)}") if self.get_options().semantic: # If semantic checks are enabled, we need the full classpath for these targets. runtime_classpath = self.context.products.get_data( "runtime_classpath") classpath = ScalafixTask._compute_classpath( runtime_classpath, {target for target, _ in target_sources}) args.append(f"--sourceroot={absolute_root}") args.append(f"--classpath={os.pathsep.join(classpath)}") config = Scalafix.global_instance().options.config if config: args.append(f"--config={config}") if self.get_options().rules: args.append(f"--rules={self.get_options().rules}") if self.get_options().level == "debug": args.append("--verbose") # This is how you pass a list of strings to a single arg key for a in self._scalac_args: args.append("--scalac-options") args.append(a) args.extend(self.additional_args or []) args.extend(source for _, source in target_sources) # Execute. return self.runjava( classpath=self.tool_classpath("scalafix"), main=self._SCALAFIX_MAIN, jvm_options=self.get_options().jvm_options, args=args, workunit_name="scalafix", )
def skip_execution(self): return self.get_options().skip or Scalafix.global_instance( ).options.skip
def skip_execution(self): return Scalafix.global_instance().options.skip
def skip_execution(self): return super().determine_if_skipped( formatter_subsystem=Scalafix.global_instance())