Showing 196 of 517 total issues
Method UpdateLeaveRejectedAsync
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Fact, Trait("Category", "Required")]
public async Task UpdateLeaveRejectedAsync()
{
await AddUser();
await AddThreeUserIncomingWebHookAsync();
Method LeaveAsync
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<string> LeaveAsync(int projectId, string slackUserName, string slackUserId, string applicant, string applicantId)
{
string returnMsg;
//we will have to check whether the scrum is on going or not before calling FetchScrumStatus()
//because any command outside the scrum time must not be entertained except with the replies like "scrum is concluded","scrum has not started" or "scrum has not started".
Method LeaveUpdateSickAsync
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Fact, Trait("Category", "Required")]
public async Task LeaveUpdateSickAsync()
{
slackLeave.ResponseUrl = _stringConstant.IncomingWebHookUrl;
await AddThreeUserIncomingWebHookAsync();
Method Create
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(context.Get<PromactErpContext>()));
// Configure validation logic for usernames
manager.UserValidator = new UserValidator<ApplicationUser>(manager)
Method MarkLeaveAsync
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<string> MarkLeaveAsync(List<User> users, int scrumId, string applicant, List<Question> questions, int projectId, string slackUserId, string applicantId)
{
string returnMsg = string.Empty;
User user = users.FirstOrDefault(x => x.SlackUserId == applicantId);
if (user != null)
Method GetUserAndTaskMailDetailsAsync
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<UserAndTaskMailDetailsWithAccessToken> GetUserAndTaskMailDetailsAsync(string slackUserId)
{
UserAndTaskMailDetailsWithAccessToken userAndTaskMailDetailsWithAccessToken = new UserAndTaskMailDetailsWithAccessToken();
var user = await _userRepository.FirstOrDefaultAsync(x => x.SlackUserId == slackUserId);
if (user != null)
Method Initialization
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void Initialization()
{
user.Id = _stringConstant.StringIdForTest;
user.Email = _stringConstant.EmailForTest;
user.UserName = _stringConstant.EmailForTest;
Method LeaveAsync
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
private async Task<string> LeaveAsync(int projectId, string slackUserName, string slackUserId, string applicant, string applicantId)
{
string returnMsg;
//we will have to check whether the scrum is on going or not before calling FetchScrumStatus()
//because any command outside the scrum time must not be entertained except with the replies like "scrum is concluded","scrum has not started" or "scrum has not started".
- 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 MarkLeaveAsync
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
private async Task<string> MarkLeaveAsync(List<User> users, int scrumId, string applicant, List<Question> questions, int projectId, string slackUserId, string applicantId)
{
string returnMsg = string.Empty;
User user = users.FirstOrDefault(x => x.SlackUserId == applicantId);
if (user != null)
- 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 UpdateSickLeaveAsync
has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring. Open
private async Task<string> UpdateSickLeaveAsync(List<string> slackText, ApplicationUser user, string accessToken)
{
// checking from oAuth whether user is Admin or not
bool isAdmin = await _oauthCallsRepository.UserIsAdminAsync(user.Id, accessToken);
_logger.Debug("UpdateSickLeaveAsync user is admin : " + isAdmin);
- 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 AssignAnswersAsync
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<EmployeeScrumDetails> AssignAnswersAsync(Scrum scrum, DateTime scrumDate, User user)
{
_logger.Debug("Assign Answers Async: " + scrumDate);
EmployeeScrumDetails employeeScrumDetail = new EmployeeScrumDetails();
//Fetch all the scrum answers for a particular employee
Method ProcessCommandsAsync
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<string> ProcessCommandsAsync(string slackUserId, string slackChannelId, string givenProjectName, string command)
{
//Checks whether channelId starts with "G" or "C". This is done inorder to make sure that only gruops or channels are added manually
if (IsPrivateChannel(slackChannelId))
{
Method GetListOfEmailByMailSettingAsync
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<List<string>> GetListOfEmailByMailSettingAsync(bool isTo, int mailSettingId, string userId, int projectId)
{
List<string> emails = new List<string>();
var mailSettingMappings = (await _mailSettingMappingDataRepository.FetchAsync(x => x.MailSettingId == mailSettingId && x.IsTo == isTo)).ToList();
if (mailSettingMappings.Any())
Method Initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void Initialize()
{
profile.Skype = _stringConstant.TestUserId;
profile.Email = _stringConstant.EmailForTest;
profile.FirstName = _stringConstant.UserNameForTest;
Method TaskMailDetailsReportNextPreviousDateForEmployeeAsync
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Fact, Trait("Category", "Required")]
public async Task TaskMailDetailsReportNextPreviousDateForEmployeeAsync()
{
var userResponse = Task.FromResult(_stringConstant.UserDetailsFromOauthServer);
var userRequestUrl = string.Format(_stringConstant.FirstAndSecondIndexStringFormat, _stringConstant.UserDetailsUrl, _stringConstant.FirstNameForTest);
Method TaskMailDetailsReportNextPreviousDateAsync
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Fact, Trait("Category", "Required")]
public async Task TaskMailDetailsReportNextPreviousDateAsync()
{
var userResponse = Task.FromResult(_stringConstant.UserDetailsFromOauthServer);
var userRequestUrl = string.Format(_stringConstant.FirstAndSecondIndexStringFormat, _stringConstant.UserDetailsUrl, _stringConstant.FirstNameForTest);
Method ReplyStatusofScrumToClient
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private string ReplyStatusofScrumToClient(ScrumStatus scrumStatus)
{
string returnMessage;
switch (scrumStatus)
{
Method GetAsync
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Task<string> GetAsync(string baseUrl, string contentUrl, string accessToken, string accessTokenType)
{
try
{
_client = new System.Net.Http.HttpClient();
Method LeaveApplyForCLAsync
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
[Fact, Trait("Category", "Required")]
public async Task LeaveApplyForCLAsync()
{
await AddGroup();
await AddMailSetting();
Method FetchScrumStatusAsync
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async Task<ScrumStatus> FetchScrumStatusAsync(ProjectAc project, List<User> users, List<Question> questions)
{
if (project?.Id > 0)
{
if (project.IsActive)