Class FixBuckConfig

    • Constructor Detail

      • FixBuckConfig

        public FixBuckConfig()
    • Method Detail

      • getFixScript

        @Lazy
        public Optional<com.google.common.collect.ImmutableList<String>> getFixScript()
        Get the script to run when buck fix is invoked
      • getLegacyFixScript

        @Lazy
        public Optional<com.google.common.collect.ImmutableList<String>> getLegacyFixScript()
        Get the previous script that JASABI fixes
      • getFixScriptContact

        @Lazy
        public Optional<String> getFixScriptContact()
        Get the contact to use to tell users who to contact when `buck fix` fails
      • getFixScriptMessage

        @Lazy
        public String getFixScriptMessage()
        Get the message to show when invoking `buck fix`
      • getAutofixEnabled

        public com.facebook.buck.support.fix.FixBuckConfig.AutofixEnabled getAutofixEnabled()
        When running `buck fix` automatically on command failure is enabled
      • getAutofixCommands

        public List<String> getAutofixCommands()
        List of commands that autofix is enabled for
      • shouldRunAutofix

        public boolean shouldRunAutofix​(boolean isInteractive,
                                        String subcommand)
        Whether or not to run `buck fix` automatically
      • shouldPrintFixScriptMessage

        @Lazy
        public boolean shouldPrintFixScriptMessage()
        Determine whether to show a custom message when `buck fix` is invoked
      • shouldUseLegacyFixScript

        @Lazy
        public boolean shouldUseLegacyFixScript()
        Determine whether to use the legacy script, or the new fix script system
      • getInterpolatedFixScript

        public com.google.common.collect.ImmutableList<String> getInterpolatedFixScript​(com.google.common.collect.ImmutableList<String> fixScript,
                                                                                        Path repositoryRoot,
                                                                                        Path fixSpecPath)
        Gets the full script to invoke in `buck fix`.

        `{fix_spec_path}` is replaced with the path to the json file that contains details about the last run. `{repository_root}` is replaced with the absolute path to the repository root.

        Parameters:
        fixScript - The script to run (generally from the config file) that has not been interpolated
        repositoryRoot - The path to use for `{repository_root}`
        fixSpecPath - The path to use for `{fix_spec_path}`
        Returns:
        The interpolated command to run
      • getInterpolatedFixScriptMessage

        public String getInterpolatedFixScriptMessage​(com.google.common.collect.ImmutableList<String> interpolatedFixScript,
                                                      String fixScriptContact)
        Gets the message to print to users when `buck fix` is invoked and performs some substitutions

        `{command}` is replaced with interpolatedFixScript `{contact}` is replaced with fixScriptContact

        Parameters:
        interpolatedFixScript - The fix script per getInterpolatedFixScript(ImmutableList, Path, Path)
        fixScriptContact - The contact to use in the message
        Returns:
        A string to be printed before the fix script is invoked, with template parameters substituted
      • getBuckProvidedScripts

        public com.google.common.collect.ImmutableMap<String,​com.google.common.collect.ImmutableList<String>> getBuckProvidedScripts()
        Get a mapping of short names to Paths for buck provided fix scripts