<commit_before>module Fastlane
  module Actions

  require 'jira-ruby'

    class JiraTransitionsAction < Action
      def self.run(params)
        Actions.verify_gem!('jira-ruby')

        client = params[:client]
        issue = client.Issue.find(params[:ticket_id])
        issue_transitions = issue.transitions.all
        transition_builder = issue.transitions.build

        if params[:transition_id] 
          transition_builder.save!('transition' => {'id' => params[:transition_id]})
        else 
          transition = issue_transitions.select { |transition|
            if params[:matching]
              params[:matching].call(transition)
            else 
              transition.name == params[:transition_name]
            end
          }.first
          if !transition.nil? && !transition.id.nil?
           transition_builder.save('transition' => {'id' => transition.id })
          elsif params[:fail_if_no_matching] == true 
            UI.crash!("0 matching transitions")
          end
        end
      end

      def self.description
        "Runs transitions for specified JIRA tickets"
      end

      def self.authors
        ["<NAME>"]
      end

      def self.return_value
        # If your method provides a return value, you can describe here what it does
      end

      def self.details
        # Optional:
        "Helps to run transitions for specified JIRA tickets (matching by transition name or id)"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :client,
                                is_string: false,
                                optional: false,
                                type: JIRA::Client),
          FastlaneCore::ConfigItem.new(key: :ticket_id,
                               description: "ID of ticket",
                                  optional: false,
                                      type: String),
          FastlaneCore::ConfigItem.new(key: :transition_id,
                               description: "ID of transition to perform",
                                  optional: true,
                                      type: String,
                              verify_block: proc do |value|
                                              UI.user_error!("Invalid transition_id") if value.to_s.length == 0
                                          end),
          FastlaneCore::ConfigItem.new(key: :transition_name,
                               description: "Name of transition to perform",
                                  optional: true,
                                      type: String,
                              verify_block: proc do |value|
                                              UI.user_error!("Invalid transition_name") if value.to_s.length == 0<commit_msg>Documentation update<commit_after>module Fastlane
  module Actions

  require 'jira-ruby'

    class JiraTransitionsAction < Action
      def self.run(params)
        Actions.verify_gem!('jira-ruby')

        client = params[:client]
        issue = client.Issue.find(params[:ticket_id])
        issue_transitions = issue.transitions.all
        transition_builder = issue.transitions.build

        if params[:transition_id] 
          transition_builder.save!('transition' => {'id' => params[:transition_id]})
        else 
          transition = issue_transitions.select { |transition|
            if params[:matching]
              params[:matching].call(transition)
            else 
              transition.name == params[:transition_name]
            end
          }.first
          if !transition.nil? && !transition.id.nil?
           transition_builder.save('transition' => {'id' => transition.id })
          elsif params[:fail_if_no_matching] == true 
            UI.crash!("0 matching transitions")
          end
        end
      end

      def self.description
        "Runs transitions for specified JIRA tickets"
      end

      def self.authors
        ["<NAME>"]
      end

      def self.return_value
        # If your method provides a return value, you can describe here what it does
      end

      def self.details
        # Optional:
        "Helps to run transitions for specified JIRA tickets (matching by transition name or id)"
      end

      def self.available_options
        [
          FastlaneCore::ConfigItem.new(key: :client,
                              description: "JIRA::Client from 'jira-ruby' gem",
                                is_string: false,
                                optional: false,
                                type: JIRA::Client),
          FastlaneCore::ConfigItem.new(key: :ticket_id,
                               description: "ID of ticket",
                                  optional: false,
                                      type: String),
          FastlaneCore::ConfigItem.new(key: :transition_id,
                               description: "ID of transition to perform",
                                  optional: true,
                                      type: String,
                              verify_block: proc do |value|
                                              UI.user_error!("Invalid transition_id") if value.to_s.length == 0
                                          end),
          FastlaneCore::ConfigItem.new(key: :transition_name,
                               description: "Name of transition to perform",
                                  optional: true,
                                      type: String,
                              verify_block: proc do |value|
                                              UI.user_error!("Invalid transition_name") if value.to_s.length == 0
{'fraction_non_alphanumeric': 0.07992271210258212, 'fraction_numerical': 0.0010539258738802037, 'mean_word_length': 1.3297872340425532, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628513', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1274, 'n_words': 331}