Skip to content

Commit a4dd91b

Browse files
Merge pull request #411 from microsoft/feature/fix-code-quality-alerts
fix: Code Quality Fix
2 parents ac37bb6 + 2029575 commit a4dd91b

4 files changed

Lines changed: 8 additions & 9 deletions

File tree

scripts/validate_bicep_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def parse_parameters_env_vars(json_path: Path) -> dict[str, list[str]]:
110110
data = json.loads(sanitized)
111111
params = data.get("parameters", {})
112112
except json.JSONDecodeError:
113+
# If JSON parsing fails, params remains empty and no variables will be found.
114+
# This is acceptable as the function will return an empty result dict.
113115
pass
114116

115117
# Walk each top-level parameter and scan its entire serialized value

src/backend/common/database/cosmosdb.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ async def create_batch(self, user_id: str, batch_id: UUID) -> BatchRecord:
110110
self.logger.info("Returning existing batch record", batch_id=str(batch_id))
111111
return BatchRecord.fromdb(batchexists)
112112

113+
# This line should never be reached as all paths above either return or raise
114+
raise RuntimeError(f"Unexpected state while processing batch {batch_id}")
115+
113116
except Exception as e:
114117
self.logger.error("Failed to create batch", error=str(e))
115118
raise

src/backend/sql_agents/convert_script.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ async def convert_script(
271271
FileResult.ERROR,
272272
),
273273
)
274-
is_complete = True
275274
break
276275

277276
if comms_manager.group_chat.is_complete:

src/frontend/src/pages/modernizationPage.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Header from "../components/Header/Header";
44
import HeaderTools from "../components/Header/HeaderTools";
55
import PanelLeft from "../components/Panels/PanelLeft";
66
import webSocketService from "../api/WebSocketService";
7-
import { useSelector } from 'react-redux';
87
import {
98
Button,
109
Text,
@@ -479,9 +478,6 @@ const getPrintFileStatus = (status: string): string => {
479478
const ModernizationPage = () => {
480479
const { batchId } = useParams<{ batchId: string }>();
481480
const navigate = useNavigate();
482-
483-
// Redux state to listen for start processing completion
484-
const batchState = useSelector((state: any) => state.batch);
485481

486482
const [batchSummary, setBatchSummary] = useState<BatchSummary | null>(null);
487483
const styles = useStyles();
@@ -498,7 +494,6 @@ const ModernizationPage = () => {
498494
const [fileId, setFileId] = React.useState<string>("");
499495
const [expandedSections, setExpandedSections] = React.useState<string[]>([]);
500496
const [allFilesCompleted, setAllFilesCompleted] = useState(false);
501-
const [progressPercentage, setProgressPercentage] = useState(0);
502497
const [isZipButtonDisabled, setIsZipButtonDisabled] = useState(true);
503498
const [fileLoading, setFileLoading] = useState(false);
504499
const [lastActivityTime, setLastActivityTime] = useState<number>(Date.now());
@@ -516,7 +511,7 @@ const ModernizationPage = () => {
516511
const selectedFile = files.find((f) => f.id === selectedFileId);
517512
if (!selectedFile || !selectedFile.translatedCode) {
518513
setFileLoading(true);
519-
const newFileUpdate = await fetchFileFromAPI(selectedFile?.fileId || "");
514+
await fetchFileFromAPI(selectedFile?.fileId || "");
520515
setFileLoading(false);
521516
} else {
522517

@@ -988,13 +983,13 @@ useEffect(() => {
988983
// Set a timeout for initial loading - if no progress after 30 seconds, show error
989984
useEffect(() => {
990985
const loadingTimeout = setTimeout(() => {
991-
if (progressPercentage < 5 && showLoading) {
986+
if (showLoading) {
992987
setLoadingError('Processing is taking longer than expected. You can continue waiting or try again later.');
993988
}
994989
}, 30000);
995990

996991
return () => clearTimeout(loadingTimeout);
997-
}, [progressPercentage, showLoading]);
992+
}, [showLoading]);
998993

999994
// Poll summary status during inactivity, but do not force completion/navigation by timeout.
1000995
useEffect(() => {

0 commit comments

Comments
 (0)