Showing 1,140 of 1,140 total issues
Avoid deeply nested control flow statements. Open
if (value > 0)
data[idx] += bit;
else
data[idx] -= bit;
Method SetColorAt
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private static void SetColorAt(byte[] imageData, int x, int y, int width, byte[] color, int bytesPerPixel) {
Method SetColorAt
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private static void SetColorAt(byte[] imageData, int x, int y, int width, byte[] color, int bytesPerPixel) {
Method BoxFilterSingleChannel
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
public static double[] BoxFilterSingleChannel(double[] img, int width, int height, int radius, int channels) {
var kernalSize = 2 * radius;
if (kernalSize % 2 == 0) kernalSize++;
var hBlur = new double[img.Length];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (ColorIsValue(trimap, i, j, 0)) {
SetColorAt(trimap, x, y, almostBlack);
} else if (ColorIsValue(trimap, i, j, 255)) {
SetColorAt(trimap, x, y, almostWhite);
}
Method LogMethodDone
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public void LogMethodDone(Stopwatch timing, object[] args, int maxAllowedTimeInMs, string sourceMemberName, string sourceFilePath, int sourceLineNumber) {
Method NearestDistance
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
private double NearestDistance(Dictionary<Point, double> boundaryDistance, Point p) {
while (true) {
if (boundaryDistance.TryGetValue(p, out double dist)) { return dist; }
// If the point is not in the boundary, expand the entries in the dict by 1 in all directions and check again
var pointsArray = boundaryDistance.Keys.ToArray();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ExtractFieldDocu
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public virtual bool ExtractFieldDocu(JsonSchema field, MemberInfo m, Type modelType, JTokenType t, object pInstance, JToken jpInstance) {
Avoid deeply nested control flow statements. Open
if (m_HasFieldsEnclosedInQuotes & ((int)m_TextFieldType == (int)FieldType.Delimited))
{
if (string.Compare(Token.Trim(), "\"", StringComparison.Ordinal) == 0)
throw new InvalidOperationException(); //GetInvalidOperationException[ResID.MyID.TextFieldParser_InvalidComment];
}
Method DoPropagateIteration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private void DoPropagateIteration(byte[] trimap, List<Point> foregroundBoundary, List<Point> backgroundBoundary, Sample[][] samples, int w, int h) {
Avoid deeply nested control flow statements. Open
if (i < 0 || i >= w || j < 0 || j >= h) { continue; }
Method LogMethodDone
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public virtual void LogMethodDone(Stopwatch timing, object[] args, int maxAllowedTimeInMs, string sourceMemberName, string sourceFilePath, int sourceLineNumber) {
Avoid deeply nested control flow statements. Open
if (m_Buffer[Cursor] == '\n')
{
Cursor += 1;
Builder.Append('\n');
}
Identical blocks of code found in 3 locations. Consider refactoring. Open
public override async Task<bool> Remove(string key) {
this.ThrowErrorIfDisposed();
var res = await base.Remove(key);
foreach (var s in _categoryStores.Values) { res &= await s.Remove(key); }
return res;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 3 locations. Consider refactoring. Open
public override async Task<bool> Remove(string key) {
this.ThrowErrorIfDisposed();
var res = await base.Remove(key);
foreach (var s in _categoryStores.Values) { res &= await s.Remove(key); }
return res;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method LogMethodDone
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
void LogMethodDone(Stopwatch timing, object[] args, int maxAllowedTimeInMs, string sourceMemberName, string sourceFilePath, int sourceLineNumber);
Similar blocks of code found in 3 locations. Consider refactoring. Open
public void LogWarning(string warning, params object[] args) {
PrintWarningMessage("> WARNING: " + warning + Log.ToArgsStr(args, ArgToString) + LB
+ " * at " + Log.CallingMethodStr(args) + LB + LB, args);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid deeply nested control flow statements. Open
if (!ColorIsValue(trimap, i, j, 0) && !ColorIsValue(trimap, i, j, 255)) { continue; }
Avoid deeply nested control flow statements. Open
if (!(pd <= r) || !(cd <= c)) { continue; }
Similar blocks of code found in 3 locations. Consider refactoring. Open
public void LogDebug(string msg, params object[] args) {
PrintDebugMessage("> " + msg + Log.ToArgsStr(args, ArgToString) + LB
+ " * at " + Log.CallingMethodStr(args) + LB + LB, args);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 75.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76