Showing 196 of 517 total issues
Method LeaveDateDuplicate
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<bool> LeaveDateDuplicate(string userId, DateTime startDate, DateTime? endDate)
{
int valid = -1;
bool validIndicator = false;
LeaveRequest lastLeave = new LeaveRequest();
Method GetQuestionAsync
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<string> GetQuestionAsync(int scrumId, List<Question> questions, List<User> users, int projectId)
{
List<ScrumAnswer> scrumAnswers = _scrumAnswerDataRepository.FetchAsync(x => x.ScrumId == scrumId).Result.ToList();
User user = new User();
TemporaryScrumDetails temporaryScrumDetails = await FetchTemporaryScrumDetailsAsync(scrumId);
Method UpdateSickLeaveAsync
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);
Method Scrum
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void Scrum()
{
SlackSocketClient client = new SlackSocketClient(_environmentVariableRepository.ScrumBotToken);//scrumBot
// Creating a Action<MessageReceived> for Slack Socket Client to get connected.
Method Send
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void Send(EmailApplication email)
{
try
{
_logger.Info("something");
Method TaskMailBot
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void TaskMailBot()
{
_logger.Info("TaskMailAccessToken : " + _environmentVariableRepository.TaskmailAccessToken);
SlackSocketClient client = new SlackSocketClient(_environmentVariableRepository.TaskmailAccessToken);
// assigning bot token on Slack Socket Client
Method AddSlackUserInformationAsync
has a Cognitive Complexity of 30 (exceeds 20 allowed). Consider refactoring. Open
Open
public async Task AddSlackUserInformationAsync(string code)
{
string slackOAuthRequest = string.Format(_stringConstant.SlackOauthRequestUrl, _envVariableRepository.SlackOAuthClientId, _envVariableRepository.SlackOAuthClientSecret, code);
string slackOAuthResponse = await _httpClientService.GetAsync(_stringConstant.OAuthAcessUrl, slackOAuthRequest, null, _stringConstant.Bearer);
SlackOAuthResponse slackOAuth = JsonConvert.DeserializeObject<SlackOAuthResponse>(slackOAuthResponse);
- 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 StartTaskMailAsync
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public async Task<string> StartTaskMailAsync(string userId)
{
// method to get user's details, user's accesstoken, user's task mail details and list or else appropriate message will be send
var userAndTaskMailDetailsWithAccessToken = await GetUserAndTaskMailDetailsAsync(userId);
_logger.Info("Task Mail Bot Module, Is task mail question text : " + userAndTaskMailDetailsWithAccessToken.QuestionText);
Method AddTimeEntryToRedmineIssue
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task AddTimeEntryToRedmineIssue(ApplicationUser user, List<string> text)
{
int issueId;
string result;
if (ToCheckIssueExistOrNot(text[2], user.RedmineApiKey, out issueId, out result))
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
Method CreateRedmineIssue
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task CreateRedmineIssue(ApplicationUser user, List<string> text)
{
Priority priorityId;
Status statusId;
Tracker trackerId;
Method AddScrumAnswerAsync
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<string> AddScrumAnswerAsync(string slackUserName, string message, int? projectId, string slackUserId, bool isLinkCommand)
{
if (projectId != null)
{
//today's scrum of the channel
Method AddScrumAnswerAsync
has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring. Open
Open
private async Task<string> AddScrumAnswerAsync(string slackUserName, string message, int? projectId, string slackUserId, bool isLinkCommand)
{
if (projectId != null)
{
//today's scrum of the channel
- 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 UpdateLeaveSMTPExceptionAsync
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Fact, Trait("Category", "Required")]
public async Task UpdateLeaveSMTPExceptionAsync()
{
SmtpException ex = new SmtpException();
await AddUser();
Method IsScrumStartLeaveLinkCommandAsync
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<bool> IsScrumStartLeaveLinkCommandAsync(string scrumBotId, string message, string[] messageArray)
{
if (((String.Compare(messageArray[0], _stringConstant.Leave, StringComparison.OrdinalIgnoreCase) == 0) || (String.Compare(messageArray[0], _stringConstant.Start, StringComparison.OrdinalIgnoreCase) == 0)) && messageArray.Length == 2)
{
//"<@".Length is 2
Method SlackEventAsync
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[HttpPost]
[Route("slack/eventalert")]
public async Task<IHttpActionResult> SlackEventAsync(SlackEventApiAC slackEvent)
{
//slack verification
Method MarkScrumCompleteAsync
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<string> MarkScrumCompleteAsync(int scrumId, List<User> users, int questionCount)
{
//list of scrum answers of the given scrumId
List<ScrumAnswer> scrumAnswers = _scrumAnswerDataRepository.Fetch(x => x.ScrumId == scrumId).OrderBy(x => x.Id).ToList();
User user = new User();
Method ProcessExpectedUserResultAsync
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private async Task<string> ProcessExpectedUserResultAsync(User user, string applicantId, List<User> users, int projectId, string applicant, int scrumId, List<Question> questions)
{
//the expected user and the interacting user are same and is active
if (user?.SlackUserId == applicantId)
{
Function css
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var css = (function() {
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
cssProps = {};
function camelCase(string) {
Method UpdateLeaveAsync
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
[Fact, Trait("Category", "Required")]
public async Task UpdateLeaveAsync()
{
await AddUser();
await AddThreeUserIncomingWebHookAsync();