1# Copyright 2023 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5PRESUBMIT_VERSION = '2.0.0' 6 7 8def CheckSisoConfigFormat(input_api, output_api): 9 """Check if build/config/siso/*.star files are formatted correctly.""" 10 repo_root = input_api.change.RepositoryRoot() 11 log_level = 'debug' if input_api.verbose else 'warning' 12 commands = [] 13 for f in input_api.AffectedFiles(): 14 filepath = f.AbsoluteLocalPath() 15 if not filepath.endswith('.star'): 16 continue 17 name = 'Validate ' + filepath 18 cmd = ['lucicfg', 'fmt', '-dry-run', '-log-level', log_level, filepath] 19 commands.append(input_api.Command(name, cmd, {}, output_api.PresubmitError)) 20 return input_api.RunTests(commands) 21