1*1b3f573fSAndroid Build Coastguard Worker #region Copyright notice and license
2*1b3f573fSAndroid Build Coastguard Worker // Protocol Buffers - Google's data interchange format
3*1b3f573fSAndroid Build Coastguard Worker // Copyright 2015 Google Inc.  All rights reserved.
4*1b3f573fSAndroid Build Coastguard Worker // https://developers.google.com/protocol-buffers/
5*1b3f573fSAndroid Build Coastguard Worker //
6*1b3f573fSAndroid Build Coastguard Worker // Redistribution and use in source and binary forms, with or without
7*1b3f573fSAndroid Build Coastguard Worker // modification, are permitted provided that the following conditions are
8*1b3f573fSAndroid Build Coastguard Worker // met:
9*1b3f573fSAndroid Build Coastguard Worker //
10*1b3f573fSAndroid Build Coastguard Worker //     * Redistributions of source code must retain the above copyright
11*1b3f573fSAndroid Build Coastguard Worker // notice, this list of conditions and the following disclaimer.
12*1b3f573fSAndroid Build Coastguard Worker //     * Redistributions in binary form must reproduce the above
13*1b3f573fSAndroid Build Coastguard Worker // copyright notice, this list of conditions and the following disclaimer
14*1b3f573fSAndroid Build Coastguard Worker // in the documentation and/or other materials provided with the
15*1b3f573fSAndroid Build Coastguard Worker // distribution.
16*1b3f573fSAndroid Build Coastguard Worker //     * Neither the name of Google Inc. nor the names of its
17*1b3f573fSAndroid Build Coastguard Worker // contributors may be used to endorse or promote products derived from
18*1b3f573fSAndroid Build Coastguard Worker // this software without specific prior written permission.
19*1b3f573fSAndroid Build Coastguard Worker //
20*1b3f573fSAndroid Build Coastguard Worker // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21*1b3f573fSAndroid Build Coastguard Worker // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22*1b3f573fSAndroid Build Coastguard Worker // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23*1b3f573fSAndroid Build Coastguard Worker // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24*1b3f573fSAndroid Build Coastguard Worker // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25*1b3f573fSAndroid Build Coastguard Worker // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26*1b3f573fSAndroid Build Coastguard Worker // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27*1b3f573fSAndroid Build Coastguard Worker // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28*1b3f573fSAndroid Build Coastguard Worker // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29*1b3f573fSAndroid Build Coastguard Worker // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30*1b3f573fSAndroid Build Coastguard Worker // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31*1b3f573fSAndroid Build Coastguard Worker #endregion
32*1b3f573fSAndroid Build Coastguard Worker 
33*1b3f573fSAndroid Build Coastguard Worker #if !NET5_0_OR_GREATER
34*1b3f573fSAndroid Build Coastguard Worker // Copied with permission from https://github.com/dotnet/runtime/tree/8fbf206d0e518b45ca855832e8bfb391afa85972/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis
35*1b3f573fSAndroid Build Coastguard Worker namespace System.Diagnostics.CodeAnalysis
36*1b3f573fSAndroid Build Coastguard Worker {
37*1b3f573fSAndroid Build Coastguard Worker     /// <summary>
38*1b3f573fSAndroid Build Coastguard Worker     /// Suppresses reporting of a specific rule violation, allowing multiple suppressions on a
39*1b3f573fSAndroid Build Coastguard Worker     /// single code artifact.
40*1b3f573fSAndroid Build Coastguard Worker     /// </summary>
41*1b3f573fSAndroid Build Coastguard Worker     /// <remarks>
42*1b3f573fSAndroid Build Coastguard Worker     /// <see cref="UnconditionalSuppressMessageAttribute"/> is different than
43*1b3f573fSAndroid Build Coastguard Worker     /// <see cref="SuppressMessageAttribute"/> in that it doesn't have a
44*1b3f573fSAndroid Build Coastguard Worker     /// <see cref="ConditionalAttribute"/>. So it is always preserved in the compiled assembly.
45*1b3f573fSAndroid Build Coastguard Worker     /// </remarks>
46*1b3f573fSAndroid Build Coastguard Worker     [AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
47*1b3f573fSAndroid Build Coastguard Worker     internal sealed class UnconditionalSuppressMessageAttribute : Attribute
48*1b3f573fSAndroid Build Coastguard Worker     {
49*1b3f573fSAndroid Build Coastguard Worker         /// <summary>
50*1b3f573fSAndroid Build Coastguard Worker         /// Initializes a new instance of the <see cref="UnconditionalSuppressMessageAttribute"/>
51*1b3f573fSAndroid Build Coastguard Worker         /// class, specifying the category of the tool and the identifier for an analysis rule.
52*1b3f573fSAndroid Build Coastguard Worker         /// </summary>
53*1b3f573fSAndroid Build Coastguard Worker         /// <param name="category">The category for the attribute.</param>
54*1b3f573fSAndroid Build Coastguard Worker         /// <param name="checkId">The identifier of the analysis rule the attribute applies to.</param>
UnconditionalSuppressMessageAttribute(string category, string checkId)55*1b3f573fSAndroid Build Coastguard Worker         public UnconditionalSuppressMessageAttribute(string category, string checkId)
56*1b3f573fSAndroid Build Coastguard Worker         {
57*1b3f573fSAndroid Build Coastguard Worker             Category = category;
58*1b3f573fSAndroid Build Coastguard Worker             CheckId = checkId;
59*1b3f573fSAndroid Build Coastguard Worker         }
60*1b3f573fSAndroid Build Coastguard Worker 
61*1b3f573fSAndroid Build Coastguard Worker         /// <summary>
62*1b3f573fSAndroid Build Coastguard Worker         /// Gets the category identifying the classification of the attribute.
63*1b3f573fSAndroid Build Coastguard Worker         /// </summary>
64*1b3f573fSAndroid Build Coastguard Worker         /// <remarks>
65*1b3f573fSAndroid Build Coastguard Worker         /// The <see cref="Category"/> property describes the tool or tool analysis category
66*1b3f573fSAndroid Build Coastguard Worker         /// for which a message suppression attribute applies.
67*1b3f573fSAndroid Build Coastguard Worker         /// </remarks>
68*1b3f573fSAndroid Build Coastguard Worker         public string Category { get; }
69*1b3f573fSAndroid Build Coastguard Worker 
70*1b3f573fSAndroid Build Coastguard Worker         /// <summary>
71*1b3f573fSAndroid Build Coastguard Worker         /// Gets the identifier of the analysis tool rule to be suppressed.
72*1b3f573fSAndroid Build Coastguard Worker         /// </summary>
73*1b3f573fSAndroid Build Coastguard Worker         /// <remarks>
74*1b3f573fSAndroid Build Coastguard Worker         /// Concatenated together, the <see cref="Category"/> and <see cref="CheckId"/>
75*1b3f573fSAndroid Build Coastguard Worker         /// properties form a unique check identifier.
76*1b3f573fSAndroid Build Coastguard Worker         /// </remarks>
77*1b3f573fSAndroid Build Coastguard Worker         public string CheckId { get; }
78*1b3f573fSAndroid Build Coastguard Worker 
79*1b3f573fSAndroid Build Coastguard Worker         /// <summary>
80*1b3f573fSAndroid Build Coastguard Worker         /// Gets or sets the scope of the code that is relevant for the attribute.
81*1b3f573fSAndroid Build Coastguard Worker         /// </summary>
82*1b3f573fSAndroid Build Coastguard Worker         /// <remarks>
83*1b3f573fSAndroid Build Coastguard Worker         /// The Scope property is an optional argument that specifies the metadata scope for which
84*1b3f573fSAndroid Build Coastguard Worker         /// the attribute is relevant.
85*1b3f573fSAndroid Build Coastguard Worker         /// </remarks>
86*1b3f573fSAndroid Build Coastguard Worker         public string Scope { get; set; }
87*1b3f573fSAndroid Build Coastguard Worker 
88*1b3f573fSAndroid Build Coastguard Worker         /// <summary>
89*1b3f573fSAndroid Build Coastguard Worker         /// Gets or sets a fully qualified path that represents the target of the attribute.
90*1b3f573fSAndroid Build Coastguard Worker         /// </summary>
91*1b3f573fSAndroid Build Coastguard Worker         /// <remarks>
92*1b3f573fSAndroid Build Coastguard Worker         /// The <see cref="Target"/> property is an optional argument identifying the analysis target
93*1b3f573fSAndroid Build Coastguard Worker         /// of the attribute. An example value is "System.IO.Stream.ctor():System.Void".
94*1b3f573fSAndroid Build Coastguard Worker         /// Because it is fully qualified, it can be long, particularly for targets such as parameters.
95*1b3f573fSAndroid Build Coastguard Worker         /// The analysis tool user interface should be capable of automatically formatting the parameter.
96*1b3f573fSAndroid Build Coastguard Worker         /// </remarks>
97*1b3f573fSAndroid Build Coastguard Worker         public string Target { get; set; }
98*1b3f573fSAndroid Build Coastguard Worker 
99*1b3f573fSAndroid Build Coastguard Worker         /// <summary>
100*1b3f573fSAndroid Build Coastguard Worker         /// Gets or sets an optional argument expanding on exclusion criteria.
101*1b3f573fSAndroid Build Coastguard Worker         /// </summary>
102*1b3f573fSAndroid Build Coastguard Worker         /// <remarks>
103*1b3f573fSAndroid Build Coastguard Worker         /// The <see cref="MessageId "/> property is an optional argument that specifies additional
104*1b3f573fSAndroid Build Coastguard Worker         /// exclusion where the literal metadata target is not sufficiently precise. For example,
105*1b3f573fSAndroid Build Coastguard Worker         /// the <see cref="UnconditionalSuppressMessageAttribute"/> cannot be applied within a method,
106*1b3f573fSAndroid Build Coastguard Worker         /// and it may be desirable to suppress a violation against a statement in the method that will
107*1b3f573fSAndroid Build Coastguard Worker         /// give a rule violation, but not against all statements in the method.
108*1b3f573fSAndroid Build Coastguard Worker         /// </remarks>
109*1b3f573fSAndroid Build Coastguard Worker         public string MessageId { get; set; }
110*1b3f573fSAndroid Build Coastguard Worker 
111*1b3f573fSAndroid Build Coastguard Worker         /// <summary>
112*1b3f573fSAndroid Build Coastguard Worker         /// Gets or sets the justification for suppressing the code analysis message.
113*1b3f573fSAndroid Build Coastguard Worker         /// </summary>
114*1b3f573fSAndroid Build Coastguard Worker         public string Justification { get; set; }
115*1b3f573fSAndroid Build Coastguard Worker     }
116*1b3f573fSAndroid Build Coastguard Worker }
117*1b3f573fSAndroid Build Coastguard Worker #endif
118