Showing 27 of 50 total issues
Method InitializeComponent
has 281 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
Method InitializeComponent
has 161 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditServerForm));
this.label1 = new System.Windows.Forms.Label();
this.ServerTypeDdl = new System.Windows.Forms.ComboBox();
File Form1.cs
has 401 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
using NotifyMeCI.Engine.Enums;
using NotifyMeCI.Engine.Events;
using NotifyMeCI.Engine.Repositories.Interfaces;
using NotifyMeCI.Engine.Objects;
using NotifyMeCI.Injector;
File Form1.Designer.cs
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
namespace NotifyMeCI.GUI
{
partial class Form1
{
/// <summary>
Method InitializeComponent
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
this.CancelBtn = new System.Windows.Forms.Button();
this.OkBtn = new System.Windows.Forms.Button();
Class Form1
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public partial class Form1 : Form
{
#region Repositories
Method ValidateServerValues
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static string ValidateServerValues(string serverType, string name, string url, int poll, string apiToken, bool uniqueName = true)
{
try
{
// check server type
Method UpdateJobsList
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void UpdateJobsList(IList<CIJob> jobs)
{
if (jobs == default(IList<CIJob>) || !jobs.Any())
{
return;
Method UpdateJobGui
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void UpdateJobGui(IList<CIJob> jobs)
{
// Clear the current jobs list
if (JobListView.InvokeRequired)
{
Method AddServerBtn_Click
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void AddServerBtn_Click(object sender, EventArgs e)
{
var errorTitle = "Error Adding New Server";
try
Method CoreLogic
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void CoreLogic()
{
// get all the servers that need updating
var servers = IsFirstRun
? CIServerRepository.All()
Method SetupBuildStatusTable
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void SetupBuildStatusTable()
{
// get all status enum values
var statuses = Enum.GetNames(typeof(BuildStatusType));
var rows = statuses.Length + 1;
Method UpdateJob
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private CIJob UpdateJob(CIJob job, string token)
{
if (job == default(CIJob))
{
return job;
Method UpdateBtn_Click
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void UpdateBtn_Click(object sender, EventArgs e)
{
var errorTitle = "Error Updating Server";
try
Method ServerTypeDdl_SelectedIndexChanged
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void ServerTypeDdl_SelectedIndexChanged(object sender, EventArgs e)
{
var serverType = default(CIServerType);
var selectedItem = ServerTypeDdl.SelectedItem;
Method SaveBuildStatuses
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void SaveBuildStatuses()
{
var statuses = new List<BuildStatus>(BuildStatusTable.RowCount - 1);
for (var r = 1; r < BuildStatusTable.RowCount; r++)
Method UpdateJobsList
has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring. Open
Open
private void UpdateJobsList(IList<CIJob> jobs)
{
if (jobs == default(IList<CIJob>) || !jobs.Any())
{
return;
- 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 InitialiseJob
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private CIJob InitialiseJob(JToken projectJson, CIServer server)
{
if (!GetBool(projectJson["active"]))
{
return default(CIJob);
Method MapBuildStatus
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private BuildStatusType MapBuildStatus(string status)
{
if (string.IsNullOrWhiteSpace(status))
{
return BuildStatusType.Unknown;
Method MapColor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static Color MapColor(this IDictionary<BuildStatusType, BuildStatus> src, BuildStatusType statusType)
{
if (src.ContainsKey(statusType) && src[statusType].ColorA != 0)
{
var status = src[statusType];