Ejemplo n.º 1
0
 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='scalafmt',
         subsystem=Scalafmt.global_instance(),
     )
Ejemplo n.º 2
0
 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-scalafmt',
         new_scope='scalafmt',
         old_container=self.get_options(),
         new_container=Scalafmt.global_instance().options,
     )
Ejemplo n.º 3
0
    def invoke_tool(self, absolute_root, target_sources):
        args = list(self.additional_args)
        config = Scalafmt.global_instance().options.config
        if config is not None:
            args.extend(["--config", config])
        args.extend([source for _target, source in target_sources])

        return self.runjava(
            classpath=self.tool_classpath("scalafmt"),
            main="org.scalafmt.cli.Cli",
            args=args,
            workunit_name="scalafmt",
            jvm_options=self.get_options().jvm_options,
        )
Ejemplo n.º 4
0
    def invoke_tool(self, absolute_root, target_sources):
        task_config = self.get_options().configuration
        subsystem_config = Scalafmt.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 "
                "`--scalafmt-config`, but also used the deprecated `--fmt-scalafmt-configuration`.\n"
                "Please use only one of these (preferably `--scalafmt-config`)."
            )
        config = task_config or subsystem_config or None
        args = list(self.additional_args)
        if config is not None:
            args.extend(['--config', config])
        args.extend([source for _target, source in target_sources])

        return self.runjava(classpath=self.tool_classpath('scalafmt'),
                            main='org.scalafmt.cli.Cli',
                            args=args,
                            workunit_name='scalafmt',
                            jvm_options=self.get_options().jvm_options)
Ejemplo n.º 5
0
 def skip_execution(self):
     return self.get_options().skip or Scalafmt.global_instance(
     ).options.skip
Ejemplo n.º 6
0
 def skip_execution(self):
     return Scalafmt.global_instance().options.skip
Ejemplo n.º 7
0
 def skip_execution(self):
     return super().determine_if_skipped(
         formatter_subsystem=Scalafmt.global_instance())