<commit_before>﻿// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using ApiPort.Resources;
using Microsoft.Fx.Portability.ObjectModel;
using System.Linq;

namespace ApiPort.CommandLine
{
    internal class AnalyzeOptionSet : ServiceEndpointOptionSet
    {
        public AnalyzeOptionSet(string name)
            : base(name, AppCommands.AnalyzeAssemblies)
        {
            Add("f|file=", LocalizedStrings.ListOfAssembliesToAnalyze, UpdateInputAssemblies, true);
            Add("o|out=", LocalizedStrings.OutputFileName, e => OutputFileName = e);
            Add("d|description=", LocalizedStrings.DescriptionHelp, e => Description = e);
            Add("t|target=", LocalizedStrings.TargetsToCheckAgainst, UpdateTargets);
            Add("r|resultformat=", LocalizedStrings.ResultFormatHelp, UpdateOutputFormats);
            Add("p|showNonPortableApis", LocalizedStrings.CmdHelpShowNonPortableApis, e => { if (e != null) { RequestFlags |= AnalyzeRequestFlags.ShowNonPortableApis; } });
            Add("b|showBreakingChanges", LocalizedStrings.CmdHelpShowBreakingChanges, e => { if (e != null) { RequestFlags |= AnalyzeRequestFlags.ShowBreakingChanges; } });
            Add("noDefaultIgnoreFile", LocalizedStrings.CmdHelpNoDefaultIgnoreFile, e => { if (e != null) { RequestFlags |= AnalyzeRequestFlags.NoDefaultIgnoreFile; } });
            Add("i|ignoreAssemblyFile=", LocalizedStrings.CmdHelpIgnoreAssembliesFile, UpdateIgnoredAssemblyFiles);
            Add("s|suppressBreakingChange=", LocalizedStrings.CmdHelpSuppressBreakingChange, UpdateBreakingChangeSuppressions);
        }

        protected override bool ValidateValues()
        {
            // If nothing is set, default to ShowNonPortableApis
            if ((RequestFlags & (AnalyzeRequestFlags.ShowBreakingChanges | AnalyzeRequestFlags.ShowNonPortableApis)) == AnalyzeRequestFlags.None)
            {
                RequestFlags |= AnalyzeRequestFlags.ShowNonPortableApis;
            }

            // If no output formats have been supplied, default to Excel
            // TODO: Should probably get this from the service, not hard-coded
            if(!OutputFormats.Any())
            {
                UpdateOutputFormats("Excel");
            }

            return InputAssemblies.Any();
        }
    }
}
<commit_msg>Fix --resultFormat casing to match other parameters<commit_after>﻿// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using ApiPort.Resources;
using Microsoft.Fx.Portability.ObjectModel;
using System.Linq;

namespace ApiPort.CommandLine
{
    internal class AnalyzeOptionSet : ServiceEndpointOptionSet
    {
        public AnalyzeOptionSet(string name)
            : base(name, AppCommands.AnalyzeAssemblies)
        {
            Add("f|file=", LocalizedStrings.ListOfAssembliesToAnalyze, UpdateInputAssemblies, true);
            Add("o|out=", LocalizedStrings.OutputFileName, e => OutputFileName = e);
            Add("d|description=", LocalizedStrings.DescriptionHelp, e => Description = e);
            Add("t|target=", LocalizedStrings.TargetsToCheckAgainst, UpdateTargets);
            Add("r|resultFormat=", LocalizedStrings.ResultFormatHelp, UpdateOutputFormats);
            Add("p|showNonPortableApis", LocalizedStrings.CmdHelpShowNonPortableApis, e => { if (e != null) { RequestFlags |= AnalyzeRequestFlags.ShowNonPortableApis; } });
            Add("b|showBreakingChanges", LocalizedStrings.CmdHelpShowBreakingChanges, e => { if (e != null) { RequestFlags |= AnalyzeRequestFlags.ShowBreakingChanges; } });
            Add("noDefaultIgnoreFile", LocalizedStrings.CmdHelpNoDefaultIgnoreFile, e => { if (e != null) { RequestFlags |= AnalyzeRequestFlags.NoDefaultIgnoreFile; } });
            Add("i|ignoreAssemblyFile=", LocalizedStrings.CmdHelpIgnoreAssembliesFile, UpdateIgnoredAssemblyFiles);
            Add("s|suppressBreakingChange=", LocalizedStrings.CmdHelpSuppressBreakingChange, UpdateBreakingChangeSuppressions);
        }

        protected override bool ValidateValues()
        {
            // If nothing is set, default to ShowNonPortableApis
            if ((RequestFlags & (AnalyzeRequestFlags.ShowBreakingChanges | AnalyzeRequestFlags.ShowNonPortableApis)) == AnalyzeRequestFlags.None)
            {
                RequestFlags |= AnalyzeRequestFlags.ShowNonPortableApis;
            }

            // If no output formats have been supplied, default to Excel
            // TODO: Should probably get this from the service, not hard-coded
            if(!OutputFormats.Any())
            {
                UpdateOutputFormats("Excel");
            }

            return InputAssemblies.Any();
        }
    }
}

{'fraction_non_alphanumeric': 0.09661436829066887, 'fraction_numerical': 0.0, 'mean_word_length': 3.2240627724498694, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6191554', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1252, 'n_words': 270}