go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/lucicfg/buildifier/lucicfgfmtrc.proto (about) 1 // Copyright 2022 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 syntax = "proto3"; 16 package lucicfgfmtconfig; 17 18 option go_package = "go.chromium.org/luci/lucicfg/buildifier"; 19 20 message LucicfgFmtConfig { 21 repeated Rules rules = 1; 22 23 // Rules will contain paths that are associated with 24 // a specific ordering rule 25 message Rules { 26 // Forward-slash delimited path prefixes for which this Rules message applies. 27 // 28 // When loading this config, lucicfg will organize all Rules by path. Rules with 29 // duplicate path values are not permitted (i.e. you cannot have two Rules with 30 // a path of "something", nor can you have the path "something" duplicated within 31 // a single Rules entry). 32 // 33 // When processing files, lucicfg will calculate the file's path as relative to 34 // this .lucicfgfmtrc file, and will select a single Rules set based on the longest 35 // matching path prefix. For example, if there are two Rules sets, one formatting 36 // "a" and another formatting "a/folder", then for the file "a/folder/file.star", 37 // only the second Rules set would apply. 38 // 39 // If NO Rules set matches the file path, then only default formatting will 40 // occur (i.e. lucicfg will only apply formatting which is not controlled by 41 // this Rules message. In particular, this means that formatting will not 42 // attempt to reorder function call arguments in any way). 43 repeated string path = 1; 44 45 // FunctionArgsSort allows you to reorder the arguments at function call sites, 46 // based on the name of the arguments. 47 // 48 // If this is set, then all functions will be sorted first by the order of its 49 // `arg` field, and then alphanumerically. This implies that setting this message 50 // without setting any `arg` values will sort all function call sites 51 // alphabetically. 52 // 53 // If this message is completely omitted, no call site function argument reordering 54 // will occur. 55 // 56 // The sorting only applies to kwarg-style arguments in files we want to format. 57 FunctionArgsSort function_args_sort = 2; 58 59 message FunctionArgsSort { 60 // Argument names in the order they should appear in calls. 61 // 62 // The ordering of an argument can be specific to a function by 63 // specifying the argument name as <function-name>.<arg-name>, where 64 // <function-name> is the name used at the callsite. The name the 65 // function is defined with is not considered. This means that loading a 66 // function with an alias will change which entries apply to calls to the 67 // function. When the ordering for an argument is determined, if 68 // <function-name>.<arg-name> is present, it will use the relative 69 // ordering of that entry to determine the order of the argument in the 70 // call. If <function-name>.<arg-name> is not present and <arg-name> is 71 // present, it will use the relative ordering of that entry to determine 72 // the order of the argument in the call. If neither 73 // <function-name>.<arg-name> nor <arg-name> are present, then the 74 // argument will appear in lexicographic order after any arguments that 75 // are specified in the list. 76 repeated string arg = 1; 77 } 78 } 79 }