Showing 1,140 of 1,140 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
private static LogConsoleUi InitLogConsoleUi() {
var targetCanvas = RootCanvas.GetOrAddRootCanvasV2().gameObject;
var toastContainer = targetCanvas.AddChild(ResourcesV2.LoadPrefab("Messages/LogConsoleUi1"));
return toastContainer.GetComponentInChildren<LogConsoleUi>();
}
- 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 68.
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 share
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public bool share(string title, string text, string url = "", byte[] file = null, string fileName = "") {
Method CheckRectTransformRecursive
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static void CheckRectTransformRecursive(RectTransform rectTransform, Vector2 pointerPos, Camera camera, bool culledByCanvasGroup, List<Entry> result) {
Method ExecuteRepeated
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static IEnumerator ExecuteRepeated(Func<bool> task, MonoBehaviour mono, int repeatDelayInMs, int firstDelayInMs = 0, float rep = -1) {
Method LerpWithVelocity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static float LerpWithVelocity(float self, float destination, ref float currentVelocity, float dt, float omega = 1) {
Method sharejs
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static extern bool sharejs(string title, string text, string url, string file, string fileName);
Method SubscribeToStateChanges_OnChanged
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static void SubscribeToStateChanges_OnChanged<T, V>(UnityEngine.Object self, IDataStore<T> store, Action<V> updateUi, Wrapper w, V newVal) {
Method ExecuteRepeated
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static Coroutine ExecuteRepeated(this MonoBehaviour self, Func<bool> task,
int delayInMsBetweenIterations, int delayInMsBeforeFirstExecution = 0, float repetitions = -1) {
Method LerpWithVelocity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static Quaternion LerpWithVelocity(this Quaternion self, Quaternion destination, ref Vector4 currentVelocity, float dt, float omega = 1) {
Method Show
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static async Task<bool> Show(string caption, string message, string confirmBtnText = null, string dialogPrefabName = "Dialogs/DefaultDialog2", string cancelBtnText = null) {
Method With
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static Color With(this Color c, float r = -1, float g = -1, float b = -1, float a = -1) {
Method Map
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static float Map(float x, float in_min, float in_max, float out_min, float out_max)
Method With
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static Color32 With(this Color32 c, int r = -1, int g = -1, int b = -1, int a = -1) {
Method SetupButtons
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static void SetupButtons(ListFieldView listView, JObject root, JsonSchemaToView viewGenerator, JArray modelArray, Dictionary<FieldView, JToken> map) {
Method CreateChildEntryView
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ListFieldView self, JObject root, JsonSchemaToView viewGenerator, JToken modelEntry, string fieldName) {
Method LerpWithVelocity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static Vector3 LerpWithVelocity(this Vector3 self, Vector3 destination, ref Vector3 currentVelocity, float dt, float omega = 20f) {
Method Show
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static async Task<DialogResult> Show(string caption, string message, string confirmBtnText = null, Func<string, bool> validate = null, string dialogPrefabName = "Dialogs/DefaultInputDialog1") {
Method SetPadding
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static RectTransform SetPadding(this RectTransform self, float left, float right, float top, float bottom) {
Method diff_bisectSplit
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private List<Diff> diff_bisectSplit(string text1, string text2,
int x, int y, DateTime deadline) {
Method share
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public bool share(string title, string text, string url, string base64FileString, string fileName) {