Giter Site home page Giter Site logo

Comments (4)

jaybarden avatar jaybarden commented on June 17, 2024

Hi Ekhor,
Does your recent PR resolve this issue? - forgot to check when I was reviewing but as it was for auto-generated, it may well do.
Thanks in advance.
Jay

from dotnet-code-analysis.

realekhor avatar realekhor commented on June 17, 2024

hi Jay,
Thank you. yes i tested this on the cyclic complexity analyzer as well :)

regards,
ekhor

from dotnet-code-analysis.

realekhor avatar realekhor commented on June 17, 2024

i added one unit test here (https://github.com/Capgemini/dotnet-code-analysis/blob/master/Capgemini.CSharpCodeAnalysis/Capgemini.CodeAnalysis.CoreAnalysers/Tests/Capgemini.CodeAnalysis.CoreAnalysers.Test/Analyzers/MethodComplexityAnalyzerTests.cs )

    [TestMethod]
    public void IgnoresGneratedSourceCode()
    {
        var test = CommonConstants.AutoGeneratedCodeHeader + @"
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
namespace Test0
{
    public class TypeName
    {              
        public void DoStuff(int year, string message,int input)
        {   
            if(!string.IsNullOrWhiteSpace(message))
            {
                var variable1 = 20;
               var processedMessage = new StringBuilder();
                if(input > variable1)
                {
                    processedMessage.AppendLine( ""Maybe not hello world!"");
                }
                else if(input < variable1)
                {
                   processedMessage.AppendLine( message + ""Some other interesting message!"");
                }
                else
                {
                     processedMessage.AppendLine( ""Hello world"" + message);
                }
                var leapYear =false; 
                var date = new DateTime(year,3,1);
                var lastDayOfFebruaryForThisYear = date.AddDays(-1);
                if (lastDayOfFebruaryForThisYear.Day>28)
                {
                    leapYear=true;
                }
                var curDate = DateTime.UtcNow;
                if (curDate.Month == 2 && curDate.Day > 20)
                {
                    processedMessage.AppendLine(""This is some month!"");
                }
                else if (leapYear && curDate.Month > 6 && && curDate.Mont < 8 && curDate.Day > 10 && curDate.Day < 31)
                {
                    processedMessage.AppendLine(""This is getting exciting!"");
                }
                else if (curDate.Month == 12 && && curDate.Day == 25 && curDate.UtcNow.DayOfWeek== DayOfWeek.Monday)
                {
                    processedMessage.AppendLine(""This is Christmas is on Monday!"");
                }
        }
    }
}

}";

        VerifyCSharpDiagnostic(test);
    }

from dotnet-code-analysis.

jaybarden avatar jaybarden commented on June 17, 2024

Issue is resolved, this should have been closed at the time. My bad.

from dotnet-code-analysis.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.