Showing 1,140 of 1,140 total issues
Method CalcEntryChangesToOldState
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void CalcEntryChangesToOldState<E, K, V>(this E newState, ref E oldState, Func<V, K> getKey, Action<V> onEntryAdded, Action<V, V> onEntryUpdated, Action<K> onEntryRemoved) where E : IEnumerable<V> {
// TODO does not include order changes
var oldStateCopy = oldState;
oldState = newState;
Similar blocks of code found in 4 locations. Consider refactoring. Open
AddRoundedRectVerticesRing(
ref vh,
center,
width,
height,
- 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 97.
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
Similar blocks of code found in 4 locations. Consider refactoring. Open
AddRoundedRectVerticesRing(
ref vh,
center,
width,
height,
- 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 97.
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
Similar blocks of code found in 4 locations. Consider refactoring. Open
AddRoundedRectVerticesRing(
ref vh,
center,
width,
height,
- 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 97.
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
Similar blocks of code found in 4 locations. Consider refactoring. Open
AddRoundedRectVerticesRing(
ref vh,
center,
width,
height,
- 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 97.
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 OnSceneViewGUI
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
[InitializeOnLoadMethod]
private static void OnSceneViewGUI() {
#if UNITY_2019_1_OR_NEWER
SceneView.duringSceneGui += (SceneView sceneView) =>
#else
- 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 Find
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
public IndexNode Find(CollectionIndex index, BsonValue value, bool sibling, int order)
{
var cur = this.GetNode(order == Query.Ascending ? index.HeadNode : index.TailNode);
for (var i = index.MaxLevel - 1; i >= 0; i--)
- 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 ReadNext
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
private Token ReadNext(bool eatWhitespace)
{
// remove whitespace before get next token
if (eatWhitespace) this.EatWhitespace();
- 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 Erosion1D
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
private static byte[] Erosion1D(byte[] imageData, int width, int height, int bytePerPixel, int kernelSize, bool horizontal) {
var erodedImage = imageData.DeepCopy();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
var erodePixel = false;
- 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 RunRansac
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
public static M RunRansac<E, M>(this Random rnd, IEnumerable<E> e, int d, int minSampleSize, int iterations, Func<IEnumerable<E>, M> createModel, Func<M, E, bool> isInlier) where M : IModel<E> {
var elems = e.Cached();
if (minSampleSize > elems.Count()) {
throw new ArgumentOutOfRangeException($"minSampleSize must be smaller then nr of elements, otherwise ransac would not make sense: minSampleSize={minSampleSize} and elems.Count()={elems.Count()}");
}
- 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 AddViewForJsonSchemaField
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
public async Task<V> AddViewForJsonSchemaField(V parentView, JsonSchema field, string fieldName) {
JTokenType type = field.GetJTokenType();
if (type == JTokenType.Boolean) {
return await AddAndInit(parentView, field, fieldName, await NewBoolFieldView(field));
}
- 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 OnEnable
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected override void OnEnable() {
base.OnEnable();
InitMap();
map.Get<Button>("BtnClear").SetOnClickAction(delegate { ClearConsole(); });
map.Get<Button>("BtnHideLog").SetOnClickAction(delegate { ToggleConsoleVisibility(); });
Method OnGUI
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected void OnGUI() {
Event ev = Event.current;
float rowWidth = position.width - Padding * 2f, rowHeight = RowHeight;
GUIStyle rowGUIStyle = RowGUIStyle;
Method OnDrag
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void OnDrag(PointerEventData e) {
_latestPointerEventData = e;
if (keepDistanceToCam) {
if (e.pointerCurrentRaycast.worldPosition == Vector3.zero) { return; }
var direction2d = e.pointerCurrentRaycast.screenPosition;
Method diff_main
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private List<Diff> diff_main(string text1, string text2, bool checklines,
DateTime deadline) {
// Check for null inputs not needed since null can't be passed in C#.
// Check for equality (speedup).
Method diff_cleanupSemanticScore
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private int diff_cleanupSemanticScore(string one, string two) {
if (one.Length == 0 || two.Length == 0) {
// Edges are the best.
return 6;
}
Method TryLockAsync
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Task<bool> TryLockAsync(Func<Task> callback, CancellationToken cancel)
{
var @lock = new InnerLock(this, _asyncId.Value, ThreadId);
_asyncId.Value = Interlocked.Increment(ref AsyncLock.AsyncStackCounter);
Method TryLockAsync
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Task<bool> TryLockAsync(Func<Task> callback, TimeSpan timeout)
{
var @lock = new InnerLock(this, _asyncId.Value, ThreadId);
_asyncId.Value = Interlocked.Increment(ref AsyncLock.AsyncStackCounter);
Method stbi__expand_png_palette
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private int stbi__expand_png_palette(byte[] palette, int len, int pal_img_n)
{
uint i = 0;
var pixel_count = (uint)(img_x * img_y);
var orig = _out_;
Method ShowTutorial
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async Task ShowTutorial() {
{
var instructions = Snackbar.Show("Click on the 'Users' icon to switch to tab 2", "Ok", ui => ui.Destroy(), -1);
await UiEvents.WaitForToggle("Show Panel 2", true);
instructions.Destroy();