internal static List IndexFunctions()

in src/WorkerIndexingHelper.cs [47:72]


        internal static List<FunctionInformation> IndexFunctions(DirectoryInfo baseDir, out List<ErrorRecord> errors)
        {
            errorRecords = new List<ErrorRecord>();
            if (ContainsLegacyFunctions(baseDir))
            {
                throw new Exception(AzPowerShellSdkStrings.HybridModelDetected);
            }
            List<FileInfo> powerShellFiles = GetPowerShellFiles(baseDir);
            List<FunctionInformation> rpcFunctionMetadatas = new List<FunctionInformation>();

            foreach (FileInfo powerShellFile in powerShellFiles)
            {
                rpcFunctionMetadatas.AddRange(IndexFunctionsInFile(powerShellFile));
            }

            IEnumerable<FunctionInformation> noBindingFunctions = rpcFunctionMetadatas.Where(x => x.Bindings.Count() == 0);
            if (noBindingFunctions.Any())
            {
                errorRecords.Add(new ErrorRecord(new Exception(string.Format(AzPowerShellSdkStrings.FunctionsWithNoBindings, 
                                                               string.Join(", ", noBindingFunctions.Select(x => x.Name)))), 
                                                 "FunctionsWithNoBindings", ErrorCategory.SyntaxError, noBindingFunctions));
            }

            errors = errorRecords;
            return rpcFunctionMetadatas;
        }