public void Test()
        {
            var Prop1 = 5;
            Prop1 = Prop1; //Noncompliant

            Prop1 = 2*Prop1;

            var y = 5;
            y = /*comment*/ y; //Noncompliant

            var x = new SelfAssignment
            {
                Prop1 = Prop1
            };
            x = new SelfAssignment(Prop1: Prop1);
            var z = new
            {
                Prop1 = Prop1
            };
        }
Example #2
0
        public void Test()
        {
            var Prop1 = 5;
            Prop1 = Prop1; //Noncompliant
//          ^^^^^^^^^^^^^

            Prop1 = 2*Prop1;

            var y = 5;
            y = /*comment*/ y; //Noncompliant {{Remove or correct this useless self-assignment.}}

            var x = new SelfAssignment
            {
                Prop1 = Prop1
            };
            x = new SelfAssignment(Prop1: Prop1);
            var z = new
            {
                Prop1 = Prop1
            };
        }
Example #3
0
        public void Test()
        {
            var Prop1 = 5;

            Prop1 = Prop1; //Noncompliant

            Prop1 = 2 * Prop1;

            var y = 5;

            y = /*comment*/ y; //Noncompliant

            var x = new SelfAssignment
            {
                Prop1 = Prop1
            };

            x = new SelfAssignment(Prop1: Prop1);
            var z = new
            {
                Prop1 = Prop1
            };
        }
Example #4
0
        public void Test()
        {
            var Prop1 = 5;

            Prop1 = Prop1; //Noncompliant
//          ^^^^^^^^^^^^^

            Prop1 = 2 * Prop1;

            var y = 5;

            y = /*comment*/ y; //Noncompliant {{Remove or correct this useless self-assignment.}}

            var x = new SelfAssignment
            {
                Prop1 = Prop1
            };

            x = new SelfAssignment(Prop1: Prop1);
            var z = new
            {
                Prop1 = Prop1
            };
        }