auto-staging/builder

View on GitHub

Showing 8 of 16 total issues

Method CodeBuildModel.AdaptCodeBildJobForUpdate has 89 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (CodeBuildModel *CodeBuildModel) AdaptCodeBildJobForUpdate(event types.Event) error {
    // Adapt branch name to only contain allowed characters for CodeBuild name
    reg, err := regexp.Compile("[^a-zA-Z0-9]+")
    if err != nil {
        helper.Logger.Log(err, map[string]string{"module": "model/CreateCodeBuildJob", "operation": "regex/compile"}, 0)
Severity: Major
Found in model/update.go - About 2 hrs to fix

    Method CodeBuildModel.CreateCodeBuildJob has 80 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (CodeBuildModel *CodeBuildModel) CreateCodeBuildJob(event types.Event) error {
        // Adapt branch name to only contain allowed characters for CodeBuild name
        reg, err := regexp.Compile("[^a-zA-Z0-9]+")
        if err != nil {
            helper.Logger.Log(err, map[string]string{"module": "model/CreateCodeBuildJob", "operation": "regex/compile"}, 0)
    Severity: Major
    Found in model/create.go - About 2 hrs to fix

      Method CodeBuildModel.AdaptCodeBildJobForDelete has 61 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (CodeBuildModel *CodeBuildModel) AdaptCodeBildJobForDelete(event types.Event) error {
          // Adapt branch name to only contain allowed characters for CodeBuild name
          reg, err := regexp.Compile("[^a-zA-Z0-9]+")
          if err != nil {
              helper.Logger.Log(err, map[string]string{"module": "model/AdaptingCodeBildJobForDelete", "operation": "regex/compile"}, 0)
      Severity: Minor
      Found in model/delete.go - About 1 hr to fix

        Method CloudWatchEventsModel.removeRulesWithTarget has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring.
        Open

        func (CloudWatchEventsModel *CloudWatchEventsModel) removeRulesWithTarget(repository, branch, action string) error {
            helper.Logger.Log(errors.New("Removing "+action+" schedules for repo = "+repository+" and branch = "+branch), map[string]string{"module": "model/removeRuleWithTarget", "operation": "info/removeRules"}, 3)
        
            client := CloudWatchEventsModel.CloudWatchEventsAPI
        
        
        Severity: Minor
        Found in model/cw-update.go - About 35 mins to fix

        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 CodeBuildModel.AdaptCodeBildJobForDelete has 5 return statements (exceeds 4 allowed).
        Open

        func (CodeBuildModel *CodeBuildModel) AdaptCodeBildJobForDelete(event types.Event) error {
            // Adapt branch name to only contain allowed characters for CodeBuild name
            reg, err := regexp.Compile("[^a-zA-Z0-9]+")
            if err != nil {
                helper.Logger.Log(err, map[string]string{"module": "model/AdaptingCodeBildJobForDelete", "operation": "regex/compile"}, 0)
        Severity: Major
        Found in model/delete.go - About 35 mins to fix

          Method CloudWatchEventsModel.removeRulesWithTarget has 5 return statements (exceeds 4 allowed).
          Open

          func (CloudWatchEventsModel *CloudWatchEventsModel) removeRulesWithTarget(repository, branch, action string) error {
              helper.Logger.Log(errors.New("Removing "+action+" schedules for repo = "+repository+" and branch = "+branch), map[string]string{"module": "model/removeRuleWithTarget", "operation": "info/removeRules"}, 3)
          
              client := CloudWatchEventsModel.CloudWatchEventsAPI
          
          
          Severity: Major
          Found in model/cw-update.go - About 35 mins to fix

            Method CodeBuildModel.AdaptCodeBildJobForUpdate has 5 return statements (exceeds 4 allowed).
            Open

            func (CodeBuildModel *CodeBuildModel) AdaptCodeBildJobForUpdate(event types.Event) error {
                // Adapt branch name to only contain allowed characters for CodeBuild name
                reg, err := regexp.Compile("[^a-zA-Z0-9]+")
                if err != nil {
                    helper.Logger.Log(err, map[string]string{"module": "model/CreateCodeBuildJob", "operation": "regex/compile"}, 0)
            Severity: Major
            Found in model/update.go - About 35 mins to fix

              Method CloudWatchEventsModel.UpdateCloudWatchEvents has 5 return statements (exceeds 4 allowed).
              Open

              func (CloudWatchEventsModel *CloudWatchEventsModel) UpdateCloudWatchEvents(event types.Event) error {
                  // Adapt branch name to only contain allowed characters for CodeBuild name
                  reg, err := regexp.Compile("[^a-zA-Z0-9]+")
                  if err != nil {
                      helper.Logger.Log(err, map[string]string{"module": "model/UpdateCloudWatchEventsForEnvironment", "operation": "regex/compile"}, 0)
              Severity: Major
              Found in model/cw-update.go - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language