TypeName | SA1636FileHeaderCopyrightTextMustMatch |
CheckId | SA1636 |
Category | Documentation Rules |
The file header at the top of a C# code file does not contain the appropriate copyright text.
A violation of this rule occurs when the file header at the top of a C# file does not contain the copyright text that has been specified for the project.
In order to enable this rule, the copyrightText
property must have been specified. See the configuration section for details on how to set this up.
The value of the xmlHeader
property will influence the behavior of this rule. When the xmlHeader
property is true (the default), StyleCop Analyzers expects file headers to conform to the following standard StyleCop format.
// <copyright file="{fileName}" company="{companyName}">
// {copyrightText}
// </copyright>
When the xmlHeader
property is explicitly set to false, StyleCop Analyzers expects file headers to conform to the following customizable format.
// {copyrightText}
With these settings in place, every file within the project should contain the required copyright text in the format described above.
This rule will accept several comment styles. The examples below give an overview of accepted styles.
Examples with the xmlHeader
property set to true
// <copyright file="{fileName}" company="{companyName}">
// {copyrightText}
// </copyright>
// ----------------------------------------------------------------------
// <copyright file="{fileName}" company="{companyName}">
// {copyrightText}
// </copyright>
// ----------------------------------------------------------------------
/* <copyright file="{fileName}" company="{companyName}">
* {copyrightText}
* </copyright>
*/
/*
<copyright file="{fileName}" company="{companyName}">
{copyrightText}
</copyright>
*/
Examples with the xmlHeader
property set to false
// {copyrightText}
/* {copyrightText} */
/*
* {copyrightText}
*/
/*
{copyrightText}
*/
To fix a violation of this rule, add your company's standard copyright text to the file header copyright tag.
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1636:FileHeaderCopyrightTextMustMatch", Justification = "Reviewed.")]
#pragma warning disable SA1636 // FileHeaderCopyrightTextMustMatch
#pragma warning restore SA1636 // FileHeaderCopyrightTextMustMatch