abir18/sample_suggestion_acceptance huggingface dataset:
Original:                  }
Modified:                      if err := errorList.ToError(); err != nil {                             return nil, err                 }
Suggestion accepted: False
Original:                          if _, ok := forbiddenPolicies[string(container.ImagePullPolicy)]; ok {
Modified:                                 if forbiddenPolicies.Contains(string(container.ImagePullPolicy)) {
Suggestion accepted: True
Original:  "golang.stackrox.io/kube-linter/pkg/check"
Modified:  "golang.stackrox.io/kube-linter/internal/set" "golang.stackrox.io/kube-linter/pkg/check"
Suggestion accepted: True
Original:   }
Modified:      nsSelector := peer.NamespaceSelector    if nsSelector != nil {          return "" // For now, we assume all pods with namespace selectors are okay    }
Suggestion accepted: True
Original:  Blockedlist []string
Modified:    BlockList []string
Suggestion accepted: False
Original:                                  }
Modified:                                      if isInList(blockedRegexes, container.Image) {                                          results = append(results, diagnostic.Diagnostic{Message: fmt.Sprintf("The container %q is using an improper image tag, %q.", container.Name, container.Image)})                                       }
Suggestion accepted: False
Original:   clusterRoleGVK = rbacV1.SchemeGroupVersion.WithKind(ClusterRole)
Modified:       clusterRoleGVK = rbacV1.SchemeGroupVersion.WithKind("ClusterRole")
Suggestion accepted: True
Original:  return fmt.Sprintf("%s/%s", clusterRoleBindingGVK.Group, clusterRoleBindingGVK.Version)
Modified:      return clusterRoleBindingGVK.GroupVersion().String()
Suggestion accepted: True
Original:  return fmt.Sprintf("%s/%s", roleBindingGVK.Group, roleBindingGVK.Version)
Modified:    return roleBindingGVK.GroupVersion().String()
Suggestion accepted: True
Original:   roleExists := false
Modified:     var roleExists bool
Suggestion accepted: True
Original:   clusterroles := []*rbacV1.ClusterRole{}
Modified:         var results []diagnostic.Diagnostic     var clusterroles []*rbacV1.ClusterRole
Suggestion accepted: True
Original:                          }
Modified:                                      binding, ok := object.K8sObject.(*rbacV1.RoleBinding)                                   if ok {                                   namespace := stringutils.OrDefault(binding.Namespace, "default")                                      return findRole(binding.RoleRef.Name, namespace, lintCtx, resourceRegexes, verbRegexes, p.FlagRolesNotFound)                                  }
Suggestion accepted: False
Original:                 HumanName:   "Minimum recommended replicas not met",
Modified:                HumanName:   "Minimum replicas",
Suggestion accepted: False
Original:                 Description: "Flag applications running fewer than recommended number of replicas",
Modified:                 Description: "Flag applications running fewer than the specified number of replicas",
Suggestion accepted: False
Original:   var kinds []string
Modified:     kinds := make([]string, 0, len(allObjectKinds))
Suggestion accepted: True
Original:                                                                                                 Message: fmt.Sprintf("sensitive host system directory %s is mounted on container %s", dir, container.Name)})
Modified:                                                                                                Message: fmt.Sprintf("host system directory %q is mounted on container %q", dir, container.Name)})
Suggestion accepted: False
Original:                  ObjectKinds: []string{objectkinds.DeploymentLike},
Modified:                    ObjectKinds: []string{objectkinds.Service},
Suggestion accepted: True
Original:                                   if int(port.ContainerPort) >= 0 && int(port.ContainerPort) <= 1024 {
Modified:                                    if int(port.ContainerPort) > 0 && int(port.ContainerPort) < 1024 {
Suggestion accepted: True
Original:                                         return []diagnostic.Diagnostic{{Message: fmt.Sprintf("resource %s shares,  host's process namespace.", object.K8sObject.GetName())}}
Modified:                                        return []diagnostic.Diagnostic{{Message: "object shares the host's process namespace (via hostPID=true)"}}
Suggestion accepted: False
Original:  Clusterrolebinding = "ClusterRoleBinding"
Modified:   ClusterRoleBinding = "ClusterRoleBinding"
Suggestion accepted: True
Original:   clusterrolebindingGVK = schema.GroupVersionKind{
Modified:        clusterRoleBindingGVK = schema.GroupVersionKind{
Suggestion accepted: True
Original:                         return func(_ lintcontext.LintContext, object lintcontext.Object) []diagnostic.Diagnostic {
Modified:                   compiledRegexes := make([]*regexp.Regexp, 0, len(p.Dirs))                       for _, dir := range p.Dirs {                        r, err := regexp.Compile(dir)                           if err != nil {                            return nil, errors.Wrapf(err, "invalid regex %s", dir)                     }                       compiledRegexes = append(compiledRegexes, r)                        }                       return func(_ lintcontext.LintContext, object lintcontext.Object) []diagnostic.Diagnostic {
Suggestion accepted: False
Original:   // JSONFormat is for JSON output with kube-linter own data structs.
Modified:     // JSONFormat is for JSON output with kube-linter's own data structs.
Suggestion accepted: True
Original:   markDownTemplateStr = `# KubeLinter cheks
Modified:       markDownTemplateStr = `# KubeLinter checks
Suggestion accepted: True
Original: **Template**: [{{.Check.Template}}](generated/templates.md#{{.Check.Template}})
Modified: **Template**: [{{.Check.Template}}](generated/templates.md#{{.TemplateLink}})
Suggestion accepted: True
Original:   var SchemeBuilder = runtime.NewSchemeBuilder(ocsAppsV1.AddToScheme)
Modified:     schemeBuilder := runtime.NewSchemeBuilder(ocsAppsV1.AddToScheme)
Suggestion accepted: True
Original:  return strings.Join(sorted, ", ")
Modified:   return strings.Join(e.allowedValues.AsSortedSlice(func(i, j string) bool {              return i < j    }), ", ")
Suggestion accepted: True
Original:         transform = func(p *ParameterDesc, level int) HumanReadableParamDesc {
Modified:        transform := func(p *ParameterDesc, level int) HumanReadableParamDesc {
Suggestion accepted: False
Original:   }
Modified:      ns := stringutils.OrDefault(n.Namespace, "<no namespace>")
Suggestion accepted: True
Original: func (o Object) MarshalJSON() ([]byte, error) {
Modified: func (o *Object) MarshalJSON() ([]byte, error) {
Suggestion accepted: True
Original: func New() *lintContextImpl {
Modified: func New() LintContext {
Suggestion accepted: False
Original:  {{- if eq .FlagDesc.AddFlag true }}
Modified:     {{- if .FlagDesc.AddFlag true }}
Suggestion accepted: False
Original:           found := false
Modified:          var found bool
Suggestion accepted: True
Original:          Short: "Lint Kubernetes YAML files",
Modified:                Short: "Lint Kubernetes YAML files and Helm charts",
Suggestion accepted: True
Original:  //Minimum number of replicas
Modified:    // The minimum number of replicas a deployment must have before anti-affinity is enforced on it
Suggestion accepted: False
Original:                          if replicas > 1 {
Modified:                               if int(replicas) >= p.MinReplicas {
Suggestion accepted: False
Original:          Instantiate: params.WrapInstantiateFunc(func(_ params.Params) (check.Func, error) {
Modified:           Instantiate: params.WrapInstantiateFunc(func(p params.Params) (check.Func, error) {
Suggestion accepted: True
Original:                                  if podTemplateSpec.Spec.Affinity != nil && podTemplateSpec.Spec.Affinity.PodAntiAffinity != nil {
Modified:                                       if affinity := podTemplateSpec.Spec.Affinity; affinity != nil && affinity.PodAntiAffinity != nil {
Suggestion accepted: False
Original:                                         return []diagnostic.Diagnostic{{Message: fmt.Sprintf("object with (%v) replicas but anti affinity is not specified in pod spec ", replicas)}}
Modified:                                       return []diagnostic.Diagnostic{{Message: fmt.Sprintf("object has %d replicas but does not specify inter pod anti-affinity", replicas)}}
Suggestion accepted: False
Original:          Description: "Flag objects with multiple replicas but anti affinity not specified in the pod template spec",
Modified:                Description: "Flag objects with multiple replicas but inter-pod anti affinity not specified in the pod template spec",
Suggestion accepted: True
Original:  //The minimum number of replicas a deployment must have before anti-affinity is enforced on it
Modified:  // The minimum number of replicas a deployment must have before anti-affinity is enforced on it
Suggestion accepted: False
Original:                 HumanName:   "Dangling Deployments",
Modified:                HumanName:   "Mismatching Selector",
Suggestion accepted: False
Original:                                 return []diagnostic.Diagnostic{{Message: fmt.Sprintf("no pods found matching deployment labels (%v)", selector)}}
Modified:                           return []diagnostic.Diagnostic{{Message: fmt.Sprintf("labels in pod spec (%v) do not match labels in selector (%v)", podTemplateSpec.Labels, selector)}}
Suggestion accepted: False
Original:                                 labelSelector, err := metaV1.LabelSelectorAsSelector(&metaV1.LabelSelector{MatchLabels: selector.MatchLabels, MatchExpressions: selector.MatchExpressions})
Modified:                           labelSelector, err := metaV1.LabelSelectorAsSelector(selector)
Suggestion accepted: False
Original:                                                 Message: fmt.Sprintf("Object has invalid label selector: %v", err),
Modified:                                                 Message: fmt.Sprintf("object has invalid label selector: %v", err),
Suggestion accepted: False
Original:                 Description: "Flag deployments which do not have any selector matching a label in pod template",
Modified:            Description: "Flag deployments where the selector doesn't match the labels in the pod template spec",
Suggestion accepted: False
Original:  if len(blob) != len(hash) {
Modified: func generateKey(prefix string, value string) string {     var buf bytes.Buffer    buf.WriteString(prefix) buf.WriteString(value)  return buf.String()}
Suggestion accepted: False
Modified: func newPrefixKV(kvStore ds.dataStore, prefix string) ds.dataStore {   return ktds.Wrap(kvStore, ktds.PrefixTransform{Prefix: ds.NewKey(prefix)}).Children()[0]}
Suggestion accepted: False
Original:          if currentIsrs != nil {
Modified:         if fraudProofsEnabled && currentIsrs != nil {
Suggestion accepted: False
Original:         """Read consistency level for Spark."""
Modified:         """Read consistency level for Cassandra."""
Suggestion accepted: True
Original:         """Write consistency level for Spark."""
Modified:         """Write consistency level for Cassandra."""
Suggestion accepted: True
Original: """Holds available migrations."""
Modified: """Holds available database migrations."""
Suggestion accepted: True
Original:         kafka_connection_string: kafka topic name.
Modified:         kafka_connection_string: string with hosts and ports to connect.            The string need to be in the format: host1:port,host2:port,...,hostN:portN.            The argument is not necessary if is passed as an environment variable            named KAFKA_CONSUMER_CONNECTION_STRING.
Suggestion accepted: False
Original:         input_value = value or environment.get_variable("KAFKA_CONNECTION_STRING")
Modified:         input_value = value or environment.get_variable("KAFKA_CONSUMER_CONNECTION_STRING")
Suggestion accepted: True
Original:         if keep != "last" and keep != "first":
Modified:         if keep not in ["last", "first"]:
Suggestion accepted: False
Original: var fraudProofsEnabled = true
Modified: // TODO: move `fraudProofsEnabled` into configurationvar fraudProofsEnabled = true
Suggestion accepted: False
Original:     def __init__(self, *columns_names: str, is_regex: str = False):
Modified:     def __init__(self, *columns_names: str, is_regex: bool = False):
Suggestion accepted: False
Original:             the dataframe.
Modified:         columns_names: full names or patterns to search for target columns on            the dataframe. By default a single `*` character is considered a wildcard            and can be anywhere in the string, multiple wildcards are not supported.            By default strings starting with an `!` (exclamation mark) will be negated,            be it a regular string or simple pattern. When parameter :param is_regex:            is `True` simple patterns wildcards and negation is disabled and all strings            are interpreted as regular expressions.
Suggestion accepted: False
Original:                     )
Modified:             if self.name in dataframe.columns:                warnings.warn(                    f"The column {self.name} "                    "already exists in the dataframe and "                    "will be overwritten with another column."                )
Suggestion accepted: False
Original:         raise ValueError("DataFrame must have a 'ts' column.")
Modified:         raise ValueError(f"DataFrame must have a '{TIMESTAMP_COLUMN}' column.")
Suggestion accepted: True
Original:                  Hash: tmbytes.HexBytes(hash[:]),
Modified:                      Hash: tmbytes.HexBytes(hash),
Suggestion accepted: True
Original:  state.AppHash = appHash[:]
Modified:      state.AppHash = appHash
Suggestion accepted: False
Original:                          return fmt.Errorf("fail to parse the trusted hash for initializing the headerstore: %w", err)
Modified:                               return fmt.Errorf("failed to parse the trusted hash for initializing the headerstore: %w", err)
Suggestion accepted: True
Original:                          return fmt.Errorf("fail to fetch the trusted header for initializing the headerstore: %w", err)
Modified:                             return fmt.Errorf("failed to fetch the trusted header for initializing the headerstore: %w", err)
Suggestion accepted: True
Original:         ln.Logger.Info("halting full node...")
Modified:      ln.Logger.Info("halting light node...")
Suggestion accepted: False
Original:          return nil, fmt.Errorf("failed to unmarshal to protobuf: %w", err)
Modified: // loadHashFromIndex returns the hash of a block given its heightfunc (s *DefaultStore) loadHashFromIndex(height uint64) ([32]byte, error) {
Suggestion accepted: True
Original: }
Modified: func (h *Header) New() H {      return &Header{}}
Suggestion accepted: True
Original: func (c *DataAvailabilityLayerClient) SubmitBlock(context context.Context, block *types.Block) da.ResultSubmitBlock {
Modified: func (c *DataAvailabilityLayerClient) SubmitBlock(ctx context.Context, block *types.Block) da.ResultSubmitBlock {
Suggestion accepted: False
Original: func (c *DataAvailabilityLayerClient) CheckBlockAvailability(context context.Context, dataLayerHeight uint64) da.ResultCheckBlock {
Modified: func (c *DataAvailabilityLayerClient) CheckBlockAvailability(ctx context.Context, dataLayerHeight uint64) da.ResultCheckBlock {
Suggestion accepted: False
Original: func (c *DataAvailabilityLayerClient) RetrieveBlocks(context context.Context, dataLayerHeight uint64) da.ResultRetrieveBlocks {
Modified: func (c *DataAvailabilityLayerClient) RetrieveBlocks(ctx context.Context, dataLayerHeight uint64) da.ResultRetrieveBlocks {
Suggestion accepted: False
Original:  SubmitBlock(context context.Context, block *types.Block) ResultSubmitBlock
Modified:    SubmitBlock(ctx context.Context, block *types.Block) ResultSubmitBlock
Suggestion accepted: True
Original:  CheckBlockAvailability(context context.Context, dataLayerHeight uint64) ResultCheckBlock
Modified:      CheckBlockAvailability(ctx context.Context, dataLayerHeight uint64) ResultCheckBlock
Suggestion accepted: True
Original:  RetrieveBlocks(context context.Context, dataLayerHeight uint64) ResultRetrieveBlocks
Modified:  RetrieveBlocks(ctx context.Context, dataLayerHeight uint64) ResultRetrieveBlocks
Suggestion accepted: True
Original:         FraudProofs   bool              `mapstructure:"fraud_proofs"`
Modified:       StateFraudProofs   bool              `mapstructure:"fraud_proofs"`
Suggestion accepted: False
Original:  }
Modified:      opts := []libp2p.Option{libp2p.ListenAddrs(maddr), libp2p.Identity(c.privKey)}  if c.gater != nil {             opts = append(opts, libp2p.ConnectionGater(c.gater))    }       host, err := libp2p.New(opts...)
Suggestion accepted: False
Original:  if len(peers) > 0 {
Modified:    for _, p := range peers {               err := c.gater.BlockPeer(p.ID)          if err != nil {                 return err              }       }
Suggestion accepted: False
Original:          0,
Modified:            state.Version.Consensus.Block,          state.Version.Consensus.App,
Suggestion accepted: True
Original:                  }
Modified:                      default:                            t.Fatal("Unexpected call.Method", call.Method)                    }
Suggestion accepted: False
Original:           if currentIsrs != nil {
Modified:         if fraudProofsEnabled && currentIsrs != nil {
Suggestion accepted: True
Original: func createNodes(isMalicious bool, num int, wg *sync.WaitGroup, t *testing.T) ([]*Node, []*mocks.Application) {
Modified: func createNodes(num int, isMalicious bool, wg *sync.WaitGroup, t *testing.T) ([]*Node, []*mocks.Application) {
Suggestion accepted: False
Original:   }
Modified:      if resp.FraudProof == nil {             return nil, fmt.Errorf("fraud proof generation failed")       }       return resp.FraudProof, nil
Suggestion accepted: True
Original:   time.Sleep(1 * time.Second)
Modified:     // wait for nodes to start up and establish connections; 1 second ensures that test pass even on CI.    time.Sleep(1 * time.Second)
Suggestion accepted: True
Original:  return nil
Modified:      if ptr == nil {         return nil      }       return return m.lastCommit.Load().(*types.Commit)
Suggestion accepted: False
Original:                         return []WitnessData{}, nil
Modified:                   return nil, err
Suggestion accepted: False
Original:  }
Modified:      storeHeight := atomic.LoadUint64(&s.height)     if height > storeHeight {               _ = atomic.CompareAndSwapUint64(&s.height, storeHeight, height) }
Suggestion accepted: False
Original:                  // TODO(tzdybal): https://github.com/celestiaorg/optimint/issues/465`
Modified:                   // TODO(tzdybal): https://github.com/celestiaorg/optimint/issues/465
Suggestion accepted: False
Original:         return commit, fmt.Errorf("error decoding binary data of Commit into object: %w", err)
Modified:      if err != nil {         return nil, fmt.Errorf("error decoding binary data of Commit into object: %w", err)   }       return commit, nil
Suggestion accepted: False
Original:                 {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), "error loading hash by height 321: key not found"},
Modified:              {"valid/int param", "/block?height=321", http.StatusOK, int(json2.E_INTERNAL), "error loading block hash for height"},
Suggestion accepted: False
Original:                 return hash, fmt.Errorf("error loading hash by height %v: %w", height, err)
Modified:                 return hash, fmt.Errorf("error loading block hash for height %v: %w", height, err)
Suggestion accepted: False
Original:          return types.State{}, fmt.Errorf("failed to retrieve key: %w", err)
Modified:                 return types.State{}, fmt.Errorf("failed to retrieve state: %w", err)
Suggestion accepted: True
Original: // They are needed because for proper deserialization.
Modified: // They are needed for proper deserialization.
Suggestion accepted: True
Original: func NewNode(ctx context.Context, conf config.NodeConfig, p2pKey crypto.PrivKey, managerKey crypto.PrivKey, clientCreator proxy.ClientCreator, genesis *tmtypes.GenesisDoc, logger log.Logger) (*Node, error) {
Modified: func NewNode(ctx context.Context, conf config.NodeConfig, p2pKey crypto.PrivKey, signingKey crypto.PrivKey, clientCreator proxy.ClientCreator, genesis *tmtypes.GenesisDoc, logger log.Logger) (*Node, error) {
Suggestion accepted: True
Original: func (n *Node) GetGenisisChunk() []string {
Modified: func (n *Node) GetGenisisChunks() []string {
Suggestion accepted: True
Original:   genesisChunkSize = 16 * 1024 * 1024 // 16
Modified:       genesisChunkSize = 16 * 1024 * 1024 // 16 MiB
Suggestion accepted: True
Original: // Default chunk size should be genesisChunkSize (16 * 1024 * 1024)
Modified: // InitGenesisChunks creates a chunked format of the genesis document to make it easier to// iterate through larger genesis structures.// Default chunk size should be genesisChunkSize
Suggestion accepted: False
Original:                   currentHeight := m.store.Height() // TODO(tzdybal): maybe store a copy in memory
Modified:        if height == initialHeight {            delay = time.Until(m.genesis.GenesisTime)       } else if height > initialHeight {              delay = time.Until(m.lastState.LastBlockTime.Add(m.conf.BlockTime))     }
Suggestion accepted: True
Original: func TestAggregationLoop(t *testing.T) {
Modified: func TestFutureGenesisTime(t *testing.T) {
Suggestion accepted: False
Original: // Input to the ListERLs function
Modified: // ListERLsInput is used as input to the ListERLs function.
Suggestion accepted: True
Original:  validators = append(validators, assertRecv, assertNotRecv, assertNotRecv, assertRecv, assertRecv)
Modified:     validators := []GossipValidator{assertRecv, assertNotRecv, assertNotRecv, assertRecv, assertRecv}
Suggestion accepted: True
Original: func startTestNetwork(ctx context.Context, t *testing.T, n int, conf map[int]hostDescr, logger log.Logger, validators []GossipValidator) testNet {
Modified: func startTestNetwork(ctx context.Context, t *testing.T, n int, conf map[int]hostDescr, validators []GossipValidator, logger log.Logger) testNet {
Suggestion accepted: False
Original:  return nil
Modified:     return bb.txn.Set(key, value)
Suggestion accepted: False
Original:   //write transactions should be short lived as they use extra resources in badger
Modified: // NewBatch creates new batch.// Note: badger batches should be short lived as they use extra resources.func (b *BadgerKV) NewBatch() Batch {
Suggestion accepted: True
Original:  // ErrKeyNotFound custom for for non existing keys in the DB.
Modified:   // ErrKeyNotFound is returned if key is not found in KVStore.
Suggestion accepted: False
Original:  if errors.Is(err, badger.ErrKeyNotFound) {
Modified:    if errors.Is(err, store.ErrKeyNotFound) {
Suggestion accepted: True
Original:          return da.ResultCheckBlock{DAResult: da.DAResult{Code: da.StatusSuccess}, DataAvailable: false}
Modified:               return da.ResultCheckBlock{DAResult: da.DAResult{Code: da.StatusError, Message: err.Error()}, DataAvailable: false}
Suggestion accepted: True
Original:  "github.com/dgraph-io/badger"
Modified:       "github.com/dgraph-io/badger/v3"
Suggestion accepted: True
Original: func TestGet(t *testing.T) {
Modified: func TestGetErrors(t *testing.T) {
Suggestion accepted: True
Original:         hash, err := m.dalcKV.Get(getIndexKey(height))
Modified:        hash, err := m.dalcKV.Get(getKey(height))
Suggestion accepted: False
Original:          return c.ETCD.Validate()        
Modified:                return c.ETCD.Validate()
Suggestion accepted: True
Original: func getIndexKey(height uint64) []byte {
Modified: func getKey(height uint64) []byte {
Suggestion accepted: False
Original:         err = m.dalcKV.Set(getIndexKey(block.Header.Height), hash[:])
Modified:         err = m.dalcKV.Set(getKey(block.Header.Height), hash[:])
Suggestion accepted: False
Original:  "path/filepath"
Modified:     "path/filepath"       "github.com/dgraph-io/badger/v3"
Suggestion accepted: True