-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GCop179 false alarm #263
Comments
@sungam3r The reason why GCop is not showing any warning for the first sample is b/c some of the constant values which are listed below have been excluded intentionally. But I managed the rule not kick in for interpolated string texts. @Karvan Please confirm i did the right thing "-2", "-1", "0", "1", "2", "3", "4", "5", "12", "1024", "true", "false", "10", "100", "0.1", "0.5", "0.01", "0.001", "0.0001", "0.00001", "1000", "360" |
Also this: #pragma warning disable 618 // GCop179 Do not hardcode numbers, strings or other values. Use constant fields, enums, config files or database as appropriate. |
@Foroughi This rule still have the previous problem on GCop2.6.1-rc2 |
@azadimehdi we need to stop kicking GCop179 when we see it's commented out or start with # like this example.
|
@Karvan This issue has already been solved. |
In what release version? |
@sungam3r It should be resolved in the latest version which is 2.6.2-rc1 |
Nope. This issue still exists. <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GCop.All.Geeks" Version="2.6.2-rc.1" />
</ItemGroup>
</Project> using System;
namespace ConsoleApp10
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
internal class Formatter
{
public static void Format(string name)
{
Console.WriteLine($"{name,11}"); // Warning GCop179 Do not hardcode numbers, strings or other values. Use constant fields, enums, config files or database as appropriate.
}
}
} |
@azadimehdi could you please have another look into that. @sungam3r thank you for updating this one. could you please let me know which version of GCop.Common have you installed on your project? if that's 2.6.2-rc.1 then we definitely should be able to replicate that. |
It seems to me that the rule should not be applied to formatting strings.
The text was updated successfully, but these errors were encountered: