Showing 1,140 of 1,140 total issues
Class ExifReader
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
public sealed class ExifReader : IDisposable
{
private readonly Stream _stream;
private readonly BinaryReader _reader;
/// <summary>
Class ImmutableExtensions
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
public static class ImmutableExtensions {
private class Wrapper { // To wrap listener actions
public Action stateChangeListener;
}
Similar blocks of code found in 3 locations. Consider refactoring. Open
public static BsonValue operator -(BsonValue left, BsonValue right)
{
if (!left.IsNumber || !right.IsNumber) return BsonValue.Null;
if (left.IsInt32 && right.IsInt32) return left.AsInt32 - right.AsInt32;
- 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 238.
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 3 locations. Consider refactoring. Open
public static BsonValue operator +(BsonValue left, BsonValue right)
{
if (!left.IsNumber || !right.IsNumber) return BsonValue.Null;
if (left.IsInt32 && right.IsInt32) return left.AsInt32 + right.AsInt32;
- 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 238.
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 3 locations. Consider refactoring. Open
public static BsonValue operator *(BsonValue left, BsonValue right)
{
if (!left.IsNumber || !right.IsNumber) return BsonValue.Null;
if (left.IsInt32 && right.IsInt32) return left.AsInt32 * right.AsInt32;
- 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 238.
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 Unpatch
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
public JToken Unpatch(JToken right, JToken patch)
{
if (patch == null)
return right;
Method WriteElement
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static void WriteElement(ByteWriter writer, string key, BsonValue value)
{
// cast RawValue to avoid one if on As<Type>
switch (value.Type)
{
Method stbi__process_gif_raster
has a Cognitive Complexity of 39 (exceeds 20 allowed). Consider refactoring. Open
private byte[] stbi__process_gif_raster()
{
byte lzw_cs = 0;
var len = 0;
var init_code = 0;
- 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 diff_cleanupSemantic
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void diff_cleanupSemantic(List<Diff> diffs) {
bool changes = false;
// Stack of indices where equalities are found.
Stack<int> equalities = new Stack<int>();
// Always equal to equalities[equalitiesLength-1][1]
Method patch_splitMax
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void patch_splitMax(List<Patch> patches) {
short patch_size = this.Match_MaxBits;
for (int x = 0; x < patches.Count; x++) {
if (patches[x].length1 <= patch_size) {
continue;
File TgaDecoder.cs
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System.IO;
using StbImageSharp.Utility;
namespace StbImageSharp.Decoding
{
Class BsonDocument
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
public class BsonDocument : BsonValue, IDictionary<string, BsonValue>
{
public BsonDocument()
: base(BsonType.Document, new Dictionary<string, BsonValue>(StringComparer.OrdinalIgnoreCase))
{
Class FileExtensions
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
public static class FileExtensions {
public static DirectoryInfo GetChildDir(this DirectoryInfo self, string subDirName, bool assertThatChildMustExist = false, bool sanitize = true) {
subDirName.ThrowErrorIfNullOrEmpty("subDirName");
if (sanitize) { subDirName = Sanitize.SanitizeToDirName(subDirName); }
Class ZipFileReadSystem
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
[Obsolete("Use ZipArchiveFileSystem instead")]
public class ZipFileReadSystem : FileSystem {
private readonly ZipFile zip;
Consider simplifying this complex logical expression. Open
if ((v >= 'a' && v <= 'z') || (v >= 'A' && v <= 'Z') || (v >= '0' && v <= '9') ||
v == '+' || v == '/' || v == ':' || v == '.' || v == '-' || v == '_' || v == '~' ||
v > '\xFF') {
uri.Append(v);
} else if (v == Path.DirectorySeparatorChar || v == Path.AltDirectorySeparatorChar) {
Class AssertV3
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
public static class AssertV3 {
private const string LB = "\r\n";
private static object syncLock = new object();
Class AssertV2
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
[Obsolete("Use AssertV3 instead")]
public static class AssertV2 {
private const string LB = "\r\n";
private static object syncLock = new object();
Method Deserialize
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
internal object Deserialize(Type type, BsonValue value)
{
Func<BsonValue, object> custom;
// null value - null returns
Method match_bitap
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
protected int match_bitap(string text, string pattern, int loc) {
// assert (Match_MaxBits == 0 || pattern.Length <= Match_MaxBits)
// : "Pattern too long for this application.";
// Initialise the alphabet.
- 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
File MeshChainRenderer.cs
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System;
using UnityEngine;
namespace com.csutil.rendering
{