Showing 3,203 of 3,219 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
constraints: table =>
{
table.PrimaryKey("PK_fields", x => x.id);
table.ForeignKey(
name: "FK_fields_check_lists_check_list_id",
- 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 179.
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 options_Create_DoesCreate
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task options_Create_DoesCreate()
{
// Arrange
#region QuestionSet
Method CreateMultiPictureXMLResult
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Task<string> CreateMultiPictureXMLResult(bool create)
{
if (create)
{
await testHelpers.GenerateDefaultLanguages();
Method CaseToJasperXml
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Task<string> CaseToJasperXml(CaseDto cDto, ReplyElement reply, int caseId, string timeStamp,
string customPathForUploadedData, string customXMLContent, Language language)
{
string methodName = "Core.CaseToJasperXml";
try
Method QuestionTranslation_Create_DoesCreate_W_MicrotingUID
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task QuestionTranslation_Create_DoesCreate_W_MicrotingUID()
{
Random rnd = new Random();
Method Core_eForm_SimplePictureFormFromXML_ReturnseMainElement
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task Core_eForm_SimplePictureFormFromXML_ReturnseMainElement()
{
// Arrange
string xmlstring = @"
Method Core_eFormSimpleSaveButtonFormFromXML_ReturnseMainElement
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task Core_eFormSimpleSaveButtonFormFromXML_ReturnseMainElement()
{
string xmlstring = @"
<?xml version='1.0' encoding='UTF-8'?>
Method QuestionTranslation_Create_DoesCreate_WO_MicrotingUID
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task QuestionTranslation_Create_DoesCreate_WO_MicrotingUID()
{
Random rnd = new Random();
Method Options_Create_DoesCreate
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task Options_Create_DoesCreate()
{
Random rnd = new Random();
Method LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid()
{
//Assert
Random rnd = new Random();
Method TemplateItemRead
has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring. Open
public async Task<Template_Dto> TemplateItemRead(int templateId, Language language)
{
string methodName = "SqlController.TemplateItemRead";
try
- 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
if (groupElement.Label.Split("|").Length > 1)
{
checkListTranslation = new CheckListTranslation
{
CheckListId = cl.Id,
- 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 175.
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
if (groupElement.Label.Split("|").Length > 2)
{
checkListTranslation = new CheckListTranslation
{
CheckListId = cl.Id,
- 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 175.
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 Core_Site_SiteDelete_ReturnsTrue
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test] //Using Communicatorn needs httpMock
public async Task Core_Site_SiteDelete_ReturnsTrue()
{
// Arrange
string siteName = Guid.NewGuid().ToString();
Method Up
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_LanguageQuestionSetVersions_LanguageQuestionSets_LanguageQues",
table: "LanguageQuestionSetVersions");
Method DbFieldToField
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<Models.Field> DbFieldToField(MicrotingDbContext db, Field dbField, Language language)
{
//await using var db = GetContext();
Models.Field field = new Models.Field
{
Method LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid_AddsUid
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task LanguageQuestionSet_Update_DoesUpdate_WO_MicrotingUid_AddsUid()
{
//Assert
Random rnd = new Random();
Method SiteSurveyConfiguration_Delete_DoesDelete
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task SiteSurveyConfiguration_Delete_DoesDelete()
{
//Arrange
Method Core_eFormSimpleInfoboxFormFromXML_ReturnseMainElement
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Test]
public async Task Core_eFormSimpleInfoboxFormFromXML_ReturnseMainElement()
{
string xmlstring = @"
<?xml version='1.0' encoding='UTF-8'?>
Method GetChecksAndFields
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void GetChecksAndFields(ref string clsLst, ref string fldLst, List<Element> elementLst,
string customPathForUploadedData)
{
var db = DbContextHelper.GetDbContext();
string jasperFieldXml = "";