Sha256: 44a905953e4c38d7a4638a1163b8d96ca758eacf5308e789dbe54dd8eabc4f14

Contents?: true

Size: 1.86 KB

Versions: 11

Compression:

Stored size: 1.86 KB

Contents

# frozen_string_literal: true

module Gitlab
  module Dangerfiles
    class Config
      # @!attribute project_name
      #   @return [String] the project name. Currently used by the Roulette plugin to fetch relevant reviewers/maintainers based on the project name. Default to +ENV["CI_PROJECT_NAME"]+.
      attr_accessor :project_name

      # @!attribute files_to_category
      #   @return [{Regexp => Array<Symbol>}, {Array<Regexp> => Array<Symbol>}] A hash of the form +{ filename_regex => categories, [filename_regex, changes_regex] => categories }+.
      #           +filename_regex+ is the regex pattern to match file names. +changes_regex+ is the regex pattern to
      #           match changed lines in files that match +filename_regex+. Used in `helper.changes_by_category`, `helper.changes`, and `helper.categories_for_file`.
      attr_accessor :files_to_category

      # @!attribute code_size_thresholds
      #   @return [{ high: Integer, medium: Integer }] a hash of the form +{ high: 42, medium: 12 }+ where +:high+ is the lines changed threshold which triggers an error, and +:medium+ is the lines changed threshold which triggers a warning. Also, see +DEFAULT_CHANGES_SIZE_THRESHOLDS+ for the format of the hash.
      attr_accessor :code_size_thresholds

      # @!attribute max_commits_count
      #   @return [Integer] the maximum number of allowed non-squashed/non-fixup commits for a given MR. A warning is triggered if the MR has more commits.
      attr_accessor :max_commits_count

      DEFAULT_CHANGES_SIZE_THRESHOLDS = { high: 2_000, medium: 500 }.freeze
      DEFAULT_COMMIT_MESSAGES_MAX_COMMITS_COUNT = 10

      def initialize
        @files_to_category = {}
        @project_name = ENV["CI_PROJECT_NAME"]
        @code_size_thresholds = DEFAULT_CHANGES_SIZE_THRESHOLDS
        @max_commits_count = DEFAULT_COMMIT_MESSAGES_MAX_COMMITS_COUNT
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gitlab-dangerfiles-2.11.0 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.10.2 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.10.1 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.10.0 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.9.3 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.9.2 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.9.1 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.9.0 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.8.0 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.7.1 lib/gitlab/dangerfiles/config.rb
gitlab-dangerfiles-2.7.0 lib/gitlab/dangerfiles/config.rb