Showing 3,203 of 3,219 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
public async Task<bool> WorkerDelete(int workerId)
{
_log.LogEverything("Communicator.WorkerDelete", "called");
_log.LogVariable("Communicator.WorkerDelete", nameof(workerId), workerId);
- 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 129.
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 2 locations. Consider refactoring. Open
public async Task<bool> SiteWorkerDelete(int workerId)
{
_log.LogEverything("Communicator.SiteWorkerDelete", "called");
_log.LogVariable("Communicator.SiteWorkerDelete", nameof(workerId), workerId);
- 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 129.
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 Up
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_answer_values_options_OptionsId",
table: "answer_values");
Method Workers_Delete_DoesSetWorkflowstateToRemoved
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task Workers_Delete_DoesSetWorkflowstateToRemoved()
{
//Arrange
Method CasesToCsv
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
public async Task<string> CasesToCsv(int templateId, DateTime? start, DateTime? end, string pathAndName,
string customPathForUploadedData, string decimalSeparator, string thousandSeparator, bool utcTime,
CultureInfo cultureInfo, TimeZoneInfo timeZoneInfo, Language language, bool gpsCoordinates,
bool includeCheckListText)
Method SQL_Template_TemplateDisplayIndexChange_ChangesDisplayIndex
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task SQL_Template_TemplateDisplayIndexChange_ChangesDisplayIndex()
{
// Arrance
Method Up
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "FolderId",
table: "check_list_sites",
Method TemplateFieldReadAll
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Task<List<FieldDto>> TemplateFieldReadAll(int templateId, Language language)
{
string methodName = "SqlController.TemplateFieldReadAll";
_log.LogEverything(methodName, "Start");
try
Method MapVersion
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private object MapVersion(object obj)
{
Type type = obj.GetType().UnderlyingSystemType;
String className = type.Name;
var name = obj.GetType().FullName + "Version";
Method DbSettingsReloadRemote
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Task<string> DbSettingsReloadRemote()
{
try
{
DbContextHelper dbContextHelper = new DbContextHelper(connectionString);
Method Folders_Create_DoesCreate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task Folders_Create_DoesCreate()
{
//Arrange
Function check_new_nuget_version
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check_new_nuget_version(package_name):
# Construct the NuGet package URL
package_url = f"https://api.nuget.org/v3-flatcontainer/{package_name.lower()}/index.json"
#print(package_url)
- 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 CasesToCsv
has a Cognitive Complexity of 28 (exceeds 20 allowed). Consider refactoring. Open
public async Task<string> CasesToCsv(int templateId, DateTime? start, DateTime? end, string pathAndName,
string customPathForUploadedData, string decimalSeparator, string thousandSeparator, bool utcTime,
CultureInfo cultureInfo, TimeZoneInfo timeZoneInfo, Language language, bool gpsCoordinates,
bool includeCheckListText)
{
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
wordDoc.MainDocumentPart.Document.Body.InsertBefore(new Paragraph(
new Hyperlink(
new Run(
new RunProperties(
new RunStyle { Val = "InternetLink" },
- 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 125.
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 2 locations. Consider refactoring. Open
paragraph.Append(new Hyperlink(
new Run(
new RunProperties(
new RunStyle { Val = "InternetLink" },
new RunFonts { Ascii = "Arial", HighAnsi = "Arial" },
- 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 125.
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 SQL_File_FileCaseFindMUId_doesFindMUId
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task SQL_File_FileCaseFindMUId_doesFindMUId()
{
Random rnd = new Random();
Site site1 = await testHelpers.CreateSite("MySite", 22);
Method CaseDelete
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Task<bool> CaseDelete(int templateId, int siteUId, string workflowState)
{
string methodName = "Core.CaseDelete";
try
{
Method LanguageQuestionSet_Create_DoesCreate_W_MicrotingUid
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task LanguageQuestionSet_Create_DoesCreate_W_MicrotingUid()
{
//Assert
Random rnd = new Random();
Similar blocks of code found in 5 locations. Consider refactoring. Open
Microting.eForm.Infrastructure.Data.Entities.Case aCase = await testHelpers.CreateCase("caseUId", cl1,
DateTime.UtcNow, "custom", DateTime.UtcNow,
worker, rnd.Next(1, 255), rnd.Next(1, 255),
site, 66, "caseType", unit, DateTime.UtcNow, 1, worker, Constants.WorkflowStates.Created);
- 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 123.
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 2 locations. Consider refactoring. Open
[Test]
public async Task SQL_Tags_CreateTag_DoesCreateNewTag()
{
// Arrance
string tagName = "Tag1";
- 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 123.
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