Showing 488 of 488 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
[Test]
public void StressShortStrings()
{
- 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 258.
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
[Test]
public void StressLongStrings()
{
for (int i = 0; i < NORMAL_ITERATION; i++)
- 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 258.
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
[Test]
public void StressHugeStrings()
{
- 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 258.
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 changeGroup
has a Cognitive Complexity of 41 (exceeds 20 allowed). Consider refactoring. Open
void changeGroup(ItemModel item)
{
PopupPagesUIController.LaunchChangeGroupPopup((x) => {
if (x.Result != TR.Cancel) {
Device.BeginInvokeOnMainThread(() => {
- 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 OnBindingContextChanged
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
var container = BindingContext as IList;
Class AppPages
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
public static class AppPages
{
public static void Main()
{
var navPage = new NavigationPage(new MainScreenView())
File BusinessFixture.cs
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System.IO;
using NSWallet.Shared;
using NUnit.Framework;
namespace NSWallet.UnitTests
File DefaultTheme.cs
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
using Xamarin.Forms;
namespace NSWallet
{
public class DefaultTheme : ITheme
Method LocalizationExceptionsCommon
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
static bool LocalizationExceptionsCommon(string trTag)
{
switch (trTag)
{
case "admin_password_placeholder":
Method ExecuteSelectedItemCommand
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
void ExecuteSelectedItemCommand(object obj)
{
IsEditItemPanel = false;
IsEditFolderPanel = false;
if (obj == null) return;
File Pages.cs
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System;
using System.Collections.Generic;
using NSWallet.Enums;
using NSWallet.NetStandard;
using NSWallet.NetStandard.Interfaces;
Method ExecuteMenuTappedCommand
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
void ExecuteMenuTappedCommand(object obj)
{
if (obj != null) {
var popupItem = (PopupItem)obj;
switch (popupItem.Action) {
File LabelScreenViewModel.cs
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
Method AddCheckbox
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
void AddCheckbox(StackLayout settingsLayout, string settingName, string checkedProperty, string menuIcon, string toggleCommand, string chosenSelectionProperty = null, bool isPremium = false)
{
var checkboxLayout = new StackLayout {
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.Fill,
Method GeneratePDF
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
public void GeneratePDF()
{
CleanCache();
// Get NSWItems
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
List<ItemList> searchByText(string text)
{
var loweredText = text.ToLower();
var searchResult = new List<ItemList>();
foreach (var item in savedList) {
- 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 213.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
List<ItemList> searchByText(string text)
{
var loweredText = text.ToLower();
var searchResult = new List<ItemList>();
foreach (var item in savedList) {
- 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 213.
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 popupWithList
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
StackLayout popupWithList(string selectedProperty, string itemSourceProperty, string iconProperty, string nameProperty, string headerText = null, string headerIcon = null, string headerCommandProperty = null)
{
var listLayout = new StackLayout { Spacing = 0 };
if (headerText != null) {
Method GetPurchases
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static async Task<PremiumStatus> GetPurchases()
{
try
{
// Temporary BETA for Mac Desktop version
Method LocalizationExceptionsLangPT
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
static bool LocalizationExceptionsLangPT(string trTag)
{
switch (trTag)
{
case "premium_status":