Class FixBuckConfig

    • Constructor Detail

      • FixBuckConfig

        public FixBuckConfig()
    • Method Detail

      • getFixScript

        public Optional<<String>> getFixScript()
        Get the script to run when buck fix is invoked
      • getLegacyFixScript

        public Optional<<String>> getLegacyFixScript()
        Get the previous script that JASABI fixes
      • getFixScriptContact

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

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

        public 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

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

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

        public<String> getInterpolatedFixScript​(<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.

        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}`
        The interpolated command to run
      • getInterpolatedFixScriptMessage

        public String getInterpolatedFixScriptMessage​(<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

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

        public<String,​<String>> getBuckProvidedScripts()
        Get a mapping of short names to Paths for buck provided fix scripts