smengcl commented on code in PR #10940:
URL: https://github.com/apache/ozone/pull/10940#discussion_r4301718105


##########
hadoop-ozone/dev-support/checks/infer.sh:
##########
@@ -0,0 +1,77 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -u -o pipefail
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+cd "$DIR/../../.." || exit 1
+
+source "${DIR}/_lib.sh"
+source "${DIR}/install/infer.sh"
+
+REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/infer"}
+REPORT_FILE="$REPORT_DIR/summary.txt"
+
+MAVEN_OPTIONS='-B -DskipTests -DskipDocs -DskipRecon -DskipShade 
-Dsort.skip=true --no-transfer-progress'
+
+# Restore pom.xml files that may have been corrupted by a previous infer run
+# (infer injects profiles into pom.xml and sometimes fails to restore them).
+git checkout -- hadoop-ozone/ozonefs-hadoop2/pom.xml 
hadoop-ozone/ozonefs-shaded/pom.xml 2>/dev/null || true

Review Comment:
   These unconditional git checkout commands erase tracked edits in the two 
ozonefs POMs whenever infer.sh is run from a worktree with uncommitted changes. 
That silently destroys a developer's local work before the analysis even starts 
(and repeats after it), so the check is unsafe to run in a dirty checkout.
   
   Pls preserve and restore the original files safely, or refuse to run when 
these paths are modified instead of checking them out.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to