Showing 886 of 3,221 total issues
Method SettingCreate
has 219 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async Task<bool> SettingCreate(Settings name)
{
await using var db = GetContext();
//key point
// Id = settings.name
Method DbSetup
has a Cognitive Complexity of 71 (exceeds 20 allowed). Consider refactoring. Open
Open
public async Task<string> DbSetup(string token)
{
// try
// {
DbContextHelper dbContextHelper = new DbContextHelper(connectionString);
- 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
Consider simplifying this complex logical expression. Open
Open
if (searchKey.Contains("!"))
{
searchKey = searchKey.ToLower().Replace("!", "");
IQueryable<Case> excludeQuery = db.Cases.AsNoTracking().Where(x =>
x.DoneAtUserModifiable > start && x.DoneAtUserModifiable < end);
Method Down
has 216 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_folders_folders_parentId",
table: "folders");
Method Fields_Create_DoesCreate
has 215 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Test]
public async Task Fields_Create_DoesCreate()
{
short shortMinValue = Int16.MinValue;
short shortmaxValue = Int16.MaxValue;
Method GetDataItem
has 212 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task GetDataItem(List<DataItem> lstDataItem, List<DataItemGroup> lstDataItemGroup, Field field,
Language language, bool includeDummyFields)
{
string methodName = "SqlController.GetDataItem";
try
Method SQL_Template_TemplateItemReadAll_DoesSortAccordingly
has 211 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Test]
public async Task SQL_Template_TemplateItemReadAll_DoesSortAccordingly()
{
// Arrance
Method Up
has 211 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_survey_configuration_versions_surveyConfigurationId",
table: "survey_configuration_versions",
File ReportHelper.cs
has 518 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
Method TemplateItemRead
has 208 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async Task<Template_Dto> TemplateItemRead(int templateId, Language language)
{
string methodName = "SqlController.TemplateItemRead";
try
Method Cases_Update_DoesUpdate
has 205 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Test]
public async Task Cases_Update_DoesUpdate()
{
//Arrange
Method FieldValues_Create_DoesCreate
has 204 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Test]
public async Task FieldValues_Create_DoesCreate()
{
short shortMinValue = Int16.MinValue;
short shortmaxValue = Int16.MaxValue;
Method SaveAnswer
has a Cognitive Complexity of 67 (exceeds 20 allowed). Consider refactoring. Open
Open
private async Task SaveAnswer(JToken subItem, int questionSetId)
{
Log.LogStandard("Core.SaveAnswer", $"called {DateTime.UtcNow}");
var settings = new JsonSerializerSettings { Error = (se, ev) => { ev.ErrorContext.Handled = true; } };
await using (var db = DbContextHelper.GetDbContext())
- 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
Class HttpFake
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class HttpFake : IHttp
{
// var
// private string protocolXml = "6";
Method Up
has 199 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override void Up(MigrationBuilder migrationBuilder)
{
//Setup for SQL Server Provider
string autoIDGenStrategy = "SqlServer:ValueGenerationStrategy";
Method TemplateItemReadAll
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async Task<List<Template_Dto>> TemplateItemReadAll(bool includeRemoved, string siteWorkflowState,
string searchKey, bool descendingSort, string sortParameter, List<int> tagIds, TimeZoneInfo timeZoneInfo,
Language language)
{
string methodName = "SqlController.TemplateItemReadAll";
Class Http
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class Http : IHttp
{
private const string ProtocolXml = "6";
private const string ProtocolEntitySearch = "1";
private const string ProtocolEntitySelect = "4";
Method CheckLists_Delete_DoesSetWorkflowStateToRemoved
has 186 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Test]
public async Task CheckLists_Delete_DoesSetWorkflowStateToRemoved()
{
//Arrange
Method DbSetup
has 185 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async Task<string> DbSetup(string token)
{
// try
// {
DbContextHelper dbContextHelper = new DbContextHelper(connectionString);
Method Down
has 184 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CheckLisTranslations");