Promact/slack-erp-custom-integration-mvc

View on GitHub
Slack.Automation/Promact.Core.Repository/ScrumSetUpRepository/ScrumSetUpRepository.cs

Summary

Maintainability
C
1 day
Test Coverage

Method ProcessCommandsAsync has a Cognitive Complexity of 36 (exceeds 20 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))
            {

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 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 ListLinkAsync has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            private async Task<string> ListLinkAsync(string slackUserId)
            {
                string reply = string.Empty;
                var accessToken = await GetAccessToken(slackUserId);
                if (accessToken != null)

      Avoid deeply nested control flow statements.
      Open

                                  if (project.TeamLeader.IsActive)
                                  {
                                      //command to link
                                      if (String.Compare(command, _stringConstant.Link, StringComparison.OrdinalIgnoreCase) == 0)
                                          return await LinkAsync(slackChannelId, givenProjectName, project);

        Avoid too many return statements within this method.
        Open

                        return _stringConstant.OnlyPrivateChannel;

          Avoid too many return statements within this method.
          Open

                              return _stringConstant.YouAreNotInExistInOAuthServer;

            Avoid too many return statements within this method.
            Open

                                return _stringConstant.ProjectChannelNotLinked;

              Avoid too many return statements within this method.
              Open

                                      return string.Format(_stringConstant.NotTeamLeaderOfProject, givenProjectName, slackUserId);

                Avoid too many return statements within this method.
                Open

                                            return string.Format(_stringConstant.NotTeamLeader, slackUserId);

                  There are no issues that match your filters.

                  Category
                  Status