LineLengthGuard 4.2.0

dotnet add package LineLengthGuard --version 4.2.0
                    
NuGet\Install-Package LineLengthGuard -Version 4.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LineLengthGuard" Version="4.2.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LineLengthGuard" Version="4.2.0" />
                    
Directory.Packages.props
<PackageReference Include="LineLengthGuard">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LineLengthGuard --version 4.2.0
                    
#r "nuget: LineLengthGuard, 4.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LineLengthGuard@4.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LineLengthGuard&version=4.2.0
                    
Install as a Cake Addin
#tool nuget:?package=LineLengthGuard&version=4.2.0
                    
Install as a Cake Tool

Line Length Guard

Roslyn analyser that checks if the maximum line length is respected.

Rules

This analyser contains one single rule to achieve its objective:

Rule Title Description
LLG001 Line too long Ensures that lines are not longer than the maximum established value. It can be configured by settings.

Default exclusions

By default, there are some line patterns that are excluded from the analysis. They are considered as unbreakable so the analyser ignores them and does not report issues for them. Default excluded patterns are:

Pattern Description
*<see cref="*"/>* References in documentation.
*http://* \| *https://* URLs.

Apart from default exclusions, other ones can be configured with some available settings, explained in the following section.

Settings

A LineLengthGuardSettings.json file can be used to configure some settings of the analyser.

Available settings

Available settings are explained below:

Key Description
AllowLongMethodNamesWithUnderscores A value that indicates if method names that contain underscores are allowed to exceed the maximum line length. Its default value is false.
AllowLongStringDefinitions A value that indicates if string definitions are allowed to exceed the maximum line length. For this setting to take effect, the right part of the equal sign must be on a single line. Its default value is false.
ExcludedLineStarts A collection of strings that make lines starting with any of them to be excluded from the analysis. Lines with any start are analysed by default.
MaximumLineLength Maximum number of characters that a line is allowed to have. Its default value is 120.

Importation

Settings file must be imported into the project to be analysed in this way:

<ItemGroup>
  <AdditionalFiles Include="LineLengthGuardSettings.json" />
</ItemGroup>

Example

An example of a complete settings file is the following:

{
  "AllowLongMethodNamesWithUnderscores": false,
  "AllowLongStringDefinitions": false,
  "ExcludedLineStarts": [
    "// Filename: ",
    "namespace "
  ],
  "MaximumLineLength": 120
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.2.0 162 2/17/2025
4.1.2 113 12/21/2024
4.1.1 120 11/27/2024
4.1.0 122 11/26/2024
4.0.0 117 11/25/2024
3.0.0 119 11/24/2024
2.0.3 147 10/14/2024
2.0.2 130 9/14/2024
2.0.1 138 9/11/2024
2.0.0 131 9/10/2024
1.4.0 131 9/9/2024
1.3.0 126 8/29/2024
1.2.1 127 8/27/2024
1.2.0 119 7/24/2024
1.1.0 119 7/11/2024
1.0.3 132 7/9/2024
1.0.2 123 7/2/2024
1.0.1 133 7/2/2024
1.0.0 138 7/2/2024